diff --git a/src/builtins/ppc/builtins-ppc.cc b/src/builtins/ppc/builtins-ppc.cc index d3058a04a8..6e5c3124a9 100644 --- a/src/builtins/ppc/builtins-ppc.cc +++ b/src/builtins/ppc/builtins-ppc.cc @@ -2605,12 +2605,8 @@ void Builtins::Generate_WasmDebugBreak(MacroAssembler* masm) { // 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); + __ MultiPush(WasmDebugBreakFrameConstants::kPushedGpRegs); + __ MultiPushDoubles(WasmDebugBreakFrameConstants::kPushedFpRegs); // Initialize the JavaScript context with 0. CEntry will use it to // set the current context on the isolate. @@ -2618,8 +2614,8 @@ void Builtins::Generate_WasmDebugBreak(MacroAssembler* masm) { __ CallRuntime(Runtime::kWasmDebugBreak, 0); // Restore registers. - __ MultiPopDoubles(fp_regs); - __ MultiPop(gp_regs); + __ MultiPopDoubles(WasmDebugBreakFrameConstants::kPushedFpRegs); + __ MultiPop(WasmDebugBreakFrameConstants::kPushedGpRegs); } __ Ret(); } diff --git a/src/builtins/s390/builtins-s390.cc b/src/builtins/s390/builtins-s390.cc index 9b3470254e..108a7c2031 100644 --- a/src/builtins/s390/builtins-s390.cc +++ b/src/builtins/s390/builtins-s390.cc @@ -2665,14 +2665,8 @@ void Builtins::Generate_WasmDebugBreak(MacroAssembler* masm) { // 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); + __ MultiPush(WasmDebugBreakFrameConstants::kPushedGpRegs); + __ MultiPushDoubles(WasmDebugBreakFrameConstants::kPushedFpRegs); // Initialize the JavaScript context with 0. CEntry will use it to // set the current context on the isolate. @@ -2680,8 +2674,8 @@ void Builtins::Generate_WasmDebugBreak(MacroAssembler* masm) { __ CallRuntime(Runtime::kWasmDebugBreak, 0); // Restore registers. - __ MultiPopDoubles(fp_regs); - __ MultiPop(gp_regs); + __ MultiPopDoubles(WasmDebugBreakFrameConstants::kPushedFpRegs); + __ MultiPop(WasmDebugBreakFrameConstants::kPushedGpRegs); } __ Ret(); } diff --git a/src/execution/ppc/frame-constants-ppc.h b/src/execution/ppc/frame-constants-ppc.h index c987d48c27..df14b1fc61 100644 --- a/src/execution/ppc/frame-constants-ppc.h +++ b/src/execution/ppc/frame-constants-ppc.h @@ -5,6 +5,7 @@ #ifndef V8_EXECUTION_PPC_FRAME_CONSTANTS_PPC_H_ #define V8_EXECUTION_PPC_FRAME_CONSTANTS_PPC_H_ +#include "src/base/bits.h" #include "src/base/macros.h" #include "src/execution/frame-constants.h" @@ -30,6 +31,22 @@ class WasmCompileLazyFrameConstants : public TypedFrameConstants { kNumberOfSavedFpParamRegs * kDoubleSize; }; +// Frame constructed by the {WasmDebugBreak} builtin. +// After pushing the frame type marker, the builtin pushes all Liftoff cache +// registers (see liftoff-assembler-defs.h). +class WasmDebugBreakFrameConstants : public TypedFrameConstants { + public: + // {r3, r4, r5, r6, r7, r8, r9, r10, r11} + static constexpr uint32_t kPushedGpRegs = 0b111111111000; + // {d0 .. d12} + static constexpr uint32_t kPushedFpRegs = 0b1111111111111; + + static constexpr int kNumPushedGpRegisters = + base::bits::CountPopulation(kPushedGpRegs); + static constexpr int kNumPushedFpRegisters = + base::bits::CountPopulation(kPushedFpRegs); +}; + } // namespace internal } // namespace v8 diff --git a/src/execution/s390/frame-constants-s390.h b/src/execution/s390/frame-constants-s390.h index efa03f6e01..3ff35babff 100644 --- a/src/execution/s390/frame-constants-s390.h +++ b/src/execution/s390/frame-constants-s390.h @@ -5,6 +5,7 @@ #ifndef V8_EXECUTION_S390_FRAME_CONSTANTS_S390_H_ #define V8_EXECUTION_S390_FRAME_CONSTANTS_S390_H_ +#include "src/base/bits.h" #include "src/base/macros.h" #include "src/execution/frame-constants.h" @@ -36,6 +37,22 @@ class WasmCompileLazyFrameConstants : public TypedFrameConstants { kNumberOfSavedFpParamRegs * kDoubleSize; }; +// Frame constructed by the {WasmDebugBreak} builtin. +// After pushing the frame type marker, the builtin pushes all Liftoff cache +// registers (see liftoff-assembler-defs.h). +class WasmDebugBreakFrameConstants : public TypedFrameConstants { + public: + // {r2, r3, r4, r5, r6, r7, r8} + static constexpr uint32_t kPushedGpRegs = 0b111111100; + // {d0 .. d12} + static constexpr uint32_t kPushedFpRegs = 0b1111111111111; + + static constexpr int kNumPushedGpRegisters = + base::bits::CountPopulation(kPushedGpRegs); + static constexpr int kNumPushedFpRegisters = + base::bits::CountPopulation(kPushedFpRegs); +}; + } // namespace internal } // namespace v8