Line data Source code
1 : // Copyright 2012 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_CRANKSHAFT_LITHIUM_INL_H_
6 : #define V8_CRANKSHAFT_LITHIUM_INL_H_
7 :
8 : #include "src/crankshaft/lithium.h"
9 :
10 : #if V8_TARGET_ARCH_IA32
11 : #include "src/crankshaft/ia32/lithium-ia32.h" // NOLINT
12 : #elif V8_TARGET_ARCH_X64
13 : #include "src/crankshaft/x64/lithium-x64.h" // NOLINT
14 : #elif V8_TARGET_ARCH_ARM64
15 : #include "src/crankshaft/arm64/lithium-arm64.h" // NOLINT
16 : #elif V8_TARGET_ARCH_ARM
17 : #include "src/crankshaft/arm/lithium-arm.h" // NOLINT
18 : #elif V8_TARGET_ARCH_MIPS
19 : #include "src/crankshaft/mips/lithium-mips.h" // NOLINT
20 : #elif V8_TARGET_ARCH_MIPS64
21 : #include "src/crankshaft/mips64/lithium-mips64.h" // NOLINT
22 : #elif V8_TARGET_ARCH_PPC
23 : #include "src/crankshaft/ppc/lithium-ppc.h" // NOLINT
24 : #elif V8_TARGET_ARCH_S390
25 : #include "src/crankshaft/s390/lithium-s390.h" // NOLINT
26 : #elif V8_TARGET_ARCH_X87
27 : #include "src/crankshaft/x87/lithium-x87.h" // NOLINT
28 : #else
29 : #error "Unknown architecture."
30 : #endif
31 :
32 : namespace v8 {
33 : namespace internal {
34 :
35 40103847 : TempIterator::TempIterator(LInstruction* instr)
36 40103847 : : instr_(instr), limit_(instr->TempCount()), current_(0) {
37 40103833 : SkipUninteresting();
38 40103927 : }
39 :
40 :
41 : bool TempIterator::Done() { return current_ >= limit_; }
42 :
43 :
44 : LOperand* TempIterator::Current() {
45 : DCHECK(!Done());
46 379674 : return instr_->TempAt(current_);
47 : }
48 :
49 :
50 40483421 : void TempIterator::SkipUninteresting() {
51 40483421 : while (current_ < limit_ && instr_->TempAt(current_) == NULL) ++current_;
52 40483421 : }
53 :
54 :
55 : void TempIterator::Advance() {
56 379675 : ++current_;
57 379675 : SkipUninteresting();
58 : }
59 :
60 :
61 44217271 : InputIterator::InputIterator(LInstruction* instr)
62 44217271 : : instr_(instr), limit_(instr->InputCount()), current_(0) {
63 44216300 : SkipUninteresting();
64 44216129 : }
65 :
66 :
67 : bool InputIterator::Done() { return current_ >= limit_; }
68 :
69 :
70 : LOperand* InputIterator::Current() {
71 : DCHECK(!Done());
72 : DCHECK(instr_->InputAt(current_) != NULL);
73 20932063 : return instr_->InputAt(current_);
74 : }
75 :
76 :
77 : void InputIterator::Advance() {
78 20932550 : ++current_;
79 20932550 : SkipUninteresting();
80 : }
81 :
82 :
83 65144631 : void InputIterator::SkipUninteresting() {
84 138734284 : while (current_ < limit_) {
85 29376233 : LOperand* current = instr_->InputAt(current_);
86 57677805 : if (current != NULL && !current->IsConstantOperand()) break;
87 8445022 : ++current_;
88 : }
89 65144595 : }
90 :
91 :
92 88433281 : UseIterator::UseIterator(LInstruction* instr)
93 88433281 : : input_iterator_(instr), env_iterator_(instr->environment()) {}
94 :
95 :
96 : bool UseIterator::Done() {
97 185917154 : return input_iterator_.Done() && env_iterator_.Done();
98 : }
99 :
100 :
101 59205072 : LOperand* UseIterator::Current() {
102 : DCHECK(!Done());
103 80137135 : LOperand* result = input_iterator_.Done() ? env_iterator_.Current()
104 59205072 : : input_iterator_.Current();
105 : DCHECK(result != NULL);
106 59205060 : return result;
107 : }
108 :
109 :
110 59206170 : void UseIterator::Advance() {
111 59206170 : input_iterator_.Done() ? env_iterator_.Advance() : input_iterator_.Advance();
112 59205662 : }
113 : } // namespace internal
114 : } // namespace v8
115 :
116 : #endif // V8_CRANKSHAFT_LITHIUM_INL_H_
|