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

Port commit 4765c70fa6

Change-Id: I1149eb3317613627e2cef4e6c9ad38f044e96fe0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2576444
Reviewed-by: Zhao 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}
This commit is contained in:
Liu Yu 2020-12-07 14:50:14 +08:00 committed by Commit Bot
parent e119b85840
commit 924b07783c
2 changed files with 5 additions and 8 deletions

View File

@ -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);

View File

@ -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));