Commit 82a8bfdf authored by Zhao Jiazhong's avatar Zhao Jiazhong Committed by Commit Bot

[mips] Fix DropAndRet with a frame that larger than int16_max

Change-Id: I3f5dbb0fbae3862a6da4146b83e49986c8be3bdc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2467015Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#70469}
parent 7015a0d1
......@@ -4110,9 +4110,19 @@ void TurboAssembler::BranchAndLinkLong(Label* L, BranchDelaySlot bdslot) {
}
void TurboAssembler::DropAndRet(int drop) {
DCHECK(is_int16(drop * kPointerSize));
Ret(USE_DELAY_SLOT);
addiu(sp, sp, drop * kPointerSize);
int32_t drop_size = drop * kSystemPointerSize;
DCHECK(is_int31(drop_size));
if (is_int16(drop_size)) {
Ret(USE_DELAY_SLOT);
addiu(sp, sp, drop_size);
} else {
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, drop_size);
Ret(USE_DELAY_SLOT);
addu(sp, sp, scratch);
}
}
void TurboAssembler::DropAndRet(int drop, Condition cond, Register r1,
......
......@@ -252,8 +252,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void Drop(int count, Condition cond = cc_always, Register reg = no_reg,
const Operand& op = Operand(no_reg));
// Trivial case of DropAndRet that utilizes the delay slot and only emits
// 2 instructions.
// Trivial case of DropAndRet that utilizes the delay slot.
void DropAndRet(int drop);
void DropAndRet(int drop, Condition cond, Register reg, const Operand& op);
......
......@@ -4448,9 +4448,19 @@ void TurboAssembler::BranchAndLinkLong(Label* L, BranchDelaySlot bdslot) {
}
void TurboAssembler::DropAndRet(int drop) {
DCHECK(is_int16(drop * kPointerSize));
Ret(USE_DELAY_SLOT);
daddiu(sp, sp, drop * kPointerSize);
int32_t drop_size = drop * kSystemPointerSize;
DCHECK(is_int31(drop_size));
if (is_int16(drop_size)) {
Ret(USE_DELAY_SLOT);
daddiu(sp, sp, drop_size);
} else {
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, drop_size);
Ret(USE_DELAY_SLOT);
daddu(sp, sp, scratch);
}
}
void TurboAssembler::DropAndRet(int drop, Condition cond, Register r1,
......
......@@ -275,8 +275,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void Drop(int count, Condition cond = cc_always, Register reg = no_reg,
const Operand& op = Operand(no_reg));
// Trivial case of DropAndRet that utilizes the delay slot and only emits
// 2 instructions.
// Trivial case of DropAndRet that utilizes the delay slot.
void DropAndRet(int drop);
void DropAndRet(int drop, Condition cond, Register reg, const Operand& op);
......
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