Commit d1edf08d authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

PPC/s390: [wasm] Add builtin and runtime function for debug breaks

Port 59bda196

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.

R=clemensb@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I881a22f1e7c8f9c0714caaa0de75e00177da51e4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2038136Reviewed-by: 's avatarJunliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66138}
parent 562c15d6
......@@ -6,21 +6,22 @@
#include "src/api/api-arguments.h"
#include "src/codegen/code-factory.h"
// For interpreter_entry_return_pc_offset. TODO(jkummerow): Drop.
#include "src/codegen/macro-assembler-inl.h"
#include "src/codegen/register-configuration.h"
#include "src/debug/debug.h"
#include "src/deoptimizer/deoptimizer.h"
#include "src/execution/frame-constants.h"
#include "src/execution/frames.h"
#include "src/logging/counters.h"
// For interpreter_entry_return_pc_offset. TODO(jkummerow): Drop.
#include "src/codegen/macro-assembler-inl.h"
#include "src/codegen/register-configuration.h"
#include "src/heap/heap-inl.h"
#include "src/logging/counters.h"
#include "src/objects/cell.h"
#include "src/objects/foreign.h"
#include "src/objects/heap-number.h"
#include "src/objects/js-generator.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 {
......@@ -2532,6 +2533,33 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
__ Jump(r11);
}
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.
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
// Save all parameter registers. They might hold live values, we restore
// them after the runtime call.
constexpr RegList gp_regs =
Register::ListOf(r3, r4, r5, r6, r7, r8, r9, r10);
constexpr RegList fp_regs =
DoubleRegister::ListOf(d1, d2, d3, d4, d5, d6, d7, d8);
__ MultiPush(gp_regs);
__ MultiPushDoubles(fp_regs);
// Initialize the JavaScript context with 0. CEntry will use it to
// set the current context on the isolate.
__ LoadSmiLiteral(cp, Smi::zero());
__ CallRuntime(Runtime::kWasmDebugBreak, 0);
// Restore registers.
__ MultiPopDoubles(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) {
......
......@@ -6,21 +6,22 @@
#include "src/api/api-arguments.h"
#include "src/codegen/code-factory.h"
// For interpreter_entry_return_pc_offset. TODO(jkummerow): Drop.
#include "src/codegen/macro-assembler-inl.h"
#include "src/codegen/register-configuration.h"
#include "src/debug/debug.h"
#include "src/deoptimizer/deoptimizer.h"
#include "src/execution/frame-constants.h"
#include "src/execution/frames.h"
#include "src/logging/counters.h"
// For interpreter_entry_return_pc_offset. TODO(jkummerow): Drop.
#include "src/codegen/macro-assembler-inl.h"
#include "src/codegen/register-configuration.h"
#include "src/heap/heap-inl.h"
#include "src/logging/counters.h"
#include "src/objects/cell.h"
#include "src/objects/foreign.h"
#include "src/objects/heap-number.h"
#include "src/objects/js-generator.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 {
......@@ -2588,6 +2589,35 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
__ Jump(ip);
}
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.
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
// Save all parameter registers. They might hold live values, we restore
// them after the runtime call.
constexpr RegList gp_regs = Register::ListOf(r2, r3, r4, r5, r6);
#if V8_TARGET_ARCH_S390X
constexpr RegList fp_regs = DoubleRegister::ListOf(d0, d2, d4, d6);
#else
constexpr RegList fp_regs = DoubleRegister::ListOf(d0, d2);
#endif
__ MultiPush(gp_regs);
__ MultiPushDoubles(fp_regs);
// Initialize the JavaScript context with 0. CEntry will use it to
// set the current context on the isolate.
__ LoadSmiLiteral(cp, Smi::zero());
__ CallRuntime(Runtime::kWasmDebugBreak, 0);
// Restore registers.
__ MultiPopDoubles(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