Commit af09a9b0 authored by Victor Gomes's avatar Victor Gomes Committed by Commit Bot

[builtins][arm] Reverse JS arguments for arm

Change-Id: Idbb678e3fd8491c3568ddf7084f969368ac527cc
Bug: v8:10201
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2139582
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67444}
parent 1bcac785
This diff is collapsed.
......@@ -427,6 +427,35 @@ void TurboAssembler::Push(Smi smi) {
push(scratch);
}
void TurboAssembler::PushArray(Register array, Register size, Register scratch,
PushArrayOrder order) {
UseScratchRegisterScope temps(this);
Register counter = scratch;
Register tmp = temps.Acquire();
DCHECK(!AreAliased(array, size, counter, tmp));
Label loop, entry;
if (order == PushArrayOrder::kReverse) {
mov(counter, Operand(0));
b(&entry);
bind(&loop);
ldr(tmp, MemOperand(array, counter, LSL, kSystemPointerSizeLog2));
push(tmp);
add(counter, counter, Operand(1));
bind(&entry);
cmp(counter, size);
b(lt, &loop);
} else {
mov(counter, size);
b(&entry);
bind(&loop);
ldr(tmp, MemOperand(array, counter, LSL, kSystemPointerSizeLog2));
push(tmp);
bind(&entry);
sub(counter, counter, Operand(1), SetCC);
b(ge, &loop);
}
}
void TurboAssembler::Move(Register dst, Smi smi) { mov(dst, Operand(smi)); }
void TurboAssembler::Move(Register dst, Handle<HeapObject> value) {
......@@ -1556,7 +1585,7 @@ void MacroAssembler::CallDebugOnFunctionCall(Register fun, Register new_target,
Register expected_parameter_count,
Register actual_parameter_count) {
// Load receiver to pass it later to DebugOnFunctionCall hook.
ldr(r4, MemOperand(sp, actual_parameter_count, LSL, kPointerSizeLog2));
ldr(r4, ReceiverOperand(actual_parameter_count));
FrameScope frame(this, has_frame() ? StackFrame::NONE : StackFrame::INTERNAL);
SmiTag(expected_parameter_count);
......
......@@ -156,6 +156,12 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
}
}
enum class PushArrayOrder { kNormal, kReverse };
// `array` points to the first element (the lowest address).
// `array` and `size` are not modified.
void PushArray(Register array, Register size, Register scratch,
PushArrayOrder order = PushArrayOrder::kNormal);
void Pop(Register dst) { pop(dst); }
// Pop two registers. Pops rightmost register first (from lower address).
......@@ -720,6 +726,18 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
void JumpIfIsInRange(Register value, unsigned lower_limit,
unsigned higher_limit, Label* on_in_range);
// 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.
MemOperand ReceiverOperand(Register argc) {
#ifdef V8_REVERSE_JSARGS
return MemOperand(sp, 0);
#else
return MemOperand(sp, argc, LSL, kSystemPointerSizeLog2);
#endif
}
// ---------------------------------------------------------------------------
// Runtime calls
......
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