| Index: src/x64/builtins-x64.cc
|
| diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc
|
| index 03f6fa2fd545ae565588ef65a76f7ef44ab47854..2e3adb73c566612247f73c3a1fa62c6ebac6623f 100644
|
| --- a/src/x64/builtins-x64.cc
|
| +++ b/src/x64/builtins-x64.cc
|
| @@ -785,21 +785,21 @@ void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
|
| }
|
|
|
|
|
| -// static
|
| -void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
|
| +static void Generate_InterpreterPushArgs(MacroAssembler* masm,
|
| + bool push_receiver) {
|
| // ----------- S t a t e -------------
|
| // -- rax : the number of arguments (not including the receiver)
|
| // -- rbx : the address of the first argument to be pushed. Subsequent
|
| // arguments should be consecutive above this, in the same order as
|
| // they are to be pushed onto the stack.
|
| - // -- rdi : the target to call (can be any Object).
|
| -
|
| - // Pop return address to allow tail-call after pushing arguments.
|
| - __ Pop(rdx);
|
| + // -----------------------------------
|
|
|
| // Find the address of the last argument.
|
| __ movp(rcx, rax);
|
| - __ addp(rcx, Immediate(1)); // Add one for receiver.
|
| + if (push_receiver) {
|
| + __ addp(rcx, Immediate(1)); // Add one for receiver.
|
| + }
|
| +
|
| __ shlp(rcx, Immediate(kPointerSizeLog2));
|
| __ negp(rcx);
|
| __ addp(rcx, rbx);
|
| @@ -813,13 +813,58 @@ void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
|
| __ bind(&loop_check);
|
| __ cmpp(rbx, rcx);
|
| __ j(greater, &loop_header, Label::kNear);
|
| +}
|
| +
|
| +
|
| +// static
|
| +void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
|
| + // ----------- S t a t e -------------
|
| + // -- rax : the number of arguments (not including the receiver)
|
| + // -- rbx : the address of the first argument to be pushed. Subsequent
|
| + // arguments should be consecutive above this, in the same order as
|
| + // they are to be pushed onto the stack.
|
| + // -- rdi : the target to call (can be any Object).
|
| + // -----------------------------------
|
| +
|
| + // Pop return address to allow tail-call after pushing arguments.
|
| + __ PopReturnAddressTo(kScratchRegister);
|
| +
|
| + Generate_InterpreterPushArgs(masm, true);
|
|
|
| // Call the target.
|
| - __ Push(rdx); // Re-push return address.
|
| + __ PushReturnAddressFrom(kScratchRegister); // Re-push return address.
|
| __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
| }
|
|
|
|
|
| +// static
|
| +void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
|
| + // ----------- S t a t e -------------
|
| + // -- rax : the number of arguments (not including the receiver)
|
| + // -- rdx : the original constructor (either the same as the constructor or
|
| + // the JSFunction on which new was invoked initially)
|
| + // -- rdi : the constructor to call (can be any Object)
|
| + // -- rbx : the address of the first argument to be pushed. Subsequent
|
| + // arguments should be consecutive above this, in the same order as
|
| + // they are to be pushed onto the stack.
|
| + // -----------------------------------
|
| +
|
| + // Pop return address to allow tail-call after pushing arguments.
|
| + __ PopReturnAddressTo(kScratchRegister);
|
| +
|
| + // Push slot for the receiver to be constructed.
|
| + __ Push(Immediate(0));
|
| +
|
| + Generate_InterpreterPushArgs(masm, false);
|
| +
|
| + // Push return address in preparation for the tail-call.
|
| + __ PushReturnAddressFrom(kScratchRegister);
|
| +
|
| + // Call the constructor (rax, rdx, rdi passed on).
|
| + __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
|
| +}
|
| +
|
| +
|
| void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
| CallRuntimePassFunction(masm, Runtime::kCompileLazy);
|
| GenerateTailCallToReturnedCode(masm);
|
|
|