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

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

Issue 1056063004: [turbofan] make live ranges stateless (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/register-allocator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/register-allocator.cc
diff --git a/src/compiler/register-allocator.cc b/src/compiler/register-allocator.cc
index 29d69973bedd2ba8742d2a74a9104994958b0436..7b4ff5d391d68194d10afd975ee956a24efa4302 100644
--- a/src/compiler/register-allocator.cc
+++ b/src/compiler/register-allocator.cc
@@ -251,9 +251,11 @@ void LiveRange::CommitSpillOperand(AllocatedOperand* operand) {
}
-UsePosition* LiveRange::NextUsePosition(LifetimePosition start) {
+UsePosition* LiveRange::NextUsePosition(LifetimePosition start) const {
UsePosition* use_pos = last_processed_use_;
- if (use_pos == nullptr) use_pos = first_pos();
+ if (use_pos == nullptr || use_pos->pos().Value() > start.Value()) {
+ use_pos = first_pos();
+ }
while (use_pos != nullptr && use_pos->pos().Value() < start.Value()) {
use_pos = use_pos->next();
}
@@ -263,7 +265,7 @@ UsePosition* LiveRange::NextUsePosition(LifetimePosition start) {
UsePosition* LiveRange::NextUsePositionRegisterIsBeneficial(
- LifetimePosition start) {
+ LifetimePosition start) const {
UsePosition* pos = NextUsePosition(start);
while (pos != nullptr && !pos->RegisterIsBeneficial()) {
pos = pos->next();
@@ -273,7 +275,7 @@ UsePosition* LiveRange::NextUsePositionRegisterIsBeneficial(
UsePosition* LiveRange::PreviousUsePositionRegisterIsBeneficial(
- LifetimePosition start) {
+ LifetimePosition start) const {
auto pos = first_pos();
UsePosition* prev = nullptr;
while (pos != nullptr && pos->pos().Value() < start.Value()) {
@@ -284,7 +286,7 @@ UsePosition* LiveRange::PreviousUsePositionRegisterIsBeneficial(
}
-UsePosition* LiveRange::NextRegisterPosition(LifetimePosition start) {
+UsePosition* LiveRange::NextRegisterPosition(LifetimePosition start) const {
UsePosition* pos = NextUsePosition(start);
while (pos != nullptr && pos->type() != UsePositionType::kRequiresRegister) {
pos = pos->next();
@@ -293,7 +295,7 @@ UsePosition* LiveRange::NextRegisterPosition(LifetimePosition start) {
}
-bool LiveRange::CanBeSpilled(LifetimePosition pos) {
+bool LiveRange::CanBeSpilled(LifetimePosition pos) const {
// We cannot spill a live range that has a use requiring a register
// at the current or the immediate next position.
auto use_pos = NextRegisterPosition(pos);
@@ -571,7 +573,7 @@ bool LiveRange::CanCover(LifetimePosition position) const {
}
-bool LiveRange::Covers(LifetimePosition position) {
+bool LiveRange::Covers(LifetimePosition position) const {
if (!CanCover(position)) return false;
auto start_search = FirstSearchIntervalForPosition(position);
for (auto interval = start_search; interval != nullptr;
@@ -586,7 +588,7 @@ bool LiveRange::Covers(LifetimePosition position) {
}
-LifetimePosition LiveRange::FirstIntersection(LiveRange* other) {
+LifetimePosition LiveRange::FirstIntersection(LiveRange* other) const {
auto b = other->first_interval();
if (b == nullptr) return LifetimePosition::Invalid();
auto advance_last_processed_up_to = b->start();
« no previous file with comments | « src/compiler/register-allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698