| 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_IA32_LITHIUM_IA32_H_ | 28 #ifndef V8_IA32_LITHIUM_IA32_H_ |
| 29 #define V8_IA32_LITHIUM_IA32_H_ | 29 #define V8_IA32_LITHIUM_IA32_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_CONCRETE_INSTRUCTION_LIST(V) \ | 43 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ |
| 43 V(AccessArgumentsAt) \ | 44 V(AccessArgumentsAt) \ |
| 44 V(AddI) \ | 45 V(AddI) \ |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 private: | 274 private: |
| 274 LEnvironment* environment_; | 275 LEnvironment* environment_; |
| 275 SetOncePointer<LPointerMap> pointer_map_; | 276 SetOncePointer<LPointerMap> pointer_map_; |
| 276 HValue* hydrogen_value_; | 277 HValue* hydrogen_value_; |
| 277 SetOncePointer<LEnvironment> deoptimization_environment_; | 278 SetOncePointer<LEnvironment> deoptimization_environment_; |
| 278 bool is_call_; | 279 bool is_call_; |
| 279 bool is_save_doubles_; | 280 bool is_save_doubles_; |
| 280 }; | 281 }; |
| 281 | 282 |
| 282 | 283 |
| 283 template<typename ElementType, int NumElements> | |
| 284 class OperandContainer { | |
| 285 public: | |
| 286 OperandContainer() { | |
| 287 for (int i = 0; i < NumElements; i++) elems_[i] = NULL; | |
| 288 } | |
| 289 int length() { return NumElements; } | |
| 290 ElementType& operator[](int i) { | |
| 291 ASSERT(i < length()); | |
| 292 return elems_[i]; | |
| 293 } | |
| 294 void PrintOperandsTo(StringStream* stream); | |
| 295 | |
| 296 private: | |
| 297 ElementType elems_[NumElements]; | |
| 298 }; | |
| 299 | |
| 300 | |
| 301 template<typename ElementType> | |
| 302 class OperandContainer<ElementType, 0> { | |
| 303 public: | |
| 304 int length() { return 0; } | |
| 305 void PrintOperandsTo(StringStream* stream) { } | |
| 306 ElementType& operator[](int i) { | |
| 307 UNREACHABLE(); | |
| 308 static ElementType t = 0; | |
| 309 return t; | |
| 310 } | |
| 311 }; | |
| 312 | |
| 313 | |
| 314 // R = number of result operands (0 or 1). | 284 // R = number of result operands (0 or 1). |
| 315 // I = number of input operands. | 285 // I = number of input operands. |
| 316 // T = number of temporary operands. | 286 // T = number of temporary operands. |
| 317 template<int R, int I, int T> | 287 template<int R, int I, int T> |
| 318 class LTemplateInstruction: public LInstruction { | 288 class LTemplateInstruction: public LInstruction { |
| 319 public: | 289 public: |
| 320 // Allow 0 or 1 output operands. | 290 // Allow 0 or 1 output operands. |
| 321 STATIC_ASSERT(R == 0 || R == 1); | 291 STATIC_ASSERT(R == 0 || R == 1); |
| 322 virtual bool HasResult() const { return R != 0; } | 292 virtual bool HasResult() const { return R != 0; } |
| 323 void set_result(LOperand* operand) { results_[0] = operand; } | 293 void set_result(LOperand* operand) { results_[0] = operand; } |
| 324 LOperand* result() { return results_[0]; } | 294 LOperand* result() { return results_[0]; } |
| 325 | 295 |
| 326 int InputCount() { return I; } | 296 int InputCount() { return I; } |
| 327 LOperand* InputAt(int i) { return inputs_[i]; } | 297 LOperand* InputAt(int i) { return inputs_[i]; } |
| 328 | 298 |
| 329 int TempCount() { return T; } | 299 int TempCount() { return T; } |
| 330 LOperand* TempAt(int i) { return temps_[i]; } | 300 LOperand* TempAt(int i) { return temps_[i]; } |
| 331 | 301 |
| 332 virtual void PrintDataTo(StringStream* stream); | 302 virtual void PrintDataTo(StringStream* stream); |
| 333 virtual void PrintOutputOperandTo(StringStream* stream); | 303 virtual void PrintOutputOperandTo(StringStream* stream); |
| 334 | 304 |
| 335 protected: | 305 protected: |
| 336 OperandContainer<LOperand*, R> results_; | 306 EmbeddedContainer<LOperand*, R> results_; |
| 337 OperandContainer<LOperand*, I> inputs_; | 307 EmbeddedContainer<LOperand*, I> inputs_; |
| 338 OperandContainer<LOperand*, T> temps_; | 308 EmbeddedContainer<LOperand*, T> temps_; |
| 339 }; | 309 }; |
| 340 | 310 |
| 341 | 311 |
| 342 class LGap: public LTemplateInstruction<0, 0, 0> { | 312 class LGap: public LTemplateInstruction<0, 0, 0> { |
| 343 public: | 313 public: |
| 344 explicit LGap(HBasicBlock* block) : block_(block) { | 314 explicit LGap(HBasicBlock* block) : block_(block) { |
| 345 parallel_moves_[BEFORE] = NULL; | 315 parallel_moves_[BEFORE] = NULL; |
| 346 parallel_moves_[START] = NULL; | 316 parallel_moves_[START] = NULL; |
| 347 parallel_moves_[END] = NULL; | 317 parallel_moves_[END] = NULL; |
| 348 parallel_moves_[AFTER] = NULL; | 318 parallel_moves_[AFTER] = NULL; |
| (...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2364 | 2334 |
| 2365 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2335 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2366 }; | 2336 }; |
| 2367 | 2337 |
| 2368 #undef DECLARE_HYDROGEN_ACCESSOR | 2338 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2369 #undef DECLARE_CONCRETE_INSTRUCTION | 2339 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2370 | 2340 |
| 2371 } } // namespace v8::internal | 2341 } } // namespace v8::internal |
| 2372 | 2342 |
| 2373 #endif // V8_IA32_LITHIUM_IA32_H_ | 2343 #endif // V8_IA32_LITHIUM_IA32_H_ |
| OLD | NEW |