| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_X64_LITHIUM_X64_H_ | 28 #ifndef V8_X64_LITHIUM_X64_H_ |
| 29 #define V8_X64_LITHIUM_X64_H_ | 29 #define V8_X64_LITHIUM_X64_H_ |
| 30 | 30 |
| 31 #include "hydrogen.h" | 31 #include "hydrogen.h" |
| 32 #include "lithium-allocator.h" | 32 #include "lithium-allocator.h" |
| 33 #include "lithium.h" | 33 #include "lithium.h" |
| 34 #include "safepoint-table.h" | 34 #include "safepoint-table.h" |
| 35 #include "utils.h" |
| 35 | 36 |
| 36 namespace v8 { | 37 namespace v8 { |
| 37 namespace internal { | 38 namespace internal { |
| 38 | 39 |
| 39 // Forward declarations. | 40 // Forward declarations. |
| 40 class LCodeGen; | 41 class LCodeGen; |
| 41 | 42 |
| 42 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ | 43 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ |
| 43 V(ControlInstruction) \ | 44 V(ControlInstruction) \ |
| 44 V(Call) \ | 45 V(Call) \ |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 private: | 280 private: |
| 280 LEnvironment* environment_; | 281 LEnvironment* environment_; |
| 281 SetOncePointer<LPointerMap> pointer_map_; | 282 SetOncePointer<LPointerMap> pointer_map_; |
| 282 HValue* hydrogen_value_; | 283 HValue* hydrogen_value_; |
| 283 SetOncePointer<LEnvironment> deoptimization_environment_; | 284 SetOncePointer<LEnvironment> deoptimization_environment_; |
| 284 bool is_call_; | 285 bool is_call_; |
| 285 bool is_save_doubles_; | 286 bool is_save_doubles_; |
| 286 }; | 287 }; |
| 287 | 288 |
| 288 | 289 |
| 289 template<typename ElementType, int NumElements> | |
| 290 class OperandContainer { | |
| 291 public: | |
| 292 OperandContainer() { | |
| 293 for (int i = 0; i < NumElements; i++) elems_[i] = NULL; | |
| 294 } | |
| 295 int length() { return NumElements; } | |
| 296 ElementType& operator[](int i) { | |
| 297 ASSERT(i < length()); | |
| 298 return elems_[i]; | |
| 299 } | |
| 300 void PrintOperandsTo(StringStream* stream); | |
| 301 | |
| 302 private: | |
| 303 ElementType elems_[NumElements]; | |
| 304 }; | |
| 305 | |
| 306 | |
| 307 template<typename ElementType> | |
| 308 class OperandContainer<ElementType, 0> { | |
| 309 public: | |
| 310 int length() { return 0; } | |
| 311 void PrintOperandsTo(StringStream* stream) { } | |
| 312 ElementType& operator[](int i) { | |
| 313 UNREACHABLE(); | |
| 314 static ElementType t = 0; | |
| 315 return t; | |
| 316 } | |
| 317 }; | |
| 318 | |
| 319 | |
| 320 // R = number of result operands (0 or 1). | 290 // R = number of result operands (0 or 1). |
| 321 // I = number of input operands. | 291 // I = number of input operands. |
| 322 // T = number of temporary operands. | 292 // T = number of temporary operands. |
| 323 template<int R, int I, int T> | 293 template<int R, int I, int T> |
| 324 class LTemplateInstruction: public LInstruction { | 294 class LTemplateInstruction: public LInstruction { |
| 325 public: | 295 public: |
| 326 // Allow 0 or 1 output operands. | 296 // Allow 0 or 1 output operands. |
| 327 STATIC_ASSERT(R == 0 || R == 1); | 297 STATIC_ASSERT(R == 0 || R == 1); |
| 328 virtual bool HasResult() const { return R != 0; } | 298 virtual bool HasResult() const { return R != 0; } |
| 329 void set_result(LOperand* operand) { results_[0] = operand; } | 299 void set_result(LOperand* operand) { results_[0] = operand; } |
| 330 LOperand* result() { return results_[0]; } | 300 LOperand* result() { return results_[0]; } |
| 331 | 301 |
| 332 int InputCount() { return I; } | 302 int InputCount() { return I; } |
| 333 LOperand* InputAt(int i) { return inputs_[i]; } | 303 LOperand* InputAt(int i) { return inputs_[i]; } |
| 334 | 304 |
| 335 int TempCount() { return T; } | 305 int TempCount() { return T; } |
| 336 LOperand* TempAt(int i) { return temps_[i]; } | 306 LOperand* TempAt(int i) { return temps_[i]; } |
| 337 | 307 |
| 338 virtual void PrintDataTo(StringStream* stream); | 308 virtual void PrintDataTo(StringStream* stream); |
| 339 virtual void PrintOutputOperandTo(StringStream* stream); | 309 virtual void PrintOutputOperandTo(StringStream* stream); |
| 340 | 310 |
| 341 protected: | 311 protected: |
| 342 OperandContainer<LOperand*, R> results_; | 312 EmbeddedContainer<LOperand*, R> results_; |
| 343 OperandContainer<LOperand*, I> inputs_; | 313 EmbeddedContainer<LOperand*, I> inputs_; |
| 344 OperandContainer<LOperand*, T> temps_; | 314 EmbeddedContainer<LOperand*, T> temps_; |
| 345 }; | 315 }; |
| 346 | 316 |
| 347 | 317 |
| 348 class LGap: public LTemplateInstruction<0, 0, 0> { | 318 class LGap: public LTemplateInstruction<0, 0, 0> { |
| 349 public: | 319 public: |
| 350 explicit LGap(HBasicBlock* block) | 320 explicit LGap(HBasicBlock* block) |
| 351 : block_(block) { | 321 : block_(block) { |
| 352 parallel_moves_[BEFORE] = NULL; | 322 parallel_moves_[BEFORE] = NULL; |
| 353 parallel_moves_[START] = NULL; | 323 parallel_moves_[START] = NULL; |
| 354 parallel_moves_[END] = NULL; | 324 parallel_moves_[END] = NULL; |
| (...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2304 | 2274 |
| 2305 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2275 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2306 }; | 2276 }; |
| 2307 | 2277 |
| 2308 #undef DECLARE_HYDROGEN_ACCESSOR | 2278 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2309 #undef DECLARE_CONCRETE_INSTRUCTION | 2279 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2310 | 2280 |
| 2311 } } // namespace v8::int | 2281 } } // namespace v8::int |
| 2312 | 2282 |
| 2313 #endif // V8_X64_LITHIUM_X64_H_ | 2283 #endif // V8_X64_LITHIUM_X64_H_ |
| OLD | NEW |