[wasm][liftoff][arm] Record correct offset in StoreTaggedPointer
The write barrier for storing a reference to an object requires the destination offset as a parameter. The existing code only passed the immediate offset, however, not the offset provided through a register. With this CL, the correct offset is provided. R=thibaudm@chromium.org Bug: v8:7581 Change-Id: Ia2a1d90d822988a3ef0c27ce8227f28f0226c937 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2639766 Reviewed-by: Thibaud Michaud <thibaudm@chromium.org> Commit-Queue: Andreas Haas <ahaas@chromium.org> Cr-Commit-Position: refs/heads/master@{#72194}
This commit is contained in:
parent
14ad529b46
commit
a1616e6f7f
@ -703,13 +703,17 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst_addr,
|
||||
LiftoffRegister src,
|
||||
LiftoffRegList pinned) {
|
||||
STATIC_ASSERT(kTaggedSize == kInt32Size);
|
||||
{
|
||||
// Store the value.
|
||||
UseScratchRegisterScope temps(this);
|
||||
MemOperand dst_op =
|
||||
liftoff::GetMemOp(this, &temps, dst_addr, offset_reg, offset_imm);
|
||||
str(src.gp(), dst_op);
|
||||
Register actual_offset_reg = offset_reg;
|
||||
if (offset_reg != no_reg && offset_imm != 0) {
|
||||
if (cache_state()->is_used(LiftoffRegister(offset_reg))) {
|
||||
actual_offset_reg = GetUnusedRegister(kGpReg, pinned).gp();
|
||||
}
|
||||
add(actual_offset_reg, offset_reg, Operand(offset_imm));
|
||||
}
|
||||
MemOperand dst_op = actual_offset_reg == no_reg
|
||||
? MemOperand(dst_addr, offset_imm)
|
||||
: MemOperand(dst_addr, actual_offset_reg);
|
||||
str(src.gp(), dst_op);
|
||||
// The write barrier.
|
||||
Label write_barrier;
|
||||
Label exit;
|
||||
@ -720,8 +724,11 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst_addr,
|
||||
JumpIfSmi(src.gp(), &exit);
|
||||
CheckPageFlag(src.gp(), MemoryChunk::kPointersToHereAreInterestingMask, eq,
|
||||
&exit);
|
||||
CallRecordWriteStub(dst_addr, Operand(offset_imm), EMIT_REMEMBERED_SET,
|
||||
kSaveFPRegs, wasm::WasmCode::kRecordWrite);
|
||||
CallRecordWriteStub(dst_addr,
|
||||
actual_offset_reg == no_reg ? Operand(offset_imm)
|
||||
: Operand(actual_offset_reg),
|
||||
EMIT_REMEMBERED_SET, kSaveFPRegs,
|
||||
wasm::WasmCode::kRecordWrite);
|
||||
bind(&exit);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user