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 40000282 : TempIterator::TempIterator(LInstruction* instr)
36 40000282 : : instr_(instr), limit_(instr->TempCount()), current_(0) {
37 40000419 : SkipUninteresting();
38 40000501 : }
39 :
40 :
41 : bool TempIterator::Done() { return current_ >= limit_; }
42 :
43 :
44 : LOperand* TempIterator::Current() {
45 : DCHECK(!Done());
46 377060 : return instr_->TempAt(current_);
47 : }
48 :
49 :
50 40377412 : void TempIterator::SkipUninteresting() {
51 40377412 : while (current_ < limit_ && instr_->TempAt(current_) == NULL) ++current_;
52 40377411 : }
53 :
54 :
55 : void TempIterator::Advance() {
56 377061 : ++current_;
57 377061 : SkipUninteresting();
58 : }
59 :
60 :
61 44097577 : InputIterator::InputIterator(LInstruction* instr)
62 44097577 : : instr_(instr), limit_(instr->InputCount()), current_(0) {
63 44096814 : SkipUninteresting();
64 44096632 : }
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 20900883 : return instr_->InputAt(current_);
74 : }
75 :
76 :
77 : void InputIterator::Advance() {
78 20901219 : ++current_;
79 20901219 : SkipUninteresting();
80 : }
81 :
82 :
83 64994535 : void InputIterator::SkipUninteresting() {
84 138416666 : while (current_ < limit_) {
85 29327695 : LOperand* current = instr_->InputAt(current_);
86 57580542 : if (current != NULL && !current->IsConstantOperand()) break;
87 8427596 : ++current_;
88 : }
89 64994505 : }
90 :
91 :
92 88194177 : UseIterator::UseIterator(LInstruction* instr)
93 88194177 : : input_iterator_(instr), env_iterator_(instr->environment()) {}
94 :
95 :
96 : bool UseIterator::Done() {
97 185389458 : return input_iterator_.Done() && env_iterator_.Done();
98 : }
99 :
100 :
101 59045178 : LOperand* UseIterator::Current() {
102 : DCHECK(!Done());
103 79946061 : LOperand* result = input_iterator_.Done() ? env_iterator_.Current()
104 59045178 : : input_iterator_.Current();
105 : DCHECK(result != NULL);
106 59045182 : return result;
107 : }
108 :
109 :
110 59046155 : void UseIterator::Advance() {
111 59046155 : input_iterator_.Done() ? env_iterator_.Advance() : input_iterator_.Advance();
112 59045630 : }
113 : } // namespace internal
114 : } // namespace v8
115 :
116 : #endif // V8_CRANKSHAFT_LITHIUM_INL_H_
|