Commit 99c9e635 authored by Zhao Jiazhong's avatar Zhao Jiazhong Committed by Commit Bot

[mips][builtins] Remove ParameterCount uses from InvokeFunction(Code)

port 46648402 https://crrev.com/c/1871605

Original Commit Message:

CallDebugOnFunctionCall was always using Registers and not Immediates.
    Then ParameterCount is not really needed. Since updating that, we
    could update other functions, e.g InvokeFunction, to only use
    registers too.

    Also removed now irrelevant variables, e.g definitely_mismatches.

[mips][codegen] Removed ParameterCount class

port 1e696896 https://crrev.com/c/1886916

Original Commit Message:

    It was used only with Register inputs, so we can replace its uses with
    the Registers themselves.

Change-Id: I0a661519f5602bf4d52c40c6c238436b93b71664
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1898826Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64753}
parent e554dec4
...@@ -122,8 +122,7 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) { ...@@ -122,8 +122,7 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
// a0: number of arguments (untagged) // a0: number of arguments (untagged)
// a1: constructor function // a1: constructor function
// a3: new target // a3: new target
ParameterCount actual(a0); __ InvokeFunctionWithNewTarget(a1, a3, a0, CALL_FUNCTION);
__ InvokeFunction(a1, a3, actual, CALL_FUNCTION);
// Restore context from the frame. // Restore context from the frame.
__ lw(cp, MemOperand(fp, ConstructFrameConstants::kContextOffset)); __ lw(cp, MemOperand(fp, ConstructFrameConstants::kContextOffset));
...@@ -279,8 +278,7 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { ...@@ -279,8 +278,7 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
__ Branch(&loop, greater_equal, t3, Operand(zero_reg)); __ Branch(&loop, greater_equal, t3, Operand(zero_reg));
// Call the function. // Call the function.
ParameterCount actual(a0); __ InvokeFunctionWithNewTarget(a1, a3, a0, CALL_FUNCTION);
__ InvokeFunction(a1, a3, actual, CALL_FUNCTION);
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- v0: constructor result // -- v0: constructor result
...@@ -1999,9 +1997,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -1999,9 +1997,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
__ lhu(a2, __ lhu(a2,
FieldMemOperand(a2, SharedFunctionInfo::kFormalParameterCountOffset)); FieldMemOperand(a2, SharedFunctionInfo::kFormalParameterCountOffset));
ParameterCount actual(a0); __ InvokeFunctionCode(a1, no_reg, a2, a0, JUMP_FUNCTION);
ParameterCount expected(a2);
__ InvokeFunctionCode(a1, no_reg, expected, actual, JUMP_FUNCTION);
// The function is a "classConstructor", need to raise an exception. // The function is a "classConstructor", need to raise an exception.
__ bind(&class_constructor); __ bind(&class_constructor);
......
...@@ -122,8 +122,7 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) { ...@@ -122,8 +122,7 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
// a0: number of arguments (untagged) // a0: number of arguments (untagged)
// a1: constructor function // a1: constructor function
// a3: new target // a3: new target
ParameterCount actual(a0); __ InvokeFunctionWithNewTarget(a1, a3, a0, CALL_FUNCTION);
__ InvokeFunction(a1, a3, actual, CALL_FUNCTION);
// Restore context from the frame. // Restore context from the frame.
__ Ld(cp, MemOperand(fp, ConstructFrameConstants::kContextOffset)); __ Ld(cp, MemOperand(fp, ConstructFrameConstants::kContextOffset));
...@@ -280,8 +279,7 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { ...@@ -280,8 +279,7 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
__ Branch(&loop, greater_equal, t3, Operand(zero_reg)); __ Branch(&loop, greater_equal, t3, Operand(zero_reg));
// Call the function. // Call the function.
ParameterCount actual(a0); __ InvokeFunctionWithNewTarget(a1, a3, a0, CALL_FUNCTION);
__ InvokeFunction(a1, a3, actual, CALL_FUNCTION);
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- v0: constructor result // -- v0: constructor result
...@@ -2040,9 +2038,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -2040,9 +2038,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
__ Lhu(a2, __ Lhu(a2,
FieldMemOperand(a2, SharedFunctionInfo::kFormalParameterCountOffset)); FieldMemOperand(a2, SharedFunctionInfo::kFormalParameterCountOffset));
ParameterCount actual(a0); __ InvokeFunctionCode(a1, no_reg, a2, a0, JUMP_FUNCTION);
ParameterCount expected(a2);
__ InvokeFunctionCode(a1, no_reg, expected, actual, JUMP_FUNCTION);
// The function is a "classConstructor", need to raise an exception. // The function is a "classConstructor", need to raise an exception.
__ bind(&class_constructor); __ bind(&class_constructor);
......
This diff is collapsed.
...@@ -443,11 +443,11 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { ...@@ -443,11 +443,11 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// Removes current frame and its arguments from the stack preserving // Removes current frame and its arguments from the stack preserving
// the arguments and a return address pushed to the stack for the next call. // the arguments and a return address pushed to the stack for the next call.
// Both |callee_args_count| and |caller_args_count_reg| do not include // Both |callee_args_count| and |caller_args_count| do not include
// receiver. |callee_args_count| is not modified, |caller_args_count_reg| // receiver. |callee_args_count| is not modified. |caller_args_count|
// is trashed. // is trashed.
void PrepareForTailCall(const ParameterCount& callee_args_count, void PrepareForTailCall(Register callee_args_count,
Register caller_args_count_reg, Register scratch0, Register caller_args_count, Register scratch0,
Register scratch1); Register scratch1);
int CalculateStackPassedWords(int num_reg_arguments, int CalculateStackPassedWords(int num_reg_arguments,
...@@ -988,21 +988,22 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler { ...@@ -988,21 +988,22 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
// Invoke the JavaScript function code by either calling or jumping. // Invoke the JavaScript function code by either calling or jumping.
void InvokeFunctionCode(Register function, Register new_target, void InvokeFunctionCode(Register function, Register new_target,
const ParameterCount& expected, Register expected_parameter_count,
const ParameterCount& actual, InvokeFlag flag); Register actual_parameter_count, InvokeFlag flag);
// On function call, call into the debugger if necessary. // On function call, call into the debugger if necessary.
void CheckDebugHook(Register fun, Register new_target, void CheckDebugHook(Register fun, Register new_target,
const ParameterCount& expected, Register expected_parameter_count,
const ParameterCount& actual); Register actual_parameter_count);
// Invoke the JavaScript function in the given register. Changes the // Invoke the JavaScript function in the given register. Changes the
// current context to the context in the function before invoking. // current context to the context in the function before invoking.
void InvokeFunction(Register function, Register new_target, void InvokeFunctionWithNewTarget(Register function, Register new_target,
const ParameterCount& actual, InvokeFlag flag); Register actual_parameter_count,
InvokeFlag flag);
void InvokeFunction(Register function, const ParameterCount& expected, void InvokeFunction(Register function, Register expected_parameter_count,
const ParameterCount& actual, InvokeFlag flag); Register actual_parameter_count, InvokeFlag flag);
// Frame restart support. // Frame restart support.
void MaybeDropFrames(); void MaybeDropFrames();
...@@ -1114,9 +1115,9 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler { ...@@ -1114,9 +1115,9 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
private: private:
// Helper functions for generating invokes. // Helper functions for generating invokes.
void InvokePrologue(const ParameterCount& expected, void InvokePrologue(Register expected_parameter_count,
const ParameterCount& actual, Label* done, Register actual_parameter_count, Label* done,
bool* definitely_mismatches, InvokeFlag flag); InvokeFlag flag);
// Compute memory operands for safepoint stack slots. // Compute memory operands for safepoint stack slots.
static int SafepointRegisterStackIndex(int reg_code); static int SafepointRegisterStackIndex(int reg_code);
......
...@@ -466,11 +466,11 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { ...@@ -466,11 +466,11 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// Removes current frame and its arguments from the stack preserving // Removes current frame and its arguments from the stack preserving
// the arguments and a return address pushed to the stack for the next call. // the arguments and a return address pushed to the stack for the next call.
// Both |callee_args_count| and |caller_args_count_reg| do not include // Both |callee_args_count| and |caller_args_count| do not include
// receiver. |callee_args_count| is not modified, |caller_args_count_reg| // receiver. |callee_args_count| is not modified. |caller_args_count|
// is trashed. // is trashed.
void PrepareForTailCall(const ParameterCount& callee_args_count, void PrepareForTailCall(Register callee_args_count,
Register caller_args_count_reg, Register scratch0, Register caller_args_count, Register scratch0,
Register scratch1); Register scratch1);
int CalculateStackPassedWords(int num_reg_arguments, int CalculateStackPassedWords(int num_reg_arguments,
...@@ -1029,21 +1029,21 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler { ...@@ -1029,21 +1029,21 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
// Invoke the JavaScript function code by either calling or jumping. // Invoke the JavaScript function code by either calling or jumping.
void InvokeFunctionCode(Register function, Register new_target, void InvokeFunctionCode(Register function, Register new_target,
const ParameterCount& expected, Register expected_parameter_count,
const ParameterCount& actual, InvokeFlag flag); Register actual_parameter_count, InvokeFlag flag);
// On function call, call into the debugger if necessary. // On function call, call into the debugger if necessary.
void CheckDebugHook(Register fun, Register new_target, void CheckDebugHook(Register fun, Register new_target,
const ParameterCount& expected, Register expected_parameter_count,
const ParameterCount& actual); Register actual_parameter_count);
// Invoke the JavaScript function in the given register. Changes the // Invoke the JavaScript function in the given register. Changes the
// current context to the context in the function before invoking. // current context to the context in the function before invoking.
void InvokeFunction(Register function, Register new_target, void InvokeFunctionWithNewTarget(Register function, Register new_target,
const ParameterCount& actual, InvokeFlag flag); Register actual_parameter_count,
InvokeFlag flag);
void InvokeFunction(Register function, const ParameterCount& expected, void InvokeFunction(Register function, Register expected_parameter_count,
const ParameterCount& actual, InvokeFlag flag); Register actual_parameter_count, InvokeFlag flag);
// Frame restart support. // Frame restart support.
void MaybeDropFrames(); void MaybeDropFrames();
...@@ -1175,9 +1175,9 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler { ...@@ -1175,9 +1175,9 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
private: private:
// Helper functions for generating invokes. // Helper functions for generating invokes.
void InvokePrologue(const ParameterCount& expected, void InvokePrologue(Register expected_parameter_count,
const ParameterCount& actual, Label* done, Register actual_parameter_count, Label* done,
bool* definitely_mismatches, InvokeFlag flag); InvokeFlag flag);
// Compute memory operands for safepoint stack slots. // Compute memory operands for safepoint stack slots.
static int SafepointRegisterStackIndex(int reg_code); static int SafepointRegisterStackIndex(int reg_code);
......
...@@ -557,9 +557,7 @@ void CodeGenerator::AssemblePopArgumentsAdaptorFrame(Register args_reg, ...@@ -557,9 +557,7 @@ void CodeGenerator::AssemblePopArgumentsAdaptorFrame(Register args_reg,
MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset));
__ SmiUntag(caller_args_count_reg); __ SmiUntag(caller_args_count_reg);
ParameterCount callee_args_count(args_reg); __ PrepareForTailCall(args_reg, caller_args_count_reg, scratch2, scratch3);
__ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2,
scratch3);
__ bind(&done); __ bind(&done);
} }
......
...@@ -528,9 +528,7 @@ void CodeGenerator::AssemblePopArgumentsAdaptorFrame(Register args_reg, ...@@ -528,9 +528,7 @@ void CodeGenerator::AssemblePopArgumentsAdaptorFrame(Register args_reg,
MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset));
__ SmiUntag(caller_args_count_reg); __ SmiUntag(caller_args_count_reg);
ParameterCount callee_args_count(args_reg); __ PrepareForTailCall(args_reg, caller_args_count_reg, scratch2, scratch3);
__ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2,
scratch3);
__ bind(&done); __ bind(&done);
} }
......
...@@ -43,9 +43,7 @@ void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) { ...@@ -43,9 +43,7 @@ void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) {
FieldMemOperand(a0, SharedFunctionInfo::kFormalParameterCountOffset)); FieldMemOperand(a0, SharedFunctionInfo::kFormalParameterCountOffset));
__ mov(a2, a0); __ mov(a2, a0);
ParameterCount dummy1(a2); __ InvokeFunction(a1, a2, a0, JUMP_FUNCTION);
ParameterCount dummy2(a0);
__ InvokeFunction(a1, dummy1, dummy2, JUMP_FUNCTION);
} }
......
...@@ -43,9 +43,7 @@ void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) { ...@@ -43,9 +43,7 @@ void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) {
FieldMemOperand(a0, SharedFunctionInfo::kFormalParameterCountOffset)); FieldMemOperand(a0, SharedFunctionInfo::kFormalParameterCountOffset));
__ mov(a2, a0); __ mov(a2, a0);
ParameterCount dummy1(a2); __ InvokeFunction(a1, a2, a0, JUMP_FUNCTION);
ParameterCount dummy2(a0);
__ InvokeFunction(a1, dummy1, dummy2, JUMP_FUNCTION);
} }
......
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