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_IA32_LITHIUM_IA32_H_ | 5 #ifndef V8_IA32_LITHIUM_IA32_H_ |
6 #define V8_IA32_LITHIUM_IA32_H_ | 6 #define V8_IA32_LITHIUM_IA32_H_ |
7 | 7 |
8 #include "src/hydrogen.h" | 8 #include "src/hydrogen.h" |
9 #include "src/lithium.h" | 9 #include "src/lithium.h" |
10 #include "src/lithium-allocator.h" | 10 #include "src/lithium-allocator.h" |
11 #include "src/safepoint-table.h" | 11 #include "src/safepoint-table.h" |
12 #include "src/utils.h" | 12 #include "src/utils.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
| 17 namespace compiler { |
| 18 class RCodeVisualizer; |
| 19 } |
| 20 |
17 // Forward declarations. | 21 // Forward declarations. |
18 class LCodeGen; | 22 class LCodeGen; |
19 | 23 |
20 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ | 24 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ |
21 V(AccessArgumentsAt) \ | 25 V(AccessArgumentsAt) \ |
22 V(AddI) \ | 26 V(AddI) \ |
23 V(AllocateBlockContext) \ | 27 V(AllocateBlockContext) \ |
24 V(Allocate) \ | 28 V(Allocate) \ |
25 V(ApplyArguments) \ | 29 V(ApplyArguments) \ |
26 V(ArgumentsElements) \ | 30 V(ArgumentsElements) \ |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 198 |
195 virtual void CompileToNative(LCodeGen* generator) = 0; | 199 virtual void CompileToNative(LCodeGen* generator) = 0; |
196 virtual const char* Mnemonic() const = 0; | 200 virtual const char* Mnemonic() const = 0; |
197 virtual void PrintTo(StringStream* stream); | 201 virtual void PrintTo(StringStream* stream); |
198 virtual void PrintDataTo(StringStream* stream); | 202 virtual void PrintDataTo(StringStream* stream); |
199 virtual void PrintOutputOperandTo(StringStream* stream); | 203 virtual void PrintOutputOperandTo(StringStream* stream); |
200 | 204 |
201 enum Opcode { | 205 enum Opcode { |
202 // Declare a unique enum value for each instruction. | 206 // Declare a unique enum value for each instruction. |
203 #define DECLARE_OPCODE(type) k##type, | 207 #define DECLARE_OPCODE(type) k##type, |
204 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) | 208 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) kAdapter, |
205 kNumberOfInstructions | 209 kNumberOfInstructions |
206 #undef DECLARE_OPCODE | 210 #undef DECLARE_OPCODE |
207 }; | 211 }; |
208 | 212 |
209 virtual Opcode opcode() const = 0; | 213 virtual Opcode opcode() const = 0; |
210 | 214 |
211 // Declare non-virtual type testers for all leaf IR classes. | 215 // Declare non-virtual type testers for all leaf IR classes. |
212 #define DECLARE_PREDICATE(type) \ | 216 #define DECLARE_PREDICATE(type) \ |
213 bool Is##type() const { return opcode() == k##type; } | 217 bool Is##type() const { return opcode() == k##type; } |
214 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) | 218 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) |
215 #undef DECLARE_PREDICATE | 219 #undef DECLARE_PREDICATE |
216 | 220 |
217 // Declare virtual predicates for instructions that don't have | 221 // Declare virtual predicates for instructions that don't have |
218 // an opcode. | 222 // an opcode. |
219 virtual bool IsGap() const { return false; } | 223 virtual bool IsGap() const { return false; } |
220 | 224 |
221 virtual bool IsControl() const { return false; } | 225 virtual bool IsControl() const { return false; } |
222 | 226 |
| 227 // Try deleting this instruction if possible. |
| 228 virtual bool TryDelete() { return false; } |
| 229 |
223 void set_environment(LEnvironment* env) { environment_ = env; } | 230 void set_environment(LEnvironment* env) { environment_ = env; } |
224 LEnvironment* environment() const { return environment_; } | 231 LEnvironment* environment() const { return environment_; } |
225 bool HasEnvironment() const { return environment_ != NULL; } | 232 bool HasEnvironment() const { return environment_ != NULL; } |
226 | 233 |
227 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 234 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
228 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 235 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
229 bool HasPointerMap() const { return pointer_map_.is_set(); } | 236 bool HasPointerMap() const { return pointer_map_.is_set(); } |
230 | 237 |
231 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 238 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
232 HValue* hydrogen_value() const { return hydrogen_value_; } | 239 HValue* hydrogen_value() const { return hydrogen_value_; } |
(...skipping 18 matching lines...) Expand all Loading... |
251 | 258 |
252 LOperand* FirstInput() { return InputAt(0); } | 259 LOperand* FirstInput() { return InputAt(0); } |
253 LOperand* Output() { return HasResult() ? result() : NULL; } | 260 LOperand* Output() { return HasResult() ? result() : NULL; } |
254 | 261 |
255 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } | 262 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } |
256 | 263 |
257 #ifdef DEBUG | 264 #ifdef DEBUG |
258 void VerifyCall(); | 265 void VerifyCall(); |
259 #endif | 266 #endif |
260 | 267 |
| 268 virtual int InputCount() = 0; |
| 269 virtual LOperand* InputAt(int i) = 0; |
| 270 |
261 private: | 271 private: |
262 // Iterator support. | 272 // Iterator support. |
263 friend class InputIterator; | 273 friend class InputIterator; |
264 virtual int InputCount() = 0; | |
265 virtual LOperand* InputAt(int i) = 0; | |
266 | 274 |
267 friend class TempIterator; | 275 friend class TempIterator; |
268 virtual int TempCount() = 0; | 276 virtual int TempCount() = 0; |
269 virtual LOperand* TempAt(int i) = 0; | 277 virtual LOperand* TempAt(int i) = 0; |
270 | 278 |
271 class IsCallBits: public BitField<bool, 0, 1> {}; | 279 class IsCallBits: public BitField<bool, 0, 1> {}; |
272 | 280 |
273 LEnvironment* environment_; | 281 LEnvironment* environment_; |
274 SetOncePointer<LPointerMap> pointer_map_; | 282 SetOncePointer<LPointerMap> pointer_map_; |
275 HValue* hydrogen_value_; | 283 HValue* hydrogen_value_; |
(...skipping 2608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2884 | 2892 |
2885 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2893 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2886 }; | 2894 }; |
2887 | 2895 |
2888 #undef DECLARE_HYDROGEN_ACCESSOR | 2896 #undef DECLARE_HYDROGEN_ACCESSOR |
2889 #undef DECLARE_CONCRETE_INSTRUCTION | 2897 #undef DECLARE_CONCRETE_INSTRUCTION |
2890 | 2898 |
2891 } } // namespace v8::internal | 2899 } } // namespace v8::internal |
2892 | 2900 |
2893 #endif // V8_IA32_LITHIUM_IA32_H_ | 2901 #endif // V8_IA32_LITHIUM_IA32_H_ |
OLD | NEW |