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

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

Issue 1205173002: [turbofan] Greedy allocator refactoring. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: minor fix on splitting at interval boundaries Created 5 years, 6 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/greedy-allocator.cc ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/register-allocator.h
diff --git a/src/compiler/register-allocator.h b/src/compiler/register-allocator.h
index 5a09c012d8234f42fb24db895130328b9be35b81..83f95cbac601608fe178fbcb7880bf77ad87191c 100644
--- a/src/compiler/register-allocator.h
+++ b/src/compiler/register-allocator.h
@@ -428,6 +428,15 @@ class LiveRange final : public ZoneObject {
return spills_at_definition_;
}
+ // Used solely by the Greedy Allocator:
+ unsigned GetSize();
+ float weight() const { return weight_; }
+ void set_weight(float weight) { weight_ = weight; }
+
+ static const int kInvalidSize = -1;
+ static const float kInvalidWeight;
+ static const float kMaxWeight;
+
private:
void set_spill_type(SpillType value) {
bits_ = SpillTypeField::update(bits_, value);
@@ -468,6 +477,14 @@ class LiveRange final : public ZoneObject {
// This is used as a cache, it's invalid outside of BuildLiveRanges.
mutable UsePosition* current_hint_position_;
+ // greedy: the number of LifetimePositions covered by this range. Used to
+ // prioritize selecting live ranges for register assignment, as well as
+ // in weight calculations.
+ int size_;
+
+ // greedy: a metric for resolving conflicts between ranges with an assigned
+ // register and ranges that intersect them and need a register.
+ float weight_;
DISALLOW_COPY_AND_ASSIGN(LiveRange);
};
@@ -770,6 +787,7 @@ class RegisterAllocator : public ZoneObject {
LifetimePosition pos);
const ZoneVector<LiveRange*>& GetFixedRegisters() const;
+ const char* RegisterName(int allocation_index) const;
private:
RegisterAllocationData* const data_;
@@ -789,8 +807,6 @@ class LinearScanAllocator final : public RegisterAllocator {
void AllocateRegisters();
private:
- const char* RegisterName(int allocation_index) const;
-
ZoneVector<LiveRange*>& unhandled_live_ranges() {
return unhandled_live_ranges_;
}
« no previous file with comments | « src/compiler/greedy-allocator.cc ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698