From 8dbd200c6ba0b9b12d76bac8e9f40cfce888d3cd Mon Sep 17 00:00:00 2001 From: LiuYu Date: Wed, 27 Jan 2021 18:31:07 +0800 Subject: [PATCH] [mips][wasm][liftoff] Record correct offset in StoreTaggedPointer Besides, change kSpeculationPoisonRegister from t3 to a7. Port: a1616e6f7f3ad60fe426206afefab729ed095b49 Bug: v8:7581 Change-Id: Id25850ddebce7250997e3b042ef094afd5d37d36 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2651699 Reviewed-by: Zhao Jiazhong Commit-Queue: Zhao Jiazhong Auto-Submit: Liu yu Cr-Commit-Position: refs/heads/master@{#72388} --- src/codegen/mips64/register-mips64.h | 2 +- src/wasm/baseline/mips/liftoff-assembler-mips.h | 14 ++++++++------ .../baseline/mips64/liftoff-assembler-mips64.h | 7 +++++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/codegen/mips64/register-mips64.h b/src/codegen/mips64/register-mips64.h index 16dba2a48b..d7b45eda38 100644 --- a/src/codegen/mips64/register-mips64.h +++ b/src/codegen/mips64/register-mips64.h @@ -368,7 +368,7 @@ constexpr Register kReturnRegister2 = a0; constexpr Register kJSFunctionRegister = a1; constexpr Register kContextRegister = s7; constexpr Register kAllocateSizeRegister = a0; -constexpr Register kSpeculationPoisonRegister = t3; +constexpr Register kSpeculationPoisonRegister = a7; constexpr Register kInterpreterAccumulatorRegister = v0; constexpr Register kInterpreterBytecodeOffsetRegister = t0; constexpr Register kInterpreterBytecodeArrayRegister = t1; diff --git a/src/wasm/baseline/mips/liftoff-assembler-mips.h b/src/wasm/baseline/mips/liftoff-assembler-mips.h index 4e3b7bd5d6..ba93b6ebb9 100644 --- a/src/wasm/baseline/mips/liftoff-assembler-mips.h +++ b/src/wasm/baseline/mips/liftoff-assembler-mips.h @@ -140,6 +140,9 @@ inline void Store(LiftoffAssembler* assm, Register base, int32_t offset, inline void push(LiftoffAssembler* assm, LiftoffRegister reg, ValueType type) { switch (type.kind()) { case ValueType::kI32: + case ValueType::kOptRef: + case ValueType::kRef: + case ValueType::kRtt: assm->push(reg.gp()); break; case ValueType::kI64: @@ -153,9 +156,6 @@ inline void push(LiftoffAssembler* assm, LiftoffRegister reg, ValueType type) { assm->addiu(sp, sp, -sizeof(double)); assm->Sdc1(reg.fp(), MemOperand(sp, 0)); break; - case ValueType::kOptRef: - assm->push(reg.gp()); - break; default: UNREACHABLE(); } @@ -452,12 +452,12 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst_addr, CheckPageFlag(dst_addr, scratch, MemoryChunk::kPointersFromHereAreInterestingMask, ne, &write_barrier); - Branch(USE_DELAY_SLOT, &exit); + Branch(&exit); bind(&write_barrier); JumpIfSmi(src.gp(), &exit); CheckPageFlag(src.gp(), scratch, MemoryChunk::kPointersToHereAreInterestingMask, eq, &exit); - Addu(scratch, dst_addr, offset_imm); + Addu(scratch, dst_op.rm(), dst_op.offset()); CallRecordWriteStub(dst_addr, scratch, EMIT_REMEMBERED_SET, kSaveFPRegs, wasm::WasmCode::kRecordWrite); bind(&exit); @@ -743,7 +743,9 @@ void LiftoffAssembler::Spill(int offset, WasmValue value) { RecordUsedSpillOffset(offset); MemOperand dst = liftoff::GetStackSlot(offset); switch (value.type().kind()) { - case ValueType::kI32: { + case ValueType::kI32: + case ValueType::kRef: + case ValueType::kOptRef: { LiftoffRegister tmp = GetUnusedRegister(kGpReg, {}); TurboAssembler::li(tmp.gp(), Operand(value.to_i32())); sw(tmp.gp(), dst); diff --git a/src/wasm/baseline/mips64/liftoff-assembler-mips64.h b/src/wasm/baseline/mips64/liftoff-assembler-mips64.h index 342894ccf0..1ec0813581 100644 --- a/src/wasm/baseline/mips64/liftoff-assembler-mips64.h +++ b/src/wasm/baseline/mips64/liftoff-assembler-mips64.h @@ -152,6 +152,9 @@ inline void push(LiftoffAssembler* assm, LiftoffRegister reg, ValueType type) { assm->sw(reg.gp(), MemOperand(sp, 0)); break; case ValueType::kI64: + case ValueType::kOptRef: + case ValueType::kRef: + case ValueType::kRtt: assm->push(reg.gp()); break; case ValueType::kF32: @@ -429,13 +432,13 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst_addr, CheckPageFlag(dst_addr, scratch, MemoryChunk::kPointersFromHereAreInterestingMask, ne, &write_barrier); - Branch(USE_DELAY_SLOT, &exit); + Branch(&exit); bind(&write_barrier); JumpIfSmi(src.gp(), &exit); CheckPageFlag(src.gp(), scratch, MemoryChunk::kPointersToHereAreInterestingMask, eq, &exit); - Daddu(scratch, dst_addr, offset_imm); + Daddu(scratch, dst_op.rm(), dst_op.offset()); CallRecordWriteStub(dst_addr, scratch, EMIT_REMEMBERED_SET, kSaveFPRegs, wasm::WasmCode::kRecordWrite); bind(&exit);