[maglev] Fix fast compare if accumulator live range ends on branch test

Allow fast branches in the case the accumulator's live range doesn't
extend beyond the branch test. Previously we were more restrictive and
only allowed fast branches the test itself didn't use the accumulator
register.

Bug: v8:7700
Change-Id: Iec98028b3ddb04eeb51e98436a0bdc48f22920ef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3663744
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80819}
This commit is contained in:
Camillo Bruni 2022-05-25 16:31:41 +02:00 committed by V8 LUCI CQ
parent 66a9c1c5a2
commit 91062a4f3e

View File

@ -431,12 +431,10 @@ bool MaglevGraphBuilder::TryBuildCompareOperationBranch(Operation operation,
case interpreter::Bytecode::kJumpIfToBooleanFalseConstant:
// This jump must kill the accumulator, otherwise we need to
// materialize the actual boolean value.
if (GetOutLiveness()->AccumulatorIsLive()) return false;
if (GetOutLivenessFor(next_offset())->AccumulatorIsLive()) return false;
// Advance the iterator past the test to the jump, skipping
// emitting the test.
iterator_.Advance();
true_offset = next_offset();
false_offset = iterator_.GetJumpTargetOffset();
break;
@ -446,16 +444,13 @@ bool MaglevGraphBuilder::TryBuildCompareOperationBranch(Operation operation,
case interpreter::Bytecode::kJumpIfToBooleanTrueConstant:
// This jump must kill the accumulator, otherwise we need to
// materialize the actual boolean value.
if (GetOutLiveness()->AccumulatorIsLive()) return false;
if (GetOutLivenessFor(next_offset())->AccumulatorIsLive()) return false;
// Advance the iterator past the test to the jump, skipping
// emitting the test.
iterator_.Advance();
true_offset = iterator_.GetJumpTargetOffset();
false_offset = next_offset();
break;
default:
return false;
}