OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_LITHIUM_ALLOCATOR_H_ | 5 #ifndef V8_LITHIUM_ALLOCATOR_H_ |
6 #define V8_LITHIUM_ALLOCATOR_H_ | 6 #define V8_LITHIUM_ALLOCATOR_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
11 #include "src/lithium.h" | 11 #include "src/lithium.h" |
12 #include "src/zone.h" | 12 #include "src/zone.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 // Forward declarations. | 17 // Forward declarations. |
18 class HBasicBlock; | 18 class HBasicBlock; |
19 class HGraph; | 19 class HGraph; |
20 class HInstruction; | |
21 class HPhi; | 20 class HPhi; |
22 class HTracer; | 21 class HTracer; |
23 class HValue; | 22 class HValue; |
24 class BitVector; | 23 class BitVector; |
25 class StringStream; | 24 class StringStream; |
26 | 25 |
27 class LPlatformChunk; | 26 class LPlatformChunk; |
28 class LOperand; | 27 class LOperand; |
29 class LUnallocated; | 28 class LUnallocated; |
30 class LGap; | 29 class LGap; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 110 |
112 // Code relies on kStep being a power of two. | 111 // Code relies on kStep being a power of two. |
113 STATIC_ASSERT(IS_POWER_OF_TWO(kStep)); | 112 STATIC_ASSERT(IS_POWER_OF_TWO(kStep)); |
114 | 113 |
115 explicit LifetimePosition(int value) : value_(value) { } | 114 explicit LifetimePosition(int value) : value_(value) { } |
116 | 115 |
117 int value_; | 116 int value_; |
118 }; | 117 }; |
119 | 118 |
120 | 119 |
121 enum RegisterKind { | |
122 UNALLOCATED_REGISTERS, | |
123 GENERAL_REGISTERS, | |
124 DOUBLE_REGISTERS | |
125 }; | |
126 | |
127 | |
128 // A register-allocator view of a Lithium instruction. It contains the id of | |
129 // the output operand and a list of input operand uses. | |
130 | |
131 class LInstruction; | |
132 class LEnvironment; | |
133 | |
134 // Iterator for non-null temp operands. | |
135 class TempIterator BASE_EMBEDDED { | |
136 public: | |
137 inline explicit TempIterator(LInstruction* instr); | |
138 inline bool Done(); | |
139 inline LOperand* Current(); | |
140 inline void Advance(); | |
141 | |
142 private: | |
143 inline void SkipUninteresting(); | |
144 LInstruction* instr_; | |
145 int limit_; | |
146 int current_; | |
147 }; | |
148 | |
149 | |
150 // Iterator for non-constant input operands. | |
151 class InputIterator BASE_EMBEDDED { | |
152 public: | |
153 inline explicit InputIterator(LInstruction* instr); | |
154 inline bool Done(); | |
155 inline LOperand* Current(); | |
156 inline void Advance(); | |
157 | |
158 private: | |
159 inline void SkipUninteresting(); | |
160 LInstruction* instr_; | |
161 int limit_; | |
162 int current_; | |
163 }; | |
164 | |
165 | |
166 class UseIterator BASE_EMBEDDED { | |
167 public: | |
168 inline explicit UseIterator(LInstruction* instr); | |
169 inline bool Done(); | |
170 inline LOperand* Current(); | |
171 inline void Advance(); | |
172 | |
173 private: | |
174 InputIterator input_iterator_; | |
175 DeepIterator env_iterator_; | |
176 }; | |
177 | |
178 | |
179 // Representation of the non-empty interval [start,end[. | 120 // Representation of the non-empty interval [start,end[. |
180 class UseInterval: public ZoneObject { | 121 class UseInterval: public ZoneObject { |
181 public: | 122 public: |
182 UseInterval(LifetimePosition start, LifetimePosition end) | 123 UseInterval(LifetimePosition start, LifetimePosition end) |
183 : start_(start), end_(end), next_(NULL) { | 124 : start_(start), end_(end), next_(NULL) { |
184 ASSERT(start.Value() < end.Value()); | 125 ASSERT(start.Value() < end.Value()); |
185 } | 126 } |
186 | 127 |
187 LifetimePosition start() const { return start_; } | 128 LifetimePosition start() const { return start_; } |
188 LifetimePosition end() const { return end_; } | 129 LifetimePosition end() const { return end_; } |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 LAllocator* allocator_; | 566 LAllocator* allocator_; |
626 unsigned allocator_zone_start_allocation_size_; | 567 unsigned allocator_zone_start_allocation_size_; |
627 | 568 |
628 DISALLOW_COPY_AND_ASSIGN(LAllocatorPhase); | 569 DISALLOW_COPY_AND_ASSIGN(LAllocatorPhase); |
629 }; | 570 }; |
630 | 571 |
631 | 572 |
632 } } // namespace v8::internal | 573 } } // namespace v8::internal |
633 | 574 |
634 #endif // V8_LITHIUM_ALLOCATOR_H_ | 575 #endif // V8_LITHIUM_ALLOCATOR_H_ |
OLD | NEW |