| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 private: | 282 private: |
| 282 LEnvironment* environment_; | 283 LEnvironment* environment_; |
| 283 SetOncePointer<LPointerMap> pointer_map_; | 284 SetOncePointer<LPointerMap> pointer_map_; |
| 284 HValue* hydrogen_value_; | 285 HValue* hydrogen_value_; |
| 285 SetOncePointer<LEnvironment> deoptimization_environment_; | 286 SetOncePointer<LEnvironment> deoptimization_environment_; |
| 286 bool is_call_; | 287 bool is_call_; |
| 287 bool is_save_doubles_; | 288 bool is_save_doubles_; |
| 288 }; | 289 }; |
| 289 | 290 |
| 290 | 291 |
| 291 template<typename ElementType, int NumElements> | |
| 292 class OperandContainer { | |
| 293 public: | |
| 294 OperandContainer() { | |
| 295 for (int i = 0; i < NumElements; i++) elems_[i] = NULL; | |
| 296 } | |
| 297 int length() { return NumElements; } | |
| 298 ElementType& operator[](int i) { | |
| 299 ASSERT(i < length()); | |
| 300 return elems_[i]; | |
| 301 } | |
| 302 void PrintOperandsTo(StringStream* stream); | |
| 303 | |
| 304 private: | |
| 305 ElementType elems_[NumElements]; | |
| 306 }; | |
| 307 | |
| 308 | |
| 309 template<typename ElementType> | |
| 310 class OperandContainer<ElementType, 0> { | |
| 311 public: | |
| 312 int length() { return 0; } | |
| 313 void PrintOperandsTo(StringStream* stream) { } | |
| 314 ElementType& operator[](int i) { | |
| 315 UNREACHABLE(); | |
| 316 static ElementType t = 0; | |
| 317 return t; | |
| 318 } | |
| 319 }; | |
| 320 | |
| 321 | |
| 322 // R = number of result operands (0 or 1). | 292 // R = number of result operands (0 or 1). |
| 323 // I = number of input operands. | 293 // I = number of input operands. |
| 324 // T = number of temporary operands. | 294 // T = number of temporary operands. |
| 325 template<int R, int I, int T> | 295 template<int R, int I, int T> |
| 326 class LTemplateInstruction: public LInstruction { | 296 class LTemplateInstruction: public LInstruction { |
| 327 public: | 297 public: |
| 328 // Allow 0 or 1 output operands. | 298 // Allow 0 or 1 output operands. |
| 329 STATIC_ASSERT(R == 0 || R == 1); | 299 STATIC_ASSERT(R == 0 || R == 1); |
| 330 virtual bool HasResult() const { return R != 0; } | 300 virtual bool HasResult() const { return R != 0; } |
| 331 void set_result(LOperand* operand) { results_[0] = operand; } | 301 void set_result(LOperand* operand) { results_[0] = operand; } |
| 332 LOperand* result() { return results_[0]; } | 302 LOperand* result() { return results_[0]; } |
| 333 | 303 |
| 334 int InputCount() { return I; } | 304 int InputCount() { return I; } |
| 335 LOperand* InputAt(int i) { return inputs_[i]; } | 305 LOperand* InputAt(int i) { return inputs_[i]; } |
| 336 | 306 |
| 337 int TempCount() { return T; } | 307 int TempCount() { return T; } |
| 338 LOperand* TempAt(int i) { return temps_[i]; } | 308 LOperand* TempAt(int i) { return temps_[i]; } |
| 339 | 309 |
| 340 virtual void PrintDataTo(StringStream* stream); | 310 virtual void PrintDataTo(StringStream* stream); |
| 341 virtual void PrintOutputOperandTo(StringStream* stream); | 311 virtual void PrintOutputOperandTo(StringStream* stream); |
| 342 | 312 |
| 343 protected: | 313 protected: |
| 344 OperandContainer<LOperand*, R> results_; | 314 EmbeddedContainer<LOperand*, R> results_; |
| 345 OperandContainer<LOperand*, I> inputs_; | 315 EmbeddedContainer<LOperand*, I> inputs_; |
| 346 OperandContainer<LOperand*, T> temps_; | 316 EmbeddedContainer<LOperand*, T> temps_; |
| 347 }; | 317 }; |
| 348 | 318 |
| 349 | 319 |
| 350 class LGap: public LTemplateInstruction<0, 0, 0> { | 320 class LGap: public LTemplateInstruction<0, 0, 0> { |
| 351 public: | 321 public: |
| 352 explicit LGap(HBasicBlock* block) | 322 explicit LGap(HBasicBlock* block) |
| 353 : block_(block) { | 323 : block_(block) { |
| 354 parallel_moves_[BEFORE] = NULL; | 324 parallel_moves_[BEFORE] = NULL; |
| 355 parallel_moves_[START] = NULL; | 325 parallel_moves_[START] = NULL; |
| 356 parallel_moves_[END] = NULL; | 326 parallel_moves_[END] = NULL; |
| (...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2330 | 2300 |
| 2331 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2301 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2332 }; | 2302 }; |
| 2333 | 2303 |
| 2334 #undef DECLARE_HYDROGEN_ACCESSOR | 2304 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2335 #undef DECLARE_CONCRETE_INSTRUCTION | 2305 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2336 | 2306 |
| 2337 } } // namespace v8::int | 2307 } } // namespace v8::int |
| 2338 | 2308 |
| 2339 #endif // V8_X64_LITHIUM_X64_H_ | 2309 #endif // V8_X64_LITHIUM_X64_H_ |
| OLD | NEW |