Commit 22953ff8 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm] Don't overwrite register in atomic.wait if it is still used

In atomic.wait we overwrote the register which stored the index,
without checking if it was still in use or not.

R=clemensb@chromium.org

Bug: v8:10898
Change-Id: Iab6e1a84c71887af81d307c4ca795109ce2fdfc2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2428928
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70134}
parent 6a401577
......@@ -3238,7 +3238,14 @@ class LiftoffCompiler {
uint32_t offset = imm.offset;
index_reg = AddMemoryMasking(index_reg, &offset, &pinned);
if (offset != 0) __ emit_i32_addi(index_reg, index_reg, offset);
Register index_plus_offset = index_reg;
if (offset) {
if (__ cache_state()->is_used(LiftoffRegister(index_reg))) {
index_plus_offset =
pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp();
}
__ emit_i32_addi(index_plus_offset, index_reg, offset);
}
LiftoffAssembler::VarState timeout =
__ cache_state()->stack_state.end()[-1];
......@@ -3248,7 +3255,7 @@ class LiftoffCompiler {
// We have to set the correct register for the index. It may have changed
// above in {AddMemoryMasking}.
index.MakeRegister(LiftoffRegister(index_reg));
index.MakeRegister(LiftoffRegister(index_plus_offset));
WasmCode::RuntimeStubId target;
compiler::CallDescriptor* call_descriptor;
......
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