Commit f5f15871 authored by Yu Yin's avatar Yu Yin Committed by Commit Bot

[mips][wasm] Add builtin and runtime function for debug breaks

port 59bda196 https://crrev.com/c/2036082
Original Commit Message:

    This CL adds the "WasmDebugBreak" builtin for x64, ia32, arm and arm64.
    It stores all wasm parameter registers to the stack and calls the
    respective runtime function.
    The runtime function does not do anything yet, but the
    inspector/debugger/wasm-set-breakpoint-liftoff test will already execute
    both the builtin and the runtime function.

Change-Id: I7e74116f711d9d2599f6f1a6d47b972bad101f8c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2041214Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Yu Yin <xwafish@gmail.com>
Cr-Commit-Position: refs/heads/master@{#66146}
parent 58b45cca
......@@ -23,6 +23,7 @@
#include "src/objects/objects-inl.h"
#include "src/objects/smi.h"
#include "src/runtime/runtime.h"
#include "src/wasm/wasm-linkage.h"
#include "src/wasm/wasm-objects.h"
namespace v8 {
......@@ -2419,6 +2420,34 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
__ Jump(kScratchReg, v0, 0);
}
void Builtins::Generate_WasmDebugBreak(MacroAssembler* masm) {
HardAbortScope hard_abort(masm); // Avoid calls to Abort.
{
// TODO(clemensb): Use a separate frame type and make it inspectable.
FrameScope scope(masm, StackFrame::INTERNAL);
// Save all parameter registers. They might hold live values, we restore
// them after the runtime call.
RegList gp_regs = 0;
for (Register reg : wasm::kGpParamRegisters) gp_regs |= reg.bit();
RegList fp_regs = 0;
for (DoubleRegister reg : wasm::kFpParamRegisters) fp_regs |= reg.bit();
__ MultiPush(gp_regs);
__ MultiPushFPU(fp_regs);
// Initialize the JavaScript context with 0. CEntry will use it to
// set the current context on the isolate.
__ Move(cp, Smi::zero());
__ CallRuntime(Runtime::kWasmDebugBreak, 0);
// Restore registers.
__ MultiPopFPU(fp_regs);
__ MultiPop(gp_regs);
}
__ Ret();
}
void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
SaveFPRegsMode save_doubles, ArgvMode argv_mode,
bool builtin_exit_frame) {
......
......@@ -23,6 +23,7 @@
#include "src/objects/objects-inl.h"
#include "src/objects/smi.h"
#include "src/runtime/runtime.h"
#include "src/wasm/wasm-linkage.h"
#include "src/wasm/wasm-objects.h"
namespace v8 {
......@@ -2458,6 +2459,34 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
__ Jump(v0);
}
void Builtins::Generate_WasmDebugBreak(MacroAssembler* masm) {
HardAbortScope hard_abort(masm); // Avoid calls to Abort.
{
// TODO(clemensb): Use a separate frame type and make it inspectable.
FrameScope scope(masm, StackFrame::INTERNAL);
// Save all parameter registers. They might hold live values, we restore
// them after the runtime call.
RegList gp_regs = 0;
for (Register reg : wasm::kGpParamRegisters) gp_regs |= reg.bit();
RegList fp_regs = 0;
for (DoubleRegister reg : wasm::kFpParamRegisters) fp_regs |= reg.bit();
__ MultiPush(gp_regs);
__ MultiPushFPU(fp_regs);
// Initialize the JavaScript context with 0. CEntry will use it to
// set the current context on the isolate.
__ Move(cp, Smi::zero());
__ CallRuntime(Runtime::kWasmDebugBreak, 0);
// Restore registers.
__ MultiPopFPU(fp_regs);
__ MultiPop(gp_regs);
}
__ Ret();
}
void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
SaveFPRegsMode save_doubles, ArgvMode argv_mode,
bool builtin_exit_frame) {
......
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