From 70bdadce8f79e9ab12b9e8972803aea708fd36e7 Mon Sep 17 00:00:00 2001 From: Milad Fa Date: Tue, 20 Dec 2022 13:55:13 -0500 Subject: [PATCH] PPC/s390: [centry] Remove the unused SaveFPRegsMode parameter Port 605e46479aca3449a6ba1350a1de7927c76b86ad Original Commit Message: The SaveFPRegsMode::kSave specializations of CEntry were unused. Remove this parameter to eliminate dead code. R=jgruber@chromium.org, joransiu@ca.ibm.com, junyan@redhat.com, midawson@redhat.com BUG= LOG=N Change-Id: I114dbd0045e891085182e5af79ff1f1201b48765 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4116857 Commit-Queue: Milad Farazmand Reviewed-by: Vasili Skurydzin Cr-Commit-Position: refs/heads/main@{#84965} --- src/builtins/ppc/builtins-ppc.cc | 18 ++++++------ src/builtins/s390/builtins-s390.cc | 18 ++++++------ src/codegen/ppc/macro-assembler-ppc.cc | 35 ++++++------------------ src/codegen/ppc/macro-assembler-ppc.h | 28 ++++++------------- src/codegen/s390/macro-assembler-s390.cc | 35 ++++++------------------ src/codegen/s390/macro-assembler-s390.h | 28 ++++++------------- 6 files changed, 50 insertions(+), 112 deletions(-) diff --git a/src/builtins/ppc/builtins-ppc.cc b/src/builtins/ppc/builtins-ppc.cc index 1bdc9e816e..93e8b742f0 100644 --- a/src/builtins/ppc/builtins-ppc.cc +++ b/src/builtins/ppc/builtins-ppc.cc @@ -2949,8 +2949,7 @@ void Builtins::Generate_WasmOnStackReplace(MacroAssembler* masm) { #endif // V8_ENABLE_WEBASSEMBLY void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, - SaveFPRegsMode save_doubles, ArgvMode argv_mode, - bool builtin_exit_frame) { + ArgvMode argv_mode, bool builtin_exit_frame) { // Called from JavaScript; parameters are on stack as if calling JS function. // r3: number of arguments including receiver // r4: pointer to builtin function @@ -2986,9 +2985,9 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, arg_stack_space += result_size; } - __ EnterExitFrame( - save_doubles == SaveFPRegsMode::kSave, arg_stack_space, - builtin_exit_frame ? StackFrame::BUILTIN_EXIT : StackFrame::EXIT); + __ EnterExitFrame(arg_stack_space, builtin_exit_frame + ? StackFrame::BUILTIN_EXIT + : StackFrame::EXIT); // Store a copy of argc in callee-saved registers for later. __ mr(r14, r3); @@ -3053,7 +3052,7 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, ? no_reg // r14: still holds argc (callee-saved). : r14; - __ LeaveExitFrame(save_doubles == SaveFPRegsMode::kSave, argc); + __ LeaveExitFrame(argc, false); __ blr(); // Handling of exception. @@ -3328,7 +3327,7 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm, } else { __ mov(r14, Operand(stack_space)); } - __ LeaveExitFrame(false, r14, stack_space_operand != nullptr); + __ LeaveExitFrame(r14, stack_space_operand != nullptr); // Check if the function scheduled an exception. __ LoadRoot(r14, RootIndex::kTheHoleValue); @@ -3438,10 +3437,9 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { // [1-3] FunctionCallbackInfo // [4] number of bytes to drop from the stack after returning static constexpr int kApiStackSpace = 5; - static constexpr bool kDontSaveDoubles = false; FrameScope frame_scope(masm, StackFrame::MANUAL); - __ EnterExitFrame(kDontSaveDoubles, kApiStackSpace); + __ EnterExitFrame(kApiStackSpace, StackFrame::EXIT); // FunctionCallbackInfo::implicit_args_ (points at kHolder as set up above). // Arguments are after the return address (pushed by EnterExitFrame()). @@ -3557,7 +3555,7 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) { } FrameScope frame_scope(masm, StackFrame::MANUAL); - __ EnterExitFrame(false, apiStackSpace); + __ EnterExitFrame(apiStackSpace, StackFrame::EXIT); if (!ABI_PASSES_HANDLES_IN_REGS) { // pass 1st arg by reference diff --git a/src/builtins/s390/builtins-s390.cc b/src/builtins/s390/builtins-s390.cc index f1f9caad37..e1f968a4ee 100644 --- a/src/builtins/s390/builtins-s390.cc +++ b/src/builtins/s390/builtins-s390.cc @@ -2942,8 +2942,7 @@ void Builtins::Generate_WasmOnStackReplace(MacroAssembler* masm) { #endif // V8_ENABLE_WEBASSEMBLY void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, - SaveFPRegsMode save_doubles, ArgvMode argv_mode, - bool builtin_exit_frame) { + ArgvMode argv_mode, bool builtin_exit_frame) { // Called from JavaScript; parameters are on stack as if calling JS function. // r2: number of arguments including receiver // r3: pointer to builtin function @@ -2983,9 +2982,9 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, arg_stack_space += 2; #endif - __ EnterExitFrame( - save_doubles == SaveFPRegsMode::kSave, arg_stack_space, - builtin_exit_frame ? StackFrame::BUILTIN_EXIT : StackFrame::EXIT); + __ EnterExitFrame(arg_stack_space, builtin_exit_frame + ? StackFrame::BUILTIN_EXIT + : StackFrame::EXIT); // Store a copy of argc, argv in callee-saved registers for later. __ mov(r6, r2); @@ -3052,7 +3051,7 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, ? no_reg // r6: still holds argc (callee-saved). : r6; - __ LeaveExitFrame(save_doubles == SaveFPRegsMode::kSave, argc); + __ LeaveExitFrame(argc, false); __ b(r14); // Handling of exception. @@ -3313,7 +3312,7 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm, DCHECK_EQ(stack_space, 0); __ LoadU64(r6, *stack_space_operand); } - __ LeaveExitFrame(false, r6, stack_space_operand != nullptr); + __ LeaveExitFrame(r6, stack_space_operand != nullptr); // Check if the function scheduled an exception. __ Move(r7, ExternalReference::scheduled_exception_address(isolate)); @@ -3422,10 +3421,9 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { // [1-3] FunctionCallbackInfo // [4] number of bytes to drop from the stack after returning static constexpr int kApiStackSpace = 5; - static constexpr bool kDontSaveDoubles = false; FrameScope frame_scope(masm, StackFrame::MANUAL); - __ EnterExitFrame(kDontSaveDoubles, kApiStackSpace); + __ EnterExitFrame(kApiStackSpace, StackFrame::EXIT); // FunctionCallbackInfo::implicit_args_ (points at kHolder as set up above). // Arguments are after the return address (pushed by EnterExitFrame()). @@ -3540,7 +3538,7 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) { } FrameScope frame_scope(masm, StackFrame::MANUAL); - __ EnterExitFrame(false, apiStackSpace); + __ EnterExitFrame(apiStackSpace, StackFrame::EXIT); if (!ABI_PASSES_HANDLES_IN_REGS) { // pass 1st arg by reference diff --git a/src/codegen/ppc/macro-assembler-ppc.cc b/src/codegen/ppc/macro-assembler-ppc.cc index d399da4fb7..fdbcb2788b 100644 --- a/src/codegen/ppc/macro-assembler-ppc.cc +++ b/src/codegen/ppc/macro-assembler-ppc.cc @@ -1349,7 +1349,7 @@ int TurboAssembler::LeaveFrame(StackFrame::Type type, int stack_adjustment) { // in the fp register (r31) // Then - we buy a new frame -void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space, +void MacroAssembler::EnterExitFrame(int stack_space, StackFrame::Type frame_type) { DCHECK(frame_type == StackFrame::EXIT || frame_type == StackFrame::BUILTIN_EXIT); @@ -1385,15 +1385,6 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space, ExternalReference::Create(IsolateAddressId::kContextAddress, isolate())); StoreU64(cp, MemOperand(r8)); - // Optionally save all volatile double registers. - if (save_doubles) { - MultiPushDoubles(kCallerSavedDoubles); - // Note that d0 will be accessible at - // fp - ExitFrameConstants::kFrameSize - - // kNumCallerSavedDoubles * kDoubleSize, - // since the sp slot and code slot were pushed after the fp. - } - AddS64(sp, sp, Operand(-stack_space * kSystemPointerSize)); // Allocate and align the frame preparing for calling the runtime @@ -1431,18 +1422,9 @@ int TurboAssembler::ActivationFrameAlignment() { #endif } -void MacroAssembler::LeaveExitFrame(bool save_doubles, Register argument_count, +void MacroAssembler::LeaveExitFrame(Register argument_count, bool argument_count_is_length) { ConstantPoolUnavailableScope constant_pool_unavailable(this); - // Optionally restore all double registers. - if (save_doubles) { - // Calculate the stack location of the saved doubles and restore them. - const int kNumRegs = kNumCallerSavedDoubles; - const int offset = - (ExitFrameConstants::kFixedFrameSizeFromFp + kNumRegs * kDoubleSize); - AddS64(r6, fp, Operand(-offset), r0); - MultiPopDoubles(kCallerSavedDoubles, r6); - } // Clear top frame. li(r6, Operand::Zero()); @@ -2168,8 +2150,8 @@ void MacroAssembler::OptimizeCodeOrTailCallOptimizedCodeSlot( TailCallOptimizedCodeSlot(this, optimized_code_entry, r9); } -void MacroAssembler::CallRuntime(const Runtime::Function* f, int num_arguments, - SaveFPRegsMode save_doubles) { +void MacroAssembler::CallRuntime(const Runtime::Function* f, + int num_arguments) { // All parameters are on the stack. r3 has the return value after call. // If the expected number of arguments of the runtime function is @@ -2184,10 +2166,9 @@ void MacroAssembler::CallRuntime(const Runtime::Function* f, int num_arguments, mov(r3, Operand(num_arguments)); Move(r4, ExternalReference::Create(f)); #if V8_TARGET_ARCH_PPC64 - Handle code = - CodeFactory::CEntry(isolate(), f->result_size, save_doubles); + Handle code = CodeFactory::CEntry(isolate(), f->result_size); #else - Handle code = CodeFactory::CEntry(isolate(), 1, save_doubles); + Handle code = CodeFactory::CEntry(isolate(), 1); #endif Call(code, RelocInfo::CODE_TARGET); } @@ -2204,8 +2185,8 @@ void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin, bool builtin_exit_frame) { Move(r4, builtin); - Handle code = CodeFactory::CEntry(isolate(), 1, SaveFPRegsMode::kIgnore, - ArgvMode::kStack, builtin_exit_frame); + Handle code = + CodeFactory::CEntry(isolate(), 1, ArgvMode::kStack, builtin_exit_frame); Jump(code, RelocInfo::CODE_TARGET); } diff --git a/src/codegen/ppc/macro-assembler-ppc.h b/src/codegen/ppc/macro-assembler-ppc.h index bf278e86c1..67d0565f0b 100644 --- a/src/codegen/ppc/macro-assembler-ppc.h +++ b/src/codegen/ppc/macro-assembler-ppc.h @@ -1452,15 +1452,12 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler { // Enter exit frame. // stack_space - extra stack space, used for parameters before call to C. - // At least one slot (for the return address) should be provided. - void EnterExitFrame(bool save_doubles, int stack_space = 1, - StackFrame::Type frame_type = StackFrame::EXIT); + void EnterExitFrame(int stack_space, StackFrame::Type frame_type); // Leave the current exit frame. Expects the return value in r0. // Expect the number of values, pushed prior to the exit frame, to // remove in a register (or no_reg, if there is nothing to remove). - void LeaveExitFrame(bool save_doubles, Register argument_count, - bool argument_count_is_length = false); + void LeaveExitFrame(Register argument_count, bool argument_count_is_length); // Load the global proxy from the current context. void LoadGlobalProxy(Register dst) { @@ -1596,24 +1593,17 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler { void CallJSEntry(Register target); // Call a runtime routine. - void CallRuntime(const Runtime::Function* f, int num_arguments, - SaveFPRegsMode save_doubles = SaveFPRegsMode::kIgnore); - void CallRuntimeSaveDoubles(Runtime::FunctionId fid) { + void CallRuntime(const Runtime::Function* f, int num_arguments); + + // Convenience function: Same as above, but takes the fid instead. + void CallRuntime(Runtime::FunctionId fid) { const Runtime::Function* function = Runtime::FunctionForId(fid); - CallRuntime(function, function->nargs, SaveFPRegsMode::kSave); + CallRuntime(function, function->nargs); } // Convenience function: Same as above, but takes the fid instead. - void CallRuntime(Runtime::FunctionId fid, - SaveFPRegsMode save_doubles = SaveFPRegsMode::kIgnore) { - const Runtime::Function* function = Runtime::FunctionForId(fid); - CallRuntime(function, function->nargs, save_doubles); - } - - // Convenience function: Same as above, but takes the fid instead. - void CallRuntime(Runtime::FunctionId fid, int num_arguments, - SaveFPRegsMode save_doubles = SaveFPRegsMode::kIgnore) { - CallRuntime(Runtime::FunctionForId(fid), num_arguments, save_doubles); + void CallRuntime(Runtime::FunctionId fid, int num_arguments) { + CallRuntime(Runtime::FunctionForId(fid), num_arguments); } // Convenience function: tail call a runtime routine (jump). diff --git a/src/codegen/s390/macro-assembler-s390.cc b/src/codegen/s390/macro-assembler-s390.cc index 2fec07fbf4..c626cc2674 100644 --- a/src/codegen/s390/macro-assembler-s390.cc +++ b/src/codegen/s390/macro-assembler-s390.cc @@ -1542,7 +1542,7 @@ int TurboAssembler::LeaveFrame(StackFrame::Type type, int stack_adjustment) { // gaps // Args // ABIRes <- newSP -void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space, +void MacroAssembler::EnterExitFrame(int stack_space, StackFrame::Type frame_type) { DCHECK(frame_type == StackFrame::EXIT || frame_type == StackFrame::BUILTIN_EXIT); @@ -1574,15 +1574,6 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space, ExternalReference::Create(IsolateAddressId::kContextAddress, isolate())); StoreU64(cp, MemOperand(r1)); - // Optionally save all volatile double registers. - if (save_doubles) { - MultiPushDoubles(kCallerSavedDoubles); - // Note that d0 will be accessible at - // fp - ExitFrameConstants::kFrameSize - - // kNumCallerSavedDoubles * kDoubleSize, - // since the sp slot and code slot were pushed after the fp. - } - lay(sp, MemOperand(sp, -stack_space * kSystemPointerSize)); // Allocate and align the frame preparing for calling the runtime @@ -1617,17 +1608,8 @@ int TurboAssembler::ActivationFrameAlignment() { #endif } -void MacroAssembler::LeaveExitFrame(bool save_doubles, Register argument_count, +void MacroAssembler::LeaveExitFrame(Register argument_count, bool argument_count_is_length) { - // Optionally restore all double registers. - if (save_doubles) { - // Calculate the stack location of the saved doubles and restore them. - const int kNumRegs = kNumCallerSavedDoubles; - lay(r5, MemOperand(fp, -(ExitFrameConstants::kFixedFrameSizeFromFp + - kNumRegs * kDoubleSize))); - MultiPopDoubles(kCallerSavedDoubles, r5); - } - // Clear top frame. Move(ip, ExternalReference::Create(IsolateAddressId::kCEntryFPAddress, isolate())); @@ -2163,8 +2145,8 @@ void MacroAssembler::OptimizeCodeOrTailCallOptimizedCodeSlot( TailCallOptimizedCodeSlot(this, optimized_code_entry, r8); } -void MacroAssembler::CallRuntime(const Runtime::Function* f, int num_arguments, - SaveFPRegsMode save_doubles) { +void MacroAssembler::CallRuntime(const Runtime::Function* f, + int num_arguments) { // All parameters are on the stack. r2 has the return value after call. // If the expected number of arguments of the runtime function is @@ -2179,10 +2161,9 @@ void MacroAssembler::CallRuntime(const Runtime::Function* f, int num_arguments, mov(r2, Operand(num_arguments)); Move(r3, ExternalReference::Create(f)); #if V8_TARGET_ARCH_S390X - Handle code = - CodeFactory::CEntry(isolate(), f->result_size, save_doubles); + Handle code = CodeFactory::CEntry(isolate(), f->result_size); #else - Handle code = CodeFactory::CEntry(isolate(), 1, save_doubles); + Handle code = CodeFactory::CEntry(isolate(), 1); #endif Call(code, RelocInfo::CODE_TARGET); @@ -2200,8 +2181,8 @@ void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin, bool builtin_exit_frame) { Move(r3, builtin); - Handle code = CodeFactory::CEntry(isolate(), 1, SaveFPRegsMode::kIgnore, - ArgvMode::kStack, builtin_exit_frame); + Handle code = + CodeFactory::CEntry(isolate(), 1, ArgvMode::kStack, builtin_exit_frame); Jump(code, RelocInfo::CODE_TARGET); } diff --git a/src/codegen/s390/macro-assembler-s390.h b/src/codegen/s390/macro-assembler-s390.h index 6a91f1c096..4934755d95 100644 --- a/src/codegen/s390/macro-assembler-s390.h +++ b/src/codegen/s390/macro-assembler-s390.h @@ -1521,24 +1521,17 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler { StoreU64(rec, MemOperand(sp, 0)); } - void CallRuntime(const Runtime::Function* f, int num_arguments, - SaveFPRegsMode save_doubles = SaveFPRegsMode::kIgnore); - void CallRuntimeSaveDoubles(Runtime::FunctionId fid) { + void CallRuntime(const Runtime::Function* f, int num_arguments); + + // Convenience function: Same as above, but takes the fid instead. + void CallRuntime(Runtime::FunctionId fid) { const Runtime::Function* function = Runtime::FunctionForId(fid); - CallRuntime(function, function->nargs, SaveFPRegsMode::kSave); + CallRuntime(function, function->nargs); } // Convenience function: Same as above, but takes the fid instead. - void CallRuntime(Runtime::FunctionId fid, - SaveFPRegsMode save_doubles = SaveFPRegsMode::kIgnore) { - const Runtime::Function* function = Runtime::FunctionForId(fid); - CallRuntime(function, function->nargs, save_doubles); - } - - // Convenience function: Same as above, but takes the fid instead. - void CallRuntime(Runtime::FunctionId fid, int num_arguments, - SaveFPRegsMode save_doubles = SaveFPRegsMode::kIgnore) { - CallRuntime(Runtime::FunctionForId(fid), num_arguments, save_doubles); + void CallRuntime(Runtime::FunctionId fid, int num_arguments) { + CallRuntime(Runtime::FunctionForId(fid), num_arguments); } // Convenience function: tail call a runtime routine (jump). @@ -1686,15 +1679,12 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler { // Enter exit frame. // stack_space - extra stack space, used for parameters before call to C. - // At least one slot (for the return address) should be provided. - void EnterExitFrame(bool save_doubles, int stack_space = 1, - StackFrame::Type frame_type = StackFrame::EXIT); + void EnterExitFrame(int stack_space, StackFrame::Type frame_type); // Leave the current exit frame. Expects the return value in r0. // Expect the number of values, pushed prior to the exit frame, to // remove in a register (or no_reg, if there is nothing to remove). - void LeaveExitFrame(bool save_doubles, Register argument_count, - bool argument_count_is_length = false); + void LeaveExitFrame(Register argument_count, bool argument_count_is_length); // Load the global proxy from the current context. void LoadGlobalProxy(Register dst) {