Commit 9e8b7564 authored by mtrofin's avatar mtrofin Committed by Commit bot

Some of the regression in the bug below was already addressed as

part of a compile time improvement push. We got from 3 minutes down
to ~30 seconds prior to the change here.

This change further reduces the compile time down to 2 seconds, which
is actually slightly better than the pre-splintering total execution time
of about 3 seconds.

The cause of the regression was the repeated traversal of the children
of a live range, seeking for the one covering a safe point. The fix is to
leverage the intrinsic ordering in the chain of live range children, as well
as that of the safe points.

BUG= chromium:567745
LOG=N

Review URL: https://codereview.chromium.org/1529293002

Cr-Commit-Position: refs/heads/master@{#32958}
parent 2a09d7f9
...@@ -3097,6 +3097,7 @@ void ReferenceMapPopulator::PopulateReferenceMaps() { ...@@ -3097,6 +3097,7 @@ void ReferenceMapPopulator::PopulateReferenceMaps() {
AllocatedOperand::cast(spill_operand).representation()); AllocatedOperand::cast(spill_operand).representation());
} }
LiveRange* cur = range;
// Step through the safe points to see whether they are in the range. // Step through the safe points to see whether they are in the range.
for (auto it = first_it; it != reference_maps->end(); ++it) { for (auto it = first_it; it != reference_maps->end(); ++it) {
auto map = *it; auto map = *it;
...@@ -3109,11 +3110,31 @@ void ReferenceMapPopulator::PopulateReferenceMaps() { ...@@ -3109,11 +3110,31 @@ void ReferenceMapPopulator::PopulateReferenceMaps() {
// safe point position. // safe point position.
auto safe_point_pos = auto safe_point_pos =
LifetimePosition::InstructionFromInstructionIndex(safe_point); LifetimePosition::InstructionFromInstructionIndex(safe_point);
LiveRange* cur = range;
while (cur != nullptr && !cur->Covers(safe_point_pos)) { // Search for the child range (cur) that covers safe_point_pos. If we
cur = cur->next(); // 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 // Check if the live range is spilled and the safe point is after
// the spill position. // the spill position.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment