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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) |
| 209 kAdapter, |
205 kNumberOfInstructions | 210 kNumberOfInstructions |
206 #undef DECLARE_OPCODE | 211 #undef DECLARE_OPCODE |
207 }; | 212 }; |
208 | 213 |
209 virtual Opcode opcode() const = 0; | 214 virtual Opcode opcode() const = 0; |
210 | 215 |
211 // Declare non-virtual type testers for all leaf IR classes. | 216 // Declare non-virtual type testers for all leaf IR classes. |
212 #define DECLARE_PREDICATE(type) \ | 217 #define DECLARE_PREDICATE(type) \ |
213 bool Is##type() const { return opcode() == k##type; } | 218 bool Is##type() const { return opcode() == k##type; } |
214 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) | 219 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) |
215 #undef DECLARE_PREDICATE | 220 #undef DECLARE_PREDICATE |
216 | 221 |
217 // Declare virtual predicates for instructions that don't have | 222 // Declare virtual predicates for instructions that don't have |
218 // an opcode. | 223 // an opcode. |
219 virtual bool IsGap() const { return false; } | 224 virtual bool IsGap() const { return false; } |
220 | 225 |
221 virtual bool IsControl() const { return false; } | 226 virtual bool IsControl() const { return false; } |
222 | 227 |
| 228 // Try deleting this instruction if possible. |
| 229 virtual bool TryDelete() { return false; } |
| 230 |
223 void set_environment(LEnvironment* env) { environment_ = env; } | 231 void set_environment(LEnvironment* env) { environment_ = env; } |
224 LEnvironment* environment() const { return environment_; } | 232 LEnvironment* environment() const { return environment_; } |
225 bool HasEnvironment() const { return environment_ != NULL; } | 233 bool HasEnvironment() const { return environment_ != NULL; } |
226 | 234 |
227 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 235 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
228 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 236 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
229 bool HasPointerMap() const { return pointer_map_.is_set(); } | 237 bool HasPointerMap() const { return pointer_map_.is_set(); } |
230 | 238 |
231 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 239 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
232 HValue* hydrogen_value() const { return hydrogen_value_; } | 240 HValue* hydrogen_value() const { return hydrogen_value_; } |
(...skipping 18 matching lines...) Expand all Loading... |
251 | 259 |
252 LOperand* FirstInput() { return InputAt(0); } | 260 LOperand* FirstInput() { return InputAt(0); } |
253 LOperand* Output() { return HasResult() ? result() : NULL; } | 261 LOperand* Output() { return HasResult() ? result() : NULL; } |
254 | 262 |
255 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } | 263 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } |
256 | 264 |
257 #ifdef DEBUG | 265 #ifdef DEBUG |
258 void VerifyCall(); | 266 void VerifyCall(); |
259 #endif | 267 #endif |
260 | 268 |
| 269 virtual int InputCount() = 0; |
| 270 virtual LOperand* InputAt(int i) = 0; |
| 271 |
261 private: | 272 private: |
262 // Iterator support. | 273 // Iterator support. |
263 friend class InputIterator; | 274 friend class InputIterator; |
264 virtual int InputCount() = 0; | |
265 virtual LOperand* InputAt(int i) = 0; | |
266 | 275 |
267 friend class TempIterator; | 276 friend class TempIterator; |
268 virtual int TempCount() = 0; | 277 virtual int TempCount() = 0; |
269 virtual LOperand* TempAt(int i) = 0; | 278 virtual LOperand* TempAt(int i) = 0; |
270 | 279 |
271 class IsCallBits: public BitField<bool, 0, 1> {}; | 280 class IsCallBits: public BitField<bool, 0, 1> {}; |
272 | 281 |
273 LEnvironment* environment_; | 282 LEnvironment* environment_; |
274 SetOncePointer<LPointerMap> pointer_map_; | 283 SetOncePointer<LPointerMap> pointer_map_; |
275 HValue* hydrogen_value_; | 284 HValue* hydrogen_value_; |
(...skipping 2608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2884 | 2893 |
2885 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2894 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2886 }; | 2895 }; |
2887 | 2896 |
2888 #undef DECLARE_HYDROGEN_ACCESSOR | 2897 #undef DECLARE_HYDROGEN_ACCESSOR |
2889 #undef DECLARE_CONCRETE_INSTRUCTION | 2898 #undef DECLARE_CONCRETE_INSTRUCTION |
2890 | 2899 |
2891 } } // namespace v8::internal | 2900 } } // namespace v8::internal |
2892 | 2901 |
2893 #endif // V8_IA32_LITHIUM_IA32_H_ | 2902 #endif // V8_IA32_LITHIUM_IA32_H_ |
OLD | NEW |