Commit c73ca67b authored by Yu Yin's avatar Yu Yin Committed by Commit Bot

[mips64] Implement reverse js arg

Bug: v8:10201
Change-Id: I313405983696546b817c96a820343e6cb9e3fdd4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2408977Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Yu Yin <xwafish@gmail.com>
Cr-Commit-Position: refs/heads/master@{#69926}
parent 3a375798
This diff is collapsed.
......@@ -4489,6 +4489,33 @@ void TurboAssembler::Push(Handle<HeapObject> handle) {
push(scratch);
}
void TurboAssembler::PushArray(Register array, Register size, Register scratch,
Register scratch2, PushArrayOrder order) {
DCHECK(!AreAliased(array, size, scratch, scratch2));
Label loop, entry;
if (order == PushArrayOrder::kReverse) {
mov(scratch, zero_reg);
jmp(&entry);
bind(&loop);
Dlsa(scratch2, array, scratch, kPointerSizeLog2);
Ld(scratch2, MemOperand(scratch2));
push(scratch2);
Daddu(scratch, scratch, Operand(1));
bind(&entry);
Branch(&loop, less, scratch, Operand(size));
} else {
mov(scratch, size);
jmp(&entry);
bind(&loop);
Dlsa(scratch2, array, scratch, kPointerSizeLog2);
Ld(scratch2, MemOperand(scratch2));
push(scratch2);
bind(&entry);
Daddu(scratch, scratch, Operand(-1));
Branch(&loop, greater_equal, scratch, Operand(zero_reg));
}
}
void MacroAssembler::MaybeDropFrames() {
// Check whether we need to drop frames to restart a function on the stack.
li(a1, ExternalReference::debug_restart_fp_address(isolate()));
......@@ -4697,8 +4724,8 @@ void MacroAssembler::CheckDebugHook(Register fun, Register new_target,
{
// Load receiver to pass it later to DebugOnFunctionCall hook.
Dlsa(t0, sp, actual_parameter_count, kPointerSizeLog2);
Ld(t0, MemOperand(t0));
LoadReceiver(t0, actual_parameter_count);
FrameScope frame(this,
has_frame() ? StackFrame::NONE : StackFrame::INTERNAL);
SmiTag(expected_parameter_count);
......
......@@ -334,6 +334,10 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
Sd(src, MemOperand(sp, 0));
}
enum PushArrayOrder { kNormal, kReverse };
void PushArray(Register array, Register size, Register scratch,
Register scratch2, PushArrayOrder order = kNormal);
void SaveRegisters(RegList registers);
void RestoreRegisters(RegList registers);
......@@ -909,6 +913,28 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public:
using TurboAssembler::TurboAssembler;
// It assumes that the arguments are located below the stack pointer.
// argc is the number of arguments not including the receiver.
// TODO(victorgomes): Remove this function once we stick with the reversed
// arguments order.
void LoadReceiver(Register dest, Register argc) {
#ifdef V8_REVERSE_JSARGS
Ld(dest, MemOperand(sp, 0));
#else
Dlsa(dest, sp, argc, kPointerSizeLog2);
Ld(dest, MemOperand(dest, 0));
#endif
}
void StoreReceiver(Register rec, Register argc, Register scratch) {
#ifdef V8_REVERSE_JSARGS
Sd(rec, MemOperand(sp, 0));
#else
Dlsa(scratch, sp, argc, kPointerSizeLog2);
Sd(rec, MemOperand(scratch, 0));
#endif
}
bool IsNear(Label* L, Condition cond, int rs_reg);
// Swap two registers. If the scratch register is omitted then a slightly
......
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