Commit 924b0778 authored by Liu Yu's avatar Liu Yu Committed by Commit Bot

[mips][wasm][liftoff] Allow loads from negative indices

Port commit 4765c70f

Change-Id: I1149eb3317613627e2cef4e6c9ad38f044e96fe0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2576444Reviewed-by: 's avatarZhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Auto-Submit: Liu yu <liuyu@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#71633}
parent e119b858
......@@ -415,7 +415,6 @@ void LiftoffAssembler::LoadTaggedPointer(Register dst, Register src_addr,
Register offset_reg,
int32_t offset_imm,
LiftoffRegList pinned) {
DCHECK_GE(offset_imm, 0);
STATIC_ASSERT(kTaggedSize == kInt32Size);
Load(LiftoffRegister(dst), src_addr, offset_reg,
static_cast<uint32_t>(offset_imm), LoadType::kI32Load, pinned);
......
......@@ -73,9 +73,10 @@ inline MemOperand GetStackSlot(int offset) { return MemOperand(fp, -offset); }
inline MemOperand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); }
template <typename T>
inline MemOperand GetMemOp(LiftoffAssembler* assm, Register addr,
Register offset, uintptr_t offset_imm) {
if (is_uint31(offset_imm)) {
Register offset, T offset_imm) {
if (is_int32(offset_imm)) {
int32_t offset_imm32 = static_cast<int32_t>(offset_imm);
if (offset == no_reg) return MemOperand(addr, offset_imm32);
assm->daddu(kScratchReg, addr, offset);
......@@ -401,18 +402,15 @@ void LiftoffAssembler::LoadTaggedPointer(Register dst, Register src_addr,
Register offset_reg,
int32_t offset_imm,
LiftoffRegList pinned) {
DCHECK_GE(offset_imm, 0);
STATIC_ASSERT(kTaggedSize == kInt64Size);
Load(LiftoffRegister(dst), src_addr, offset_reg,
static_cast<uint32_t>(offset_imm), LoadType::kI64Load, pinned);
MemOperand src_op = liftoff::GetMemOp(this, src_addr, offset_reg, offset_imm);
Ld(dst, src_op);
}
void LiftoffAssembler::StoreTaggedPointer(Register dst_addr,
int32_t offset_imm,
LiftoffRegister src,
LiftoffRegList pinned) {
DCHECK_GE(offset_imm, 0);
DCHECK_LE(offset_imm, std::numeric_limits<int32_t>::max());
STATIC_ASSERT(kTaggedSize == kInt64Size);
Register scratch = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp();
Sd(src.gp(), MemOperand(dst_addr, offset_imm));
......
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