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

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

Issue 1529293002: [turbofan] remove non-linearity in PopulateReferenceMaps (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: feedback Created 5 years 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 | « no previous file | 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 8db8f03e1a3444bfb149b8416fff9ecd58363ad1..e4a2dd7620d55ad1b9ebfc2a086077817e9ff159 100644
--- a/src/compiler/register-allocator.cc
+++ b/src/compiler/register-allocator.cc
@@ -3097,6 +3097,7 @@ void ReferenceMapPopulator::PopulateReferenceMaps() {
AllocatedOperand::cast(spill_operand).representation());
}
+ LiveRange* cur = range;
// Step through the safe points to see whether they are in the range.
for (auto it = first_it; it != reference_maps->end(); ++it) {
auto map = *it;
@@ -3109,11 +3110,31 @@ void ReferenceMapPopulator::PopulateReferenceMaps() {
// safe point position.
auto safe_point_pos =
LifetimePosition::InstructionFromInstructionIndex(safe_point);
- LiveRange* cur = range;
- while (cur != nullptr && !cur->Covers(safe_point_pos)) {
- cur = cur->next();
+
+ // Search for the child range (cur) that covers safe_point_pos. If we
+ // don't find it before the children pass safe_point_pos, keep cur at
+ // the last child, because the next safe_point_pos may be covered by cur.
+ // This may happen if cur has more than one interval, and the current
+ // safe_point_pos is in between intervals.
+ // For that reason, cur may be at most the last child.
+ DCHECK_NOT_NULL(cur);
+ DCHECK(safe_point_pos >= cur->Start() || range == cur);
+ bool found = false;
+ while (!found) {
+ if (cur->Covers(safe_point_pos)) {
+ found = true;
+ } else {
+ LiveRange* next = cur->next();
+ if (next == nullptr || next->Start() > safe_point_pos) {
+ break;
+ }
+ cur = next;
+ }
+ }
+
+ if (!found) {
+ continue;
}
- if (cur == nullptr) continue;
// Check if the live range is spilled and the safe point is after
// the spill position.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698