diff --git a/src/compiler/backend/instruction.h b/src/compiler/backend/instruction.h index 0419928792..e3aceeb43f 100644 --- a/src/compiler/backend/instruction.h +++ b/src/compiler/backend/instruction.h @@ -1430,6 +1430,7 @@ class V8_EXPORT_PRIVATE InstructionBlock final return loop_end_; } inline bool IsLoopHeader() const { return loop_end_.IsValid(); } + bool IsInLoop() const { return IsLoopHeader() || loop_header().IsValid(); } inline bool IsSwitchTarget() const { return switch_target_; } inline bool ShouldAlign() const { return alignment_; } diff --git a/src/compiler/backend/spill-placer.cc b/src/compiler/backend/spill-placer.cc index 55c2b4f7d1..7200b3e1d6 100644 --- a/src/compiler/backend/spill-placer.cc +++ b/src/compiler/backend/spill-placer.cc @@ -40,12 +40,12 @@ void SpillPlacer::Add(TopLevelLiveRange* range) { // the earliest deferred block as the insertion point would cause // incorrect behavior, so the value must be spilled at the definition. // - We haven't seen any indication of performance improvements from seeking - // optimal spilling positions except on loop-top phi values, so spill - // any value that isn't a loop-top phi at the definition to avoid - // increasing the code size for no benefit. + // optimal spilling positions for values defined outside loops, so spill + // those values at the definition to avoid increasing the code size for no + // benefit. if (range->GetSpillMoveInsertionLocations(data()) == nullptr || range->spilled() || top_start_block->IsDeferred() || - (!FLAG_stress_turbo_late_spilling && !range->is_loop_phi())) { + (!FLAG_stress_turbo_late_spilling && !top_start_block->IsInLoop())) { range->CommitSpillMoves(data(), spill_operand); return; } diff --git a/src/flags/flag-definitions.h b/src/flags/flag-definitions.h index 4c32b1d1ae..b4a9372000 100644 --- a/src/flags/flag-definitions.h +++ b/src/flags/flag-definitions.h @@ -562,7 +562,7 @@ DEFINE_BOOL(turbo_control_flow_aware_allocation, true, "consider control flow while allocating registers") DEFINE_BOOL( stress_turbo_late_spilling, false, - "optimize placement of all spill instructions, not just loop-top phis") + "optimize placement of all spill instructions, not just loop values") DEFINE_STRING(turbo_filter, "*", "optimization filter for TurboFan compiler") DEFINE_BOOL(trace_turbo, false, "trace generated TurboFan IR")