Commit 6009697e authored by mtrofin's avatar mtrofin Committed by Commit bot

Revert "Revert of [turbofan] greedy: heuristic for memory operands

(patchset #2 id:40001 of https://codereview.chromium.org/1306823005/ )"

This reverts commit f68cd33b.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#30509}
parent fa530822
...@@ -256,7 +256,7 @@ void GreedyAllocator::SplitAndSpillRangesDefinedByMemoryOperand() { ...@@ -256,7 +256,7 @@ void GreedyAllocator::SplitAndSpillRangesDefinedByMemoryOperand() {
for (size_t i = 0; i < initial_range_count; ++i) { for (size_t i = 0; i < initial_range_count; ++i) {
auto range = data()->live_ranges()[i]; auto range = data()->live_ranges()[i];
if (!CanProcessRange(range)) continue; if (!CanProcessRange(range)) continue;
if (range->HasNoSpillType()) continue; if (!range->HasSpillOperand()) continue;
LifetimePosition start = range->Start(); LifetimePosition start = range->Start();
TRACE("Live range %d:%d is defined by a spill operand.\n", TRACE("Live range %d:%d is defined by a spill operand.\n",
...@@ -273,12 +273,14 @@ void GreedyAllocator::SplitAndSpillRangesDefinedByMemoryOperand() { ...@@ -273,12 +273,14 @@ void GreedyAllocator::SplitAndSpillRangesDefinedByMemoryOperand() {
} else if (pos->pos() > range->Start().NextStart()) { } else if (pos->pos() > range->Start().NextStart()) {
// Do not spill live range eagerly if use position that can benefit from // Do not spill live range eagerly if use position that can benefit from
// the register is too close to the start of live range. // the register is too close to the start of live range.
auto split_pos = pos->pos(); auto split_pos = GetSplitPositionForInstruction(
if (data()->IsBlockBoundary(split_pos.Start())) { range, data()->code(), pos->pos().ToInstructionIndex());
split_pos = split_pos.Start(); // There is no place to split, so we can't split and spill.
} else { if (!split_pos.IsValid()) continue;
split_pos = split_pos.PrevStart().End();
} split_pos =
FindOptimalSplitPos(range->Start().NextFullStart(), split_pos);
Split(range, data(), split_pos); Split(range, data(), split_pos);
Spill(range); Spill(range);
} }
......
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