[loong64][mips64] Drop unnecessary MacroAssembler::kCountIncludesReceiver

Port commit 492a1d8e2a

Change-Id: Ie34ec734bb921e8c6f7bc5252fe1f47475d80b2c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5606549
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/main@{#94371}
This commit is contained in:
Zhao Jiazhong authored and V8 LUCI CQ committed 2024-06-11 12:42:52 +00:00
1 parent be4d52e12f
commit 8b4dc9f062
8 files changed
+30 -62

No files matched your search

@@ -559,9 +559,8 @@ void BaselineAssembler::EmitReturn(MacroAssembler* masm) {
// Leave the frame (also dropping the register file).
__ masm()->LeaveFrame(StackFrame::BASELINE);
// Drop receiver + arguments.
__ masm()
-> DropArguments(params_size, MacroAssembler::kCountIncludesReceiver);
// Drop arguments.
__ masm()->DropArguments(params_size);
__ masm()->Ret();
}
@@ -557,9 +557,8 @@ void BaselineAssembler::EmitReturn(MacroAssembler* masm) {
// Leave the frame (also dropping the register file).
__ masm()->LeaveFrame(StackFrame::BASELINE);
// Drop receiver + arguments.
__ masm()
-> DropArguments(params_size, MacroAssembler::kCountIncludesReceiver);
// Drop arguments.
__ masm()->DropArguments(params_size);
__ masm()->Ret();
}
+7 -10
View File
@@ -110,7 +110,7 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
}
// Remove caller arguments from the stack and return.
__ DropArguments(t3, MacroAssembler::kCountIncludesReceiver);
__ DropArguments(t3);
__ Ret();
}
@@ -250,7 +250,7 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
__ LeaveFrame(StackFrame::CONSTRUCT);
// Remove caller arguments from the stack and return.
__ DropArguments(a1, MacroAssembler::kCountIncludesReceiver);
__ DropArguments(a1);
__ Ret();
__ bind(&check_receiver);
@@ -845,8 +845,8 @@ static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch1,
// Leave the frame (also dropping the register file).
__ LeaveFrame(StackFrame::INTERPRETED);
// Drop receiver + arguments.
__ DropArguments(params_size, MacroAssembler::kCountIncludesReceiver);
// Drop arguments.
__ DropArguments(params_size);
}
// Advance the current bytecode offset. This simulates what all bytecode
@@ -2048,8 +2048,7 @@ void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
__ Sub_d(scratch, scratch, Operand(1));
__ Movz(arg_array, undefined_value, scratch); // if argc == 1
__ Ld_d(receiver, MemOperand(sp, 0));
__ DropArgumentsAndPushNewReceiver(argc, this_arg,
MacroAssembler::kCountIncludesReceiver);
__ DropArgumentsAndPushNewReceiver(argc, this_arg);
}
// ----------- S t a t e -------------
@@ -2143,8 +2142,7 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
__ Sub_d(scratch, scratch, Operand(1));
__ Movz(arguments_list, undefined_value, scratch); // if argc == 2
__ DropArgumentsAndPushNewReceiver(argc, this_argument,
MacroAssembler::kCountIncludesReceiver);
__ DropArgumentsAndPushNewReceiver(argc, this_argument);
}
// ----------- S t a t e -------------
@@ -2201,8 +2199,7 @@ void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) {
__ Sub_d(scratch, scratch, Operand(1));
__ Movz(new_target, target, scratch); // if argc == 2
__ DropArgumentsAndPushNewReceiver(argc, undefined_value,
MacroAssembler::kCountIncludesReceiver);
__ DropArgumentsAndPushNewReceiver(argc, undefined_value);
}
// ----------- S t a t e -------------
+7 -10
View File
@@ -110,7 +110,7 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
}
// Remove caller arguments from the stack and return.
__ DropArguments(t3, MacroAssembler::kCountIncludesReceiver);
__ DropArguments(t3);
__ Ret();
}
@@ -248,7 +248,7 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
__ LeaveFrame(StackFrame::CONSTRUCT);
// Remove caller arguments from the stack and return.
__ DropArguments(a1, MacroAssembler::kCountIncludesReceiver);
__ DropArguments(a1);
__ Ret();
__ bind(&check_receiver);
@@ -797,8 +797,8 @@ static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch1,
// Leave the frame (also dropping the register file).
__ LeaveFrame(StackFrame::INTERPRETED);
// Drop receiver + arguments.
__ DropArguments(params_size, MacroAssembler::kCountIncludesReceiver);
// Drop arguments.
__ DropArguments(params_size);
}
// Advance the current bytecode offset. This simulates what all bytecode
@@ -1982,8 +1982,7 @@ void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
__ Dsubu(scratch, scratch, Operand(1));
__ Movz(arg_array, undefined_value, scratch); // if argc == 1
__ Ld(receiver, MemOperand(sp));
__ DropArgumentsAndPushNewReceiver(argc, this_arg,
MacroAssembler::kCountIncludesReceiver);
__ DropArgumentsAndPushNewReceiver(argc, this_arg);
}
// ----------- S t a t e -------------
@@ -2077,8 +2076,7 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
__ Dsubu(scratch, scratch, Operand(1));
__ Movz(arguments_list, undefined_value, scratch); // if argc == 2
__ DropArgumentsAndPushNewReceiver(argc, this_argument,
MacroAssembler::kCountIncludesReceiver);
__ DropArgumentsAndPushNewReceiver(argc, this_argument);
}
// ----------- S t a t e -------------
@@ -2135,8 +2133,7 @@ void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) {
__ Dsubu(scratch, scratch, Operand(1));
__ Movz(new_target, target, scratch); // if argc == 2
__ DropArgumentsAndPushNewReceiver(argc, undefined_value,
MacroAssembler::kCountIncludesReceiver);
__ DropArgumentsAndPushNewReceiver(argc, undefined_value);
}
// ----------- S t a t e -------------
+4 -14
View File
@@ -3143,25 +3143,15 @@ void MacroAssembler::StoreReturnAddressAndCall(Register target) {
DCHECK_EQ(kNumInstructionsToJump, InstructionsGeneratedSince(&find_ra));
}
void MacroAssembler::DropArguments(Register count, ArgumentsCountMode mode) {
void MacroAssembler::DropArguments(Register count) {
Alsl_d(sp, count, sp, kSystemPointerSizeLog2);
if (mode == kCountExcludesReceiver) {
Add_d(sp, sp, kSystemPointerSize);
}
}
void MacroAssembler::DropArgumentsAndPushNewReceiver(Register argc,
Register receiver,
ArgumentsCountMode mode) {
Register receiver) {
DCHECK(!AreAliased(argc, receiver));
if (mode == kCountExcludesReceiver) {
// Drop arguments without receiver and override old receiver.
DropArguments(argc, kCountIncludesReceiver);
St_d(receiver, MemOperand(sp, 0));
} else {
DropArguments(argc, mode);
Push(receiver);
}
DropArguments(argc);
Push(receiver);
}
void MacroAssembler::Ret(Condition cond, Register rj, const Operand& rk) {
@@ -250,10 +250,8 @@ class V8_EXPORT_PRIVATE MacroAssembler : public MacroAssemblerBase {
void Drop(int count, Condition cond = cc_always, Register reg = no_reg,
const Operand& op = Operand(no_reg));
enum ArgumentsCountMode { kCountIncludesReceiver, kCountExcludesReceiver };
void DropArguments(Register count, ArgumentsCountMode mode);
void DropArgumentsAndPushNewReceiver(Register argc, Register receiver,
ArgumentsCountMode mode);
void DropArguments(Register count);
void DropArgumentsAndPushNewReceiver(Register argc, Register receiver);
void Ld_d(Register rd, const MemOperand& rj);
void St_d(Register rd, const MemOperand& rj);
+4 -14
View File
@@ -4615,25 +4615,15 @@ void MacroAssembler::BranchAndLinkLong(Label* L, BranchDelaySlot bdslot) {
}
}
void MacroAssembler::DropArguments(Register count, ArgumentsCountMode mode) {
void MacroAssembler::DropArguments(Register count) {
Dlsa(sp, sp, count, kPointerSizeLog2);
if (mode == kCountExcludesReceiver) {
Daddu(sp, sp, kSystemPointerSize);
}
}
void MacroAssembler::DropArgumentsAndPushNewReceiver(Register argc,
Register receiver,
ArgumentsCountMode mode) {
Register receiver) {
DCHECK(!AreAliased(argc, receiver));
if (mode == kCountExcludesReceiver) {
// Drop arguments without receiver and override old receiver.
DropArguments(argc, kCountIncludesReceiver);
Sd(receiver, MemOperand(sp));
} else {
DropArguments(argc, mode);
push(receiver);
}
DropArguments(argc);
push(receiver);
}
void MacroAssembler::DropAndRet(int drop) {
+2 -4
View File
@@ -309,10 +309,8 @@ class V8_EXPORT_PRIVATE MacroAssembler : public MacroAssemblerBase {
void Drop(int count, Condition cond = cc_always, Register reg = no_reg,
const Operand& op = Operand(no_reg));
enum ArgumentsCountMode { kCountIncludesReceiver, kCountExcludesReceiver };
void DropArguments(Register count, ArgumentsCountMode mode);
void DropArgumentsAndPushNewReceiver(Register argc, Register receiver,
ArgumentsCountMode mode);
void DropArguments(Register count);
void DropArgumentsAndPushNewReceiver(Register argc, Register receiver);
// Trivial case of DropAndRet that utilizes the delay slot.
void DropAndRet(int drop);