Commit cbf71051 authored by Milad Fa's avatar Milad Fa Committed by Commit Bot

S390: Push the full simd register before lazy compile

If a lazy compilation happens in between 2 Wasm calls, we need to save
the full Simd register, since we can have live v128 values.

Port: 3b302d5c

Bug: chromium:1161555
Change-Id: Id79c609cc01e896f48aff39fdcbf4aa76ae6996e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2649260Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/master@{#72349}
parent 03482bb3
...@@ -2449,7 +2449,7 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { ...@@ -2449,7 +2449,7 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
constexpr RegList fp_regs = DoubleRegister::ListOf(d0, d2); constexpr RegList fp_regs = DoubleRegister::ListOf(d0, d2);
#endif #endif
__ MultiPush(gp_regs); __ MultiPush(gp_regs);
__ MultiPushDoubles(fp_regs); __ MultiPushV128(fp_regs);
// Pass instance and function index as explicit arguments to the runtime // Pass instance and function index as explicit arguments to the runtime
// function. // function.
...@@ -2462,7 +2462,7 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { ...@@ -2462,7 +2462,7 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
__ mov(ip, r2); __ mov(ip, r2);
// Restore registers. // Restore registers.
__ MultiPopDoubles(fp_regs); __ MultiPopV128(fp_regs);
__ MultiPop(gp_regs); __ MultiPop(gp_regs);
} }
// Finally, jump to the entrypoint. // Finally, jump to the entrypoint.
......
...@@ -611,6 +611,20 @@ void TurboAssembler::MultiPushDoubles(RegList dregs, Register location) { ...@@ -611,6 +611,20 @@ void TurboAssembler::MultiPushDoubles(RegList dregs, Register location) {
} }
} }
void TurboAssembler::MultiPushV128(RegList dregs, Register location) {
int16_t num_to_push = base::bits::CountPopulation(dregs);
int16_t stack_offset = num_to_push * kSimd128Size;
SubS64(location, location, Operand(stack_offset));
for (int16_t i = Simd128Register::kNumRegisters - 1; i >= 0; i--) {
if ((dregs & (1 << i)) != 0) {
Simd128Register dreg = Simd128Register::from_code(i);
stack_offset -= kSimd128Size;
StoreV128(dreg, MemOperand(location, stack_offset), r0);
}
}
}
void TurboAssembler::MultiPopDoubles(RegList dregs, Register location) { void TurboAssembler::MultiPopDoubles(RegList dregs, Register location) {
int16_t stack_offset = 0; int16_t stack_offset = 0;
...@@ -624,6 +638,19 @@ void TurboAssembler::MultiPopDoubles(RegList dregs, Register location) { ...@@ -624,6 +638,19 @@ void TurboAssembler::MultiPopDoubles(RegList dregs, Register location) {
AddS64(location, location, Operand(stack_offset)); AddS64(location, location, Operand(stack_offset));
} }
void TurboAssembler::MultiPopV128(RegList dregs, Register location) {
int16_t stack_offset = 0;
for (int16_t i = 0; i < Simd128Register::kNumRegisters; i++) {
if ((dregs & (1 << i)) != 0) {
Simd128Register dreg = Simd128Register::from_code(i);
LoadV128(dreg, MemOperand(location, stack_offset), r0);
stack_offset += kSimd128Size;
}
}
AddS64(location, location, Operand(stack_offset));
}
void TurboAssembler::LoadRoot(Register destination, RootIndex index, void TurboAssembler::LoadRoot(Register destination, RootIndex index,
Condition) { Condition) {
LoadU64(destination, LoadU64(destination,
......
...@@ -147,6 +147,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { ...@@ -147,6 +147,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void MultiPushDoubles(RegList dregs, Register location = sp); void MultiPushDoubles(RegList dregs, Register location = sp);
void MultiPopDoubles(RegList dregs, Register location = sp); void MultiPopDoubles(RegList dregs, Register location = sp);
void MultiPushV128(RegList dregs, Register location = sp);
void MultiPopV128(RegList dregs, Register location = sp);
// Calculate how much stack space (in bytes) are required to store caller // Calculate how much stack space (in bytes) are required to store caller
// registers excluding those specified in the arguments. // registers excluding those specified in the arguments.
int RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode, int RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
......
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