| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 LDoubleRegister() : LOperand() { } | 475 LDoubleRegister() : LOperand() { } |
| 476 explicit LDoubleRegister(int index) : LOperand(DOUBLE_REGISTER, index) { } | 476 explicit LDoubleRegister(int index) : LOperand(DOUBLE_REGISTER, index) { } |
| 477 }; | 477 }; |
| 478 | 478 |
| 479 | 479 |
| 480 // A register-allocator view of a Lithium instruction. It contains the id of | 480 // A register-allocator view of a Lithium instruction. It contains the id of |
| 481 // the output operand and a list of input operand uses. | 481 // the output operand and a list of input operand uses. |
| 482 class InstructionSummary: public ZoneObject { | 482 class InstructionSummary: public ZoneObject { |
| 483 public: | 483 public: |
| 484 InstructionSummary() | 484 InstructionSummary() |
| 485 : output_operand_(NULL), input_count_(0), operands_(4), is_call_(false) {} | 485 : output_operand_(NULL), |
| 486 input_count_(0), |
| 487 operands_(4), |
| 488 is_call_(false), |
| 489 is_save_doubles_(false) {} |
| 486 | 490 |
| 487 // Output operands. | 491 // Output operands. |
| 488 LOperand* Output() const { return output_operand_; } | 492 LOperand* Output() const { return output_operand_; } |
| 489 void SetOutput(LOperand* output) { | 493 void SetOutput(LOperand* output) { |
| 490 ASSERT(output_operand_ == NULL); | 494 ASSERT(output_operand_ == NULL); |
| 491 output_operand_ = output; | 495 output_operand_ = output; |
| 492 } | 496 } |
| 493 | 497 |
| 494 // Input operands. | 498 // Input operands. |
| 495 int InputCount() const { return input_count_; } | 499 int InputCount() const { return input_count_; } |
| 496 LOperand* InputAt(int i) const { | 500 LOperand* InputAt(int i) const { |
| 497 ASSERT(i < input_count_); | 501 ASSERT(i < input_count_); |
| 498 return operands_[i]; | 502 return operands_[i]; |
| 499 } | 503 } |
| 500 void AddInput(LOperand* input) { | 504 void AddInput(LOperand* input) { |
| 501 operands_.InsertAt(input_count_, input); | 505 operands_.InsertAt(input_count_, input); |
| 502 input_count_++; | 506 input_count_++; |
| 503 } | 507 } |
| 504 | 508 |
| 505 // Temporary operands. | 509 // Temporary operands. |
| 506 int TempCount() const { return operands_.length() - input_count_; } | 510 int TempCount() const { return operands_.length() - input_count_; } |
| 507 LOperand* TempAt(int i) const { return operands_[i + input_count_]; } | 511 LOperand* TempAt(int i) const { return operands_[i + input_count_]; } |
| 508 void AddTemp(LOperand* temp) { operands_.Add(temp); } | 512 void AddTemp(LOperand* temp) { operands_.Add(temp); } |
| 509 | 513 |
| 510 void MarkAsCall() { is_call_ = true; } | 514 void MarkAsCall() { is_call_ = true; } |
| 511 bool IsCall() const { return is_call_; } | 515 bool IsCall() const { return is_call_; } |
| 512 | 516 |
| 517 void MarkAsSaveDoubles() { is_save_doubles_ = true; } |
| 518 bool IsSaveDoubles() const { return is_save_doubles_; } |
| 519 |
| 513 private: | 520 private: |
| 514 LOperand* output_operand_; | 521 LOperand* output_operand_; |
| 515 int input_count_; | 522 int input_count_; |
| 516 ZoneList<LOperand*> operands_; | 523 ZoneList<LOperand*> operands_; |
| 517 bool is_call_; | 524 bool is_call_; |
| 525 bool is_save_doubles_; |
| 518 }; | 526 }; |
| 519 | 527 |
| 520 // Representation of the non-empty interval [start,end[. | 528 // Representation of the non-empty interval [start,end[. |
| 521 class UseInterval: public ZoneObject { | 529 class UseInterval: public ZoneObject { |
| 522 public: | 530 public: |
| 523 UseInterval(LifetimePosition start, LifetimePosition end) | 531 UseInterval(LifetimePosition start, LifetimePosition end) |
| 524 : start_(start), end_(end), next_(NULL) { | 532 : start_(start), end_(end), next_(NULL) { |
| 525 ASSERT(start.Value() < end.Value()); | 533 ASSERT(start.Value() < end.Value()); |
| 526 } | 534 } |
| 527 | 535 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 // Record a use of an input operand in the current instruction. | 825 // Record a use of an input operand in the current instruction. |
| 818 void RecordUse(HValue* value, LUnallocated* operand); | 826 void RecordUse(HValue* value, LUnallocated* operand); |
| 819 // Record the definition of the output operand. | 827 // Record the definition of the output operand. |
| 820 void RecordDefinition(HInstruction* instr, LUnallocated* operand); | 828 void RecordDefinition(HInstruction* instr, LUnallocated* operand); |
| 821 // Record a temporary operand. | 829 // Record a temporary operand. |
| 822 void RecordTemporary(LUnallocated* operand); | 830 void RecordTemporary(LUnallocated* operand); |
| 823 | 831 |
| 824 // Marks the current instruction as a call. | 832 // Marks the current instruction as a call. |
| 825 void MarkAsCall(); | 833 void MarkAsCall(); |
| 826 | 834 |
| 835 // Marks the current instruction as requiring saving double registers. |
| 836 void MarkAsSaveDoubles(); |
| 837 |
| 827 // Checks whether the value of a given virtual register is tagged. | 838 // Checks whether the value of a given virtual register is tagged. |
| 828 bool HasTaggedValue(int virtual_register) const; | 839 bool HasTaggedValue(int virtual_register) const; |
| 829 | 840 |
| 830 // Returns the register kind required by the given virtual register. | 841 // Returns the register kind required by the given virtual register. |
| 831 RegisterKind RequiredRegisterKind(int virtual_register) const; | 842 RegisterKind RequiredRegisterKind(int virtual_register) const; |
| 832 | 843 |
| 833 // Begin a new instruction. | 844 // Begin a new instruction. |
| 834 void BeginInstruction(); | 845 void BeginInstruction(); |
| 835 | 846 |
| 836 // Summarize the current instruction. | 847 // Summarize the current instruction. |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 | 1028 |
| 1018 bool has_osr_entry_; | 1029 bool has_osr_entry_; |
| 1019 | 1030 |
| 1020 DISALLOW_COPY_AND_ASSIGN(LAllocator); | 1031 DISALLOW_COPY_AND_ASSIGN(LAllocator); |
| 1021 }; | 1032 }; |
| 1022 | 1033 |
| 1023 | 1034 |
| 1024 } } // namespace v8::internal | 1035 } } // namespace v8::internal |
| 1025 | 1036 |
| 1026 #endif // V8_LITHIUM_ALLOCATOR_H_ | 1037 #endif // V8_LITHIUM_ALLOCATOR_H_ |
| OLD | NEW |