| 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_ARM_LITHIUM_ARM_H_ | 28 #ifndef V8_ARM_LITHIUM_ARM_H_ |
| 29 #define V8_ARM_LITHIUM_ARM_H_ | 29 #define V8_ARM_LITHIUM_ARM_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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 private: | 281 private: |
| 281 LEnvironment* environment_; | 282 LEnvironment* environment_; |
| 282 SetOncePointer<LPointerMap> pointer_map_; | 283 SetOncePointer<LPointerMap> pointer_map_; |
| 283 HValue* hydrogen_value_; | 284 HValue* hydrogen_value_; |
| 284 SetOncePointer<LEnvironment> deoptimization_environment_; | 285 SetOncePointer<LEnvironment> deoptimization_environment_; |
| 285 bool is_call_; | 286 bool is_call_; |
| 286 bool is_save_doubles_; | 287 bool is_save_doubles_; |
| 287 }; | 288 }; |
| 288 | 289 |
| 289 | 290 |
| 290 template<typename ElementType, int NumElements> | |
| 291 class OperandContainer { | |
| 292 public: | |
| 293 OperandContainer() { | |
| 294 for (int i = 0; i < NumElements; i++) elems_[i] = NULL; | |
| 295 } | |
| 296 int length() { return NumElements; } | |
| 297 ElementType& operator[](int i) { | |
| 298 ASSERT(i < length()); | |
| 299 return elems_[i]; | |
| 300 } | |
| 301 void PrintOperandsTo(StringStream* stream); | |
| 302 | |
| 303 private: | |
| 304 ElementType elems_[NumElements]; | |
| 305 }; | |
| 306 | |
| 307 | |
| 308 template<typename ElementType> | |
| 309 class OperandContainer<ElementType, 0> { | |
| 310 public: | |
| 311 int length() { return 0; } | |
| 312 void PrintOperandsTo(StringStream* stream) { } | |
| 313 ElementType& operator[](int i) { | |
| 314 UNREACHABLE(); | |
| 315 static ElementType t = 0; | |
| 316 return t; | |
| 317 } | |
| 318 }; | |
| 319 | |
| 320 | |
| 321 // R = number of result operands (0 or 1). | 291 // R = number of result operands (0 or 1). |
| 322 // I = number of input operands. | 292 // I = number of input operands. |
| 323 // T = number of temporary operands. | 293 // T = number of temporary operands. |
| 324 template<int R, int I, int T> | 294 template<int R, int I, int T> |
| 325 class LTemplateInstruction: public LInstruction { | 295 class LTemplateInstruction: public LInstruction { |
| 326 public: | 296 public: |
| 327 // Allow 0 or 1 output operands. | 297 // Allow 0 or 1 output operands. |
| 328 STATIC_ASSERT(R == 0 || R == 1); | 298 STATIC_ASSERT(R == 0 || R == 1); |
| 329 virtual bool HasResult() const { return R != 0; } | 299 virtual bool HasResult() const { return R != 0; } |
| 330 void set_result(LOperand* operand) { results_[0] = operand; } | 300 void set_result(LOperand* operand) { results_[0] = operand; } |
| 331 LOperand* result() { return results_[0]; } | 301 LOperand* result() { return results_[0]; } |
| 332 | 302 |
| 333 int InputCount() { return I; } | 303 int InputCount() { return I; } |
| 334 LOperand* InputAt(int i) { return inputs_[i]; } | 304 LOperand* InputAt(int i) { return inputs_[i]; } |
| 335 | 305 |
| 336 int TempCount() { return T; } | 306 int TempCount() { return T; } |
| 337 LOperand* TempAt(int i) { return temps_[i]; } | 307 LOperand* TempAt(int i) { return temps_[i]; } |
| 338 | 308 |
| 339 virtual void PrintDataTo(StringStream* stream); | 309 virtual void PrintDataTo(StringStream* stream); |
| 340 virtual void PrintOutputOperandTo(StringStream* stream); | 310 virtual void PrintOutputOperandTo(StringStream* stream); |
| 341 | 311 |
| 342 protected: | 312 protected: |
| 343 OperandContainer<LOperand*, R> results_; | 313 EmbeddedContainer<LOperand*, R> results_; |
| 344 OperandContainer<LOperand*, I> inputs_; | 314 EmbeddedContainer<LOperand*, I> inputs_; |
| 345 OperandContainer<LOperand*, T> temps_; | 315 EmbeddedContainer<LOperand*, T> temps_; |
| 346 }; | 316 }; |
| 347 | 317 |
| 348 | 318 |
| 349 class LGap: public LTemplateInstruction<0, 0, 0> { | 319 class LGap: public LTemplateInstruction<0, 0, 0> { |
| 350 public: | 320 public: |
| 351 explicit LGap(HBasicBlock* block) | 321 explicit LGap(HBasicBlock* block) |
| 352 : block_(block) { | 322 : block_(block) { |
| 353 parallel_moves_[BEFORE] = NULL; | 323 parallel_moves_[BEFORE] = NULL; |
| 354 parallel_moves_[START] = NULL; | 324 parallel_moves_[START] = NULL; |
| 355 parallel_moves_[END] = NULL; | 325 parallel_moves_[END] = NULL; |
| (...skipping 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2345 | 2315 |
| 2346 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2316 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2347 }; | 2317 }; |
| 2348 | 2318 |
| 2349 #undef DECLARE_HYDROGEN_ACCESSOR | 2319 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2350 #undef DECLARE_CONCRETE_INSTRUCTION | 2320 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2351 | 2321 |
| 2352 } } // namespace v8::internal | 2322 } } // namespace v8::internal |
| 2353 | 2323 |
| 2354 #endif // V8_ARM_LITHIUM_ARM_H_ | 2324 #endif // V8_ARM_LITHIUM_ARM_H_ |
| OLD | NEW |