Commit 4df7b0bd authored by Zhao Jiazhong's avatar Zhao Jiazhong Committed by Commit Bot

[mips][wasm] Fix kWasmInstanceOffset

Currently the kWasmInstanceOffset is computed according to the reg
a0(kWasmInstanceRegister)'s position in the frame. And according
to Builtins::Generate_WasmCompileLazy, it's the 7th gp_regs that
are pushed on to stack, so the index should be 6 other than 7.

Since the kWasmInstanceRegister will be pushed on to stack after
all parameter registers, so we can use it's index, which does not
reply on which reg kWasmInstanceRegister is, and what order the
parameter registers are pushed on to stack.

So the new index is equal to the number of all parameter registers.

Change-Id: I7a77fb052a5d68ee28dab10409462260ad491578
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2425329
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70087}
parent 04319318
......@@ -2494,6 +2494,12 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
constexpr RegList gp_regs = Register::ListOf(a0, a2, a3);
constexpr RegList fp_regs =
DoubleRegister::ListOf(f2, f4, f6, f8, f10, f12, f14);
constexpr int16_t num_to_push = base::bits::CountPopulation(gp_regs) +
base::bits::CountPopulation(fp_regs);
// The number of regs to be pushed before kWasmInstanceRegister should be
// equal to kNumberOfSavedAllParamRegs.
STATIC_ASSERT(num_to_push ==
WasmCompileLazyFrameConstants::kNumberOfSavedAllParamRegs);
__ MultiPush(gp_regs);
__ MultiPushFPU(fp_regs);
......
......@@ -2857,6 +2857,12 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
Register::ListOf(a0, a2, a3, a4, a5, a6, a7);
constexpr RegList fp_regs =
DoubleRegister::ListOf(f2, f4, f6, f8, f10, f12, f14);
constexpr int16_t num_to_push = base::bits::CountPopulation(gp_regs) +
base::bits::CountPopulation(fp_regs);
// The number of regs to be pushed before kWasmInstanceRegister should be
// equal to kNumberOfSavedAllParamRegs.
STATIC_ASSERT(num_to_push ==
WasmCompileLazyFrameConstants::kNumberOfSavedAllParamRegs);
__ MultiPush(gp_regs);
__ MultiPushFPU(fp_regs);
......
......@@ -27,9 +27,12 @@ class WasmCompileLazyFrameConstants : public TypedFrameConstants {
public:
static constexpr int kNumberOfSavedGpParamRegs = 3;
static constexpr int kNumberOfSavedFpParamRegs = 7;
static constexpr int kNumberOfSavedAllParamRegs = 10;
// FP-relative.
static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(3);
// See Generate_WasmCompileLazy in builtins-mips.cc.
static constexpr int kWasmInstanceOffset =
TYPED_FRAME_PUSHED_VALUE_OFFSET(kNumberOfSavedAllParamRegs);
static constexpr int kFixedFrameSizeFromFp =
TypedFrameConstants::kFixedFrameSizeFromFp +
kNumberOfSavedGpParamRegs * kPointerSize +
......
......@@ -23,9 +23,12 @@ class WasmCompileLazyFrameConstants : public TypedFrameConstants {
public:
static constexpr int kNumberOfSavedGpParamRegs = 7;
static constexpr int kNumberOfSavedFpParamRegs = 7;
static constexpr int kNumberOfSavedAllParamRegs = 14;
// FP-relative.
static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(7);
// See Generate_WasmCompileLazy in builtins-mips64.cc.
static constexpr int kWasmInstanceOffset =
TYPED_FRAME_PUSHED_VALUE_OFFSET(kNumberOfSavedAllParamRegs);
static constexpr int kFixedFrameSizeFromFp =
TypedFrameConstants::kFixedFrameSizeFromFp +
kNumberOfSavedGpParamRegs * kPointerSize +
......
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