| 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/zone-containers.h" | 10 #include "src/zone-containers.h" |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 LifetimePosition end); | 763 LifetimePosition end); |
| 764 | 764 |
| 765 void Spill(LiveRange* range); | 765 void Spill(LiveRange* range); |
| 766 | 766 |
| 767 // If we are trying to spill a range inside the loop try to | 767 // If we are trying to spill a range inside the loop try to |
| 768 // hoist spill position out to the point just before the loop. | 768 // hoist spill position out to the point just before the loop. |
| 769 LifetimePosition FindOptimalSpillingPos(LiveRange* range, | 769 LifetimePosition FindOptimalSpillingPos(LiveRange* range, |
| 770 LifetimePosition pos); | 770 LifetimePosition pos); |
| 771 | 771 |
| 772 const ZoneVector<LiveRange*>& GetFixedRegisters() const; | 772 const ZoneVector<LiveRange*>& GetFixedRegisters() const; |
| 773 const char* RegisterName(int allocation_index) const; |
| 773 | 774 |
| 774 private: | 775 private: |
| 775 RegisterAllocationData* const data_; | 776 RegisterAllocationData* const data_; |
| 776 const RegisterKind mode_; | 777 const RegisterKind mode_; |
| 777 const int num_registers_; | 778 const int num_registers_; |
| 778 | 779 |
| 779 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator); | 780 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator); |
| 780 }; | 781 }; |
| 781 | 782 |
| 782 | 783 |
| 783 class LinearScanAllocator final : public RegisterAllocator { | 784 class LinearScanAllocator final : public RegisterAllocator { |
| 784 public: | 785 public: |
| 785 LinearScanAllocator(RegisterAllocationData* data, RegisterKind kind, | 786 LinearScanAllocator(RegisterAllocationData* data, RegisterKind kind, |
| 786 Zone* local_zone); | 787 Zone* local_zone); |
| 787 | 788 |
| 788 // Phase 4: compute register assignments. | 789 // Phase 4: compute register assignments. |
| 789 void AllocateRegisters(); | 790 void AllocateRegisters(); |
| 790 | 791 |
| 791 private: | 792 private: |
| 792 const char* RegisterName(int allocation_index) const; | |
| 793 | |
| 794 ZoneVector<LiveRange*>& unhandled_live_ranges() { | 793 ZoneVector<LiveRange*>& unhandled_live_ranges() { |
| 795 return unhandled_live_ranges_; | 794 return unhandled_live_ranges_; |
| 796 } | 795 } |
| 797 ZoneVector<LiveRange*>& active_live_ranges() { return active_live_ranges_; } | 796 ZoneVector<LiveRange*>& active_live_ranges() { return active_live_ranges_; } |
| 798 ZoneVector<LiveRange*>& inactive_live_ranges() { | 797 ZoneVector<LiveRange*>& inactive_live_ranges() { |
| 799 return inactive_live_ranges_; | 798 return inactive_live_ranges_; |
| 800 } | 799 } |
| 801 | 800 |
| 802 void SetLiveRangeAssignedRegister(LiveRange* range, int reg); | 801 void SetLiveRangeAssignedRegister(LiveRange* range, int reg); |
| 803 | 802 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 RegisterAllocationData* const data_; | 919 RegisterAllocationData* const data_; |
| 921 | 920 |
| 922 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); | 921 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); |
| 923 }; | 922 }; |
| 924 | 923 |
| 925 } // namespace compiler | 924 } // namespace compiler |
| 926 } // namespace internal | 925 } // namespace internal |
| 927 } // namespace v8 | 926 } // namespace v8 |
| 928 | 927 |
| 929 #endif // V8_REGISTER_ALLOCATOR_H_ | 928 #endif // V8_REGISTER_ALLOCATOR_H_ |
| OLD | NEW |