Commit 5ef75b8c authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

s390: implement V8_REVERSE_JSARGS

Bug: v8:10201
Change-Id: Ia0c89a02840b2b29afe41f8eedd423c4d635c61f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2319646Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69542}
parent d3d8d71f
This diff is collapsed.
......@@ -379,6 +379,37 @@ void TurboAssembler::BranchRelativeOnIdxHighP(Register dst, Register inc,
#endif // V8_TARGET_ARCH_S390X
}
void TurboAssembler::PushArray(Register array, Register size, Register scratch,
Register scratch2, PushArrayOrder order) {
Label loop, done;
if (order == kNormal) {
ShiftLeftP(scratch, size, Operand(kSystemPointerSizeLog2));
lay(scratch, MemOperand(array, scratch));
bind(&loop);
CmpP(array, scratch);
bge(&done);
lay(scratch, MemOperand(scratch, -kSystemPointerSize));
lay(sp, MemOperand(sp, -kSystemPointerSize));
MoveChar(MemOperand(sp), MemOperand(scratch), Operand(kSystemPointerSize));
b(&loop);
bind(&done);
} else {
DCHECK_NE(scratch2, r0);
ShiftLeftP(scratch, size, Operand(kSystemPointerSizeLog2));
lay(scratch, MemOperand(array, scratch));
LoadRR(scratch2, array);
bind(&loop);
CmpP(scratch2, scratch);
bge(&done);
lay(sp, MemOperand(sp, -kSystemPointerSize));
MoveChar(MemOperand(sp), MemOperand(scratch2), Operand(kSystemPointerSize));
lay(scratch2, MemOperand(scratch2, kSystemPointerSize));
b(&loop);
bind(&done);
}
}
void TurboAssembler::MultiPush(RegList regs, Register location) {
int16_t num_to_push = base::bits::CountPopulation(regs);
int16_t stack_offset = num_to_push * kSystemPointerSize;
......@@ -1379,8 +1410,7 @@ void MacroAssembler::CheckDebugHook(Register fun, Register new_target,
{
// Load receiver to pass it later to DebugOnFunctionCall hook.
ShiftLeftP(r6, actual_parameter_count, Operand(kSystemPointerSizeLog2));
LoadP(r6, MemOperand(sp, r6));
LoadReceiver(r6, actual_parameter_count);
FrameScope frame(this,
has_frame() ? StackFrame::NONE : StackFrame::INTERNAL);
......
......@@ -592,6 +592,10 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
StoreP(src5, MemOperand(sp, 0));
}
enum PushArrayOrder { kNormal, kReverse };
void PushArray(Register array, Register size, Register scratch,
Register scratch2, PushArrayOrder order = kNormal);
void Pop(Register dst) { pop(dst); }
// Pop two registers. Pops rightmost register first (from lower address).
......@@ -1063,6 +1067,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
LoadP(dest, MemOperand(sp, 0));
#else
ShiftLeftP(dest, argc, Operand(kSystemPointerSizeLog2));
LoadP(dest, MemOperand(sp, dest));
#endif
}
void StoreReceiver(Register rec, Register argc, Register scratch) {
#ifdef V8_REVERSE_JSARGS
StoreP(rec, MemOperand(sp, 0));
#else
ShiftLeftP(scratch, argc, Operand(kSystemPointerSizeLog2));
StoreP(rec, MemOperand(sp, scratch));
#endif
}
void CallRuntime(const Runtime::Function* f, int num_arguments,
SaveFPRegsMode save_doubles = kDontSaveFPRegs);
void CallRuntimeSaveDoubles(Runtime::FunctionId fid) {
......
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