| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_GREEDY_ALLOCATOR_H_ | 5 #ifndef V8_GREEDY_ALLOCATOR_H_ |
| 6 #define V8_GREEDY_ALLOCATOR_H_ | 6 #define V8_GREEDY_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include "src/compiler/coalesced-live-ranges.h" | 8 #include "src/compiler/coalesced-live-ranges.h" |
| 9 #include "src/compiler/register-allocator.h" | 9 #include "src/compiler/register-allocator.h" |
| 10 #include "src/zone-containers.h" | 10 #include "src/zone-containers.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // Schedule unassigned live ranges for allocation. | 121 // Schedule unassigned live ranges for allocation. |
| 122 void ScheduleAllocationCandidates(); | 122 void ScheduleAllocationCandidates(); |
| 123 | 123 |
| 124 void AllocateRegisterToRange(unsigned reg_id, LiveRange* range) { | 124 void AllocateRegisterToRange(unsigned reg_id, LiveRange* range) { |
| 125 UpdateWeightAtAllocation(range); | 125 UpdateWeightAtAllocation(range); |
| 126 current_allocations(reg_id)->AllocateRange(range); | 126 current_allocations(reg_id)->AllocateRange(range); |
| 127 } | 127 } |
| 128 // Evict and reschedule conflicts of a given range, at a given register. | 128 // Evict and reschedule conflicts of a given range, at a given register. |
| 129 void EvictAndRescheduleConflicts(unsigned reg_id, const LiveRange* range); | 129 void EvictAndRescheduleConflicts(unsigned reg_id, const LiveRange* range); |
| 130 | 130 |
| 131 // Find the optimal split for ranges defined by a memory operand, e.g. | |
| 132 // constants or function parameters passed on the stack. | |
| 133 void SplitAndSpillRangesDefinedByMemoryOperand(); | |
| 134 | |
| 135 void TryAllocateCandidate(const AllocationCandidate& candidate); | 131 void TryAllocateCandidate(const AllocationCandidate& candidate); |
| 136 void TryAllocateLiveRange(LiveRange* range); | 132 void TryAllocateLiveRange(LiveRange* range); |
| 137 void TryAllocateGroup(LiveRangeGroup* group); | 133 void TryAllocateGroup(LiveRangeGroup* group); |
| 138 | 134 |
| 139 bool CanProcessRange(LiveRange* range) const { | |
| 140 return range != nullptr && !range->IsEmpty() && range->kind() == mode(); | |
| 141 } | |
| 142 | |
| 143 // Calculate the weight of a candidate for allocation. | 135 // Calculate the weight of a candidate for allocation. |
| 144 void EnsureValidRangeWeight(LiveRange* range); | 136 void EnsureValidRangeWeight(LiveRange* range); |
| 145 | 137 |
| 146 // Calculate the new weight of a range that is about to be allocated. | 138 // Calculate the new weight of a range that is about to be allocated. |
| 147 float GetAllocatedRangeWeight(float candidate_weight); | 139 float GetAllocatedRangeWeight(float candidate_weight); |
| 148 | 140 |
| 149 // Returns kInvalidWeight if there are no conflicts, or the largest weight of | 141 // Returns kInvalidWeight if there are no conflicts, or the largest weight of |
| 150 // a range conflicting with the given range, at the given register. | 142 // a range conflicting with the given range, at the given register. |
| 151 float GetMaximumConflictingWeight(unsigned reg_id, const LiveRange* range, | 143 float GetMaximumConflictingWeight(unsigned reg_id, const LiveRange* range, |
| 152 float competing_weight) const; | 144 float competing_weight) const; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 ZoneVector<CoalescedLiveRanges*> allocations_; | 190 ZoneVector<CoalescedLiveRanges*> allocations_; |
| 199 AllocationScheduler scheduler_; | 191 AllocationScheduler scheduler_; |
| 200 ZoneVector<LiveRangeGroup*> groups_; | 192 ZoneVector<LiveRangeGroup*> groups_; |
| 201 | 193 |
| 202 DISALLOW_COPY_AND_ASSIGN(GreedyAllocator); | 194 DISALLOW_COPY_AND_ASSIGN(GreedyAllocator); |
| 203 }; | 195 }; |
| 204 } // namespace compiler | 196 } // namespace compiler |
| 205 } // namespace internal | 197 } // namespace internal |
| 206 } // namespace v8 | 198 } // namespace v8 |
| 207 #endif // V8_GREEDY_ALLOCATOR_H_ | 199 #endif // V8_GREEDY_ALLOCATOR_H_ |
| OLD | NEW |