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

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

Issue 1406223010: Revert "Revert of [turbofan] Remove redundant code.[...]" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 23610fdbe01f7be0ac64a2fdba9d7a99558766ae..0dc76000f784771856dd10e29daedddb3b2ad27e 100644
--- a/src/compiler/register-allocator.cc
+++ b/src/compiler/register-allocator.cc
@@ -2228,12 +2228,15 @@ LifetimePosition RegisterAllocator::GetSplitPositionForInstruction(
}
-void RegisterAllocator::SplitAndSpillRangesDefinedByMemoryOperand() {
+void RegisterAllocator::SplitAndSpillRangesDefinedByMemoryOperand(
+ bool operands_only) {
size_t initial_range_count = data()->live_ranges().size();
for (size_t i = 0; i < initial_range_count; ++i) {
TopLevelLiveRange* range = data()->live_ranges()[i];
if (!CanProcessRange(range)) continue;
- if (!range->HasSpillOperand()) continue;
+ if (range->HasNoSpillType() || (operands_only && range->HasSpillRange())) {
+ continue;
+ }
LifetimePosition start = range->Start();
TRACE("Live range %d:%d is defined by a spill operand.\n",
@@ -2416,7 +2419,7 @@ void LinearScanAllocator::AllocateRegisters() {
DCHECK(active_live_ranges().empty());
DCHECK(inactive_live_ranges().empty());
- SplitAndSpillRangesDefinedByMemoryOperand();
+ SplitAndSpillRangesDefinedByMemoryOperand(false);
for (TopLevelLiveRange* range : data()->live_ranges()) {
if (!CanProcessRange(range)) continue;
@@ -2450,28 +2453,6 @@ void LinearScanAllocator::AllocateRegisters() {
TRACE("Processing interval %d:%d start=%d\n", current->TopLevel()->vreg(),
current->relative_id(), position.value());
- if (current->IsTopLevel() && !current->TopLevel()->HasNoSpillType()) {
- TRACE("Live range %d:%d already has a spill operand\n",
- current->TopLevel()->vreg(), current->relative_id());
- auto next_pos = position;
- if (next_pos.IsGapPosition()) {
- next_pos = next_pos.NextStart();
- }
- auto pos = current->NextUsePositionRegisterIsBeneficial(next_pos);
- // If the range already has a spill operand and it doesn't need a
- // register immediately, split it and spill the first part of the range.
- if (pos == nullptr) {
- Spill(current);
- continue;
- } else if (pos->pos() > current->Start().NextStart()) {
- // Do not spill live range eagerly if use position that can benefit from
- // the register is too close to the start of live range.
- SpillBetween(current, current->Start(), pos->pos());
- DCHECK(UnhandledIsSorted());
- continue;
- }
- }
-
if (current->IsTopLevel() && TryReuseSpillForPhi(current->TopLevel()))
continue;
« 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