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_X87_LITHIUM_X87_H_ | 5 #ifndef V8_X87_LITHIUM_X87_H_ |
6 #define V8_X87_LITHIUM_X87_H_ | 6 #define V8_X87_LITHIUM_X87_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 | 199 |
196 virtual void CompileToNative(LCodeGen* generator) = 0; | 200 virtual void CompileToNative(LCodeGen* generator) = 0; |
197 virtual const char* Mnemonic() const = 0; | 201 virtual const char* Mnemonic() const = 0; |
198 virtual void PrintTo(StringStream* stream); | 202 virtual void PrintTo(StringStream* stream); |
199 virtual void PrintDataTo(StringStream* stream); | 203 virtual void PrintDataTo(StringStream* stream); |
200 virtual void PrintOutputOperandTo(StringStream* stream); | 204 virtual void PrintOutputOperandTo(StringStream* stream); |
201 | 205 |
202 enum Opcode { | 206 enum Opcode { |
203 // Declare a unique enum value for each instruction. | 207 // Declare a unique enum value for each instruction. |
204 #define DECLARE_OPCODE(type) k##type, | 208 #define DECLARE_OPCODE(type) k##type, |
205 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) | 209 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) kAdapter, |
206 kNumberOfInstructions | 210 kNumberOfInstructions |
207 #undef DECLARE_OPCODE | 211 #undef DECLARE_OPCODE |
208 }; | 212 }; |
209 | 213 |
210 virtual Opcode opcode() const = 0; | 214 virtual Opcode opcode() const = 0; |
211 | 215 |
212 // Declare non-virtual type testers for all leaf IR classes. | 216 // Declare non-virtual type testers for all leaf IR classes. |
213 #define DECLARE_PREDICATE(type) \ | 217 #define DECLARE_PREDICATE(type) \ |
214 bool Is##type() const { return opcode() == k##type; } | 218 bool Is##type() const { return opcode() == k##type; } |
215 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) | 219 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) |
216 #undef DECLARE_PREDICATE | 220 #undef DECLARE_PREDICATE |
217 | 221 |
218 // Declare virtual predicates for instructions that don't have | 222 // Declare virtual predicates for instructions that don't have |
219 // an opcode. | 223 // an opcode. |
220 virtual bool IsGap() const { return false; } | 224 virtual bool IsGap() const { return false; } |
221 | 225 |
222 virtual bool IsControl() const { return false; } | 226 virtual bool IsControl() const { return false; } |
223 | 227 |
| 228 // Try deleting this instruction if possible. |
| 229 virtual bool TryDelete() { return false; } |
| 230 |
224 void set_environment(LEnvironment* env) { environment_ = env; } | 231 void set_environment(LEnvironment* env) { environment_ = env; } |
225 LEnvironment* environment() const { return environment_; } | 232 LEnvironment* environment() const { return environment_; } |
226 bool HasEnvironment() const { return environment_ != NULL; } | 233 bool HasEnvironment() const { return environment_ != NULL; } |
227 | 234 |
228 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 235 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
229 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 236 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
230 bool HasPointerMap() const { return pointer_map_.is_set(); } | 237 bool HasPointerMap() const { return pointer_map_.is_set(); } |
231 | 238 |
232 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 239 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
233 HValue* hydrogen_value() const { return hydrogen_value_; } | 240 HValue* hydrogen_value() const { return hydrogen_value_; } |
(...skipping 22 matching lines...) Expand all Loading... |
256 | 263 |
257 LOperand* FirstInput() { return InputAt(0); } | 264 LOperand* FirstInput() { return InputAt(0); } |
258 LOperand* Output() { return HasResult() ? result() : NULL; } | 265 LOperand* Output() { return HasResult() ? result() : NULL; } |
259 | 266 |
260 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } | 267 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } |
261 | 268 |
262 #ifdef DEBUG | 269 #ifdef DEBUG |
263 void VerifyCall(); | 270 void VerifyCall(); |
264 #endif | 271 #endif |
265 | 272 |
| 273 virtual int InputCount() = 0; |
| 274 virtual LOperand* InputAt(int i) = 0; |
| 275 |
266 private: | 276 private: |
267 // Iterator support. | 277 // Iterator support. |
268 friend class InputIterator; | 278 friend class InputIterator; |
269 virtual int InputCount() = 0; | |
270 virtual LOperand* InputAt(int i) = 0; | |
271 | 279 |
272 friend class TempIterator; | 280 friend class TempIterator; |
273 virtual int TempCount() = 0; | 281 virtual int TempCount() = 0; |
274 virtual LOperand* TempAt(int i) = 0; | 282 virtual LOperand* TempAt(int i) = 0; |
275 | 283 |
276 class IsCallBits: public BitField<bool, 0, 1> {}; | 284 class IsCallBits: public BitField<bool, 0, 1> {}; |
277 | 285 |
278 LEnvironment* environment_; | 286 LEnvironment* environment_; |
279 SetOncePointer<LPointerMap> pointer_map_; | 287 SetOncePointer<LPointerMap> pointer_map_; |
280 HValue* hydrogen_value_; | 288 HValue* hydrogen_value_; |
(...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2900 | 2908 |
2901 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2909 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2902 }; | 2910 }; |
2903 | 2911 |
2904 #undef DECLARE_HYDROGEN_ACCESSOR | 2912 #undef DECLARE_HYDROGEN_ACCESSOR |
2905 #undef DECLARE_CONCRETE_INSTRUCTION | 2913 #undef DECLARE_CONCRETE_INSTRUCTION |
2906 | 2914 |
2907 } } // namespace v8::internal | 2915 } } // namespace v8::internal |
2908 | 2916 |
2909 #endif // V8_X87_LITHIUM_X87_H_ | 2917 #endif // V8_X87_LITHIUM_X87_H_ |
OLD | NEW |