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