Commit 4c1236c1 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[maglev] Fix alias issue in GeneratorRestoreRegister

Temporary fix, ideally we should tell the register allocator to not
alias the input with the output.

Bug: v8:7700, v8:13109
Change-Id: I822e8e957689213499ea34620fcdeb5f532f2f5e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3876382
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83001}
parent 9734c2b7
......@@ -965,19 +965,31 @@ void GeneratorRestoreRegister::AllocateVreg(
MaglevVregAllocationState* vreg_state) {
UseRegister(array_input());
DefineAsRegister(vreg_state, this);
set_temporaries_needed(1);
}
void GeneratorRestoreRegister::GenerateCode(MaglevCodeGenState* code_gen_state,
const ProcessingState& state) {
Register array = ToRegister(array_input());
Register result_reg = ToRegister(result());
Register temp = temporaries().PopFirst();
// The input and the output can alias, if that happen we use a temporary
// register and a move at the end.
Register value = (array == result_reg ? temp : result_reg);
// Loads the current value in the generator register file.
__ DecompressAnyTagged(
ToRegister(result()),
FieldOperand(array, FixedArray::OffsetOfElementAt(index())));
value, FieldOperand(array, FixedArray::OffsetOfElementAt(index())));
// And trashs it with StaleRegisterConstant.
__ LoadRoot(kScratchRegister, RootIndex::kStaleRegister);
__ StoreTaggedField(
FieldOperand(array, FixedArray::OffsetOfElementAt(index())),
kScratchRegister);
if (value != result_reg) {
__ Move(result_reg, value);
}
}
void ForInPrepare::AllocateVreg(MaglevVregAllocationState* vreg_state) {
......
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