| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_REGISTER_ALLOCATOR_H_ | 5 #ifndef V8_REGISTER_ALLOCATOR_H_ |
| 6 #define V8_REGISTER_ALLOCATOR_H_ | 6 #define V8_REGISTER_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include "src/compiler/instruction.h" | 8 #include "src/compiler/instruction.h" |
| 9 #include "src/ostreams.h" | 9 #include "src/ostreams.h" |
| 10 #include "src/register-configuration.h" | 10 #include "src/register-configuration.h" |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 | 412 |
| 413 static const int kInvalidSize = -1; | 413 static const int kInvalidSize = -1; |
| 414 static const float kInvalidWeight; | 414 static const float kInvalidWeight; |
| 415 static const float kMaxWeight; | 415 static const float kMaxWeight; |
| 416 | 416 |
| 417 private: | 417 private: |
| 418 friend class TopLevelLiveRange; | 418 friend class TopLevelLiveRange; |
| 419 explicit LiveRange(int relative_id, MachineRepresentation rep, | 419 explicit LiveRange(int relative_id, MachineRepresentation rep, |
| 420 TopLevelLiveRange* top_level); | 420 TopLevelLiveRange* top_level); |
| 421 | 421 |
| 422 void AppendAsChild(TopLevelLiveRange* other); | |
| 423 void UpdateParentForAllChildren(TopLevelLiveRange* new_top_level); | 422 void UpdateParentForAllChildren(TopLevelLiveRange* new_top_level); |
| 424 | 423 |
| 425 void set_spilled(bool value) { bits_ = SpilledField::update(bits_, value); } | 424 void set_spilled(bool value) { bits_ = SpilledField::update(bits_, value); } |
| 426 | 425 |
| 427 UseInterval* FirstSearchIntervalForPosition(LifetimePosition position) const; | 426 UseInterval* FirstSearchIntervalForPosition(LifetimePosition position) const; |
| 428 void AdvanceLastProcessedMarker(UseInterval* to_start_of, | 427 void AdvanceLastProcessedMarker(UseInterval* to_start_of, |
| 429 LifetimePosition but_not_past) const; | 428 LifetimePosition but_not_past) const; |
| 430 | 429 |
| 431 typedef BitField<bool, 0, 1> SpilledField; | 430 typedef BitField<bool, 0, 1> SpilledField; |
| 432 typedef BitField<int32_t, 6, 6> AssignedRegisterField; | 431 typedef BitField<int32_t, 6, 6> AssignedRegisterField; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 | 598 |
| 600 bool IsSpilledOnlyInDeferredBlocks() const { | 599 bool IsSpilledOnlyInDeferredBlocks() const { |
| 601 return spilled_in_deferred_blocks_; | 600 return spilled_in_deferred_blocks_; |
| 602 } | 601 } |
| 603 | 602 |
| 604 struct SpillMoveInsertionList; | 603 struct SpillMoveInsertionList; |
| 605 | 604 |
| 606 SpillMoveInsertionList* spill_move_insertion_locations() const { | 605 SpillMoveInsertionList* spill_move_insertion_locations() const { |
| 607 return spill_move_insertion_locations_; | 606 return spill_move_insertion_locations_; |
| 608 } | 607 } |
| 609 void set_last_child(LiveRange* range) { last_child_ = range; } | |
| 610 LiveRange* last_child() const { return last_child_; } | |
| 611 TopLevelLiveRange* splinter() const { return splinter_; } | 608 TopLevelLiveRange* splinter() const { return splinter_; } |
| 612 void SetSplinter(TopLevelLiveRange* splinter) { | 609 void SetSplinter(TopLevelLiveRange* splinter) { |
| 613 DCHECK_NULL(splinter_); | 610 DCHECK_NULL(splinter_); |
| 614 DCHECK_NOT_NULL(splinter); | 611 DCHECK_NOT_NULL(splinter); |
| 615 | 612 |
| 616 splinter_ = splinter; | 613 splinter_ = splinter; |
| 617 splinter->relative_id_ = GetNextChildId(); | 614 splinter->relative_id_ = GetNextChildId(); |
| 618 splinter->set_spill_type(spill_type()); | 615 splinter->set_spill_type(spill_type()); |
| 619 splinter->SetSplinteredFrom(this); | 616 splinter->SetSplinteredFrom(this); |
| 620 } | 617 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 636 union { | 633 union { |
| 637 // Correct value determined by spill_type() | 634 // Correct value determined by spill_type() |
| 638 InstructionOperand* spill_operand_; | 635 InstructionOperand* spill_operand_; |
| 639 SpillRange* spill_range_; | 636 SpillRange* spill_range_; |
| 640 }; | 637 }; |
| 641 SpillMoveInsertionList* spill_move_insertion_locations_; | 638 SpillMoveInsertionList* spill_move_insertion_locations_; |
| 642 // TODO(mtrofin): generalize spilling after definition, currently specialized | 639 // TODO(mtrofin): generalize spilling after definition, currently specialized |
| 643 // just for spill in a single deferred block. | 640 // just for spill in a single deferred block. |
| 644 bool spilled_in_deferred_blocks_; | 641 bool spilled_in_deferred_blocks_; |
| 645 int spill_start_index_; | 642 int spill_start_index_; |
| 646 LiveRange* last_child_; | |
| 647 UsePosition* last_pos_; | 643 UsePosition* last_pos_; |
| 648 TopLevelLiveRange* splinter_; | 644 TopLevelLiveRange* splinter_; |
| 649 bool has_preassigned_slot_; | 645 bool has_preassigned_slot_; |
| 650 | 646 |
| 651 DISALLOW_COPY_AND_ASSIGN(TopLevelLiveRange); | 647 DISALLOW_COPY_AND_ASSIGN(TopLevelLiveRange); |
| 652 }; | 648 }; |
| 653 | 649 |
| 654 | 650 |
| 655 struct PrintableLiveRange { | 651 struct PrintableLiveRange { |
| 656 const RegisterConfiguration* register_configuration_; | 652 const RegisterConfiguration* register_configuration_; |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 RegisterAllocationData* const data_; | 1151 RegisterAllocationData* const data_; |
| 1156 | 1152 |
| 1157 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); | 1153 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); |
| 1158 }; | 1154 }; |
| 1159 | 1155 |
| 1160 } // namespace compiler | 1156 } // namespace compiler |
| 1161 } // namespace internal | 1157 } // namespace internal |
| 1162 } // namespace v8 | 1158 } // namespace v8 |
| 1163 | 1159 |
| 1164 #endif // V8_REGISTER_ALLOCATOR_H_ | 1160 #endif // V8_REGISTER_ALLOCATOR_H_ |
| OLD | NEW |