Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(696)

Unified Diff: src/compiler/greedy-allocator.h

Issue 1219063017: [turbofan] Unit tests for live range conflicts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/coalesced-live-ranges.cc ('k') | src/compiler/greedy-allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/greedy-allocator.h
diff --git a/src/compiler/greedy-allocator.h b/src/compiler/greedy-allocator.h
index 3ec180b2ba5d0dc82aa732e1ac23e0140358d661..c4e330eb97cc0425d4ec7de4fdb7e0fe5d938fb9 100644
--- a/src/compiler/greedy-allocator.h
+++ b/src/compiler/greedy-allocator.h
@@ -62,10 +62,28 @@ class GreedyAllocator final : public RegisterAllocator {
void AllocateRegisters();
private:
+ static const float kAllocatedRangeMultiplier;
+
+ static void UpdateWeightAtAllocation(LiveRange* range) {
+ DCHECK_NE(range->weight(), LiveRange::kInvalidWeight);
+ range->set_weight(range->weight() * kAllocatedRangeMultiplier);
+ }
+
+
+ static void UpdateWeightAtEviction(LiveRange* range) {
+ DCHECK_NE(range->weight(), LiveRange::kInvalidWeight);
+ range->set_weight(range->weight() / kAllocatedRangeMultiplier);
+ }
+
AllocationScheduler& scheduler() { return scheduler_; }
CoalescedLiveRanges* current_allocations(unsigned i) {
return allocations_[i];
}
+
+ CoalescedLiveRanges* current_allocations(unsigned i) const {
+ return allocations_[i];
+ }
+
Zone* local_zone() const { return local_zone_; }
// Insert fixed ranges.
@@ -75,6 +93,13 @@ class GreedyAllocator final : public RegisterAllocator {
// TODO(mtrofin): groups.
void ScheduleAllocationCandidates();
+ void AllocateRegisterToRange(unsigned reg_id, LiveRange* range) {
+ UpdateWeightAtAllocation(range);
+ current_allocations(reg_id)->AllocateRange(range);
+ }
+ // Evict and reschedule conflicts of a given range, at a given register.
+ void EvictAndRescheduleConflicts(unsigned reg_id, const LiveRange* range);
+
// Find the optimal split for ranges defined by a memory operand, e.g.
// constants or function parameters passed on the stack.
void SplitAndSpillRangesDefinedByMemoryOperand();
@@ -92,6 +117,11 @@ class GreedyAllocator final : public RegisterAllocator {
// Calculate the new weight of a range that is about to be allocated.
float GetAllocatedRangeWeight(float candidate_weight);
+ // Returns kInvalidWeight if there are no conflicts, or the largest weight of
+ // a range conflicting with the given range, at the given register.
+ float GetMaximumConflictingWeight(unsigned reg_id,
+ const LiveRange* range) const;
+
// This is the extension point for splitting heuristics.
void SplitOrSpillBlockedRange(LiveRange* range);
« no previous file with comments | « src/compiler/coalesced-live-ranges.cc ('k') | src/compiler/greedy-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698