Index: src/builtins/x64/builtins-x64.cc |
diff --git a/src/builtins/x64/builtins-x64.cc b/src/builtins/x64/builtins-x64.cc |
index daedb5f960b5fd705d77022a0615e3cd41868419..d7bc75fcb3fa7688b7f32c5d5d2a9d2bd7c1ae4a 100644 |
--- a/src/builtins/x64/builtins-x64.cc |
+++ b/src/builtins/x64/builtins-x64.cc |
@@ -778,9 +778,7 @@ |
} |
static void Generate_InterpreterPushArgs(MacroAssembler* masm, |
- Register num_args, |
- Register start_address, |
- Register scratch, bool push_receiver) { |
+ 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 |
@@ -789,23 +787,23 @@ |
// ----------------------------------- |
// Find the address of the last argument. |
- __ movp(scratch, num_args); |
+ __ movp(rcx, rax); |
if (push_receiver) { |
- __ addp(scratch, Immediate(1)); // Add one for receiver. |
- } |
- |
- __ shlp(scratch, Immediate(kPointerSizeLog2)); |
- __ negp(scratch); |
- __ addp(scratch, start_address); |
+ __ addp(rcx, Immediate(1)); // Add one for receiver. |
+ } |
+ |
+ __ shlp(rcx, Immediate(kPointerSizeLog2)); |
+ __ negp(rcx); |
+ __ addp(rcx, rbx); |
// Push the arguments. |
Label loop_header, loop_check; |
__ j(always, &loop_check); |
__ bind(&loop_header); |
- __ Push(Operand(start_address, 0)); |
- __ subp(start_address, Immediate(kPointerSize)); |
+ __ Push(Operand(rbx, 0)); |
+ __ subp(rbx, Immediate(kPointerSize)); |
__ bind(&loop_check); |
- __ cmpp(start_address, scratch); |
+ __ cmpp(rbx, rcx); |
__ j(greater, &loop_header, Label::kNear); |
} |
@@ -824,9 +822,7 @@ |
// Pop return address to allow tail-call after pushing arguments. |
__ PopReturnAddressTo(kScratchRegister); |
- // TODO(mythria): Add a stack check before pushing arguments. |
- // rax is readonly rcx and r8 will be modified. |
- Generate_InterpreterPushArgs(masm, rax, rbx, rcx, true); |
+ Generate_InterpreterPushArgs(masm, true); |
// Call the target. |
__ PushReturnAddressFrom(kScratchRegister); // Re-push return address. |
@@ -844,15 +840,13 @@ |
} |
// static |
-void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
- MacroAssembler* masm, CallableType construct_type) { |
+void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
// -- rax : the number of arguments (not including the receiver) |
// -- rdx : the new target (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 allocation site feedback if available, undefined otherwise |
- // -- rcx : the address of the first argument to be pushed. Subsequent |
+ // -- 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. |
// ----------------------------------- |
@@ -863,29 +857,13 @@ |
// Push slot for the receiver to be constructed. |
__ Push(Immediate(0)); |
- // TODO(mythria): Add a stack check before pushing arguments. |
- // rax is readonly rcx and r8 will be modified. |
- Generate_InterpreterPushArgs(masm, rax, rcx, r8, false); |
+ Generate_InterpreterPushArgs(masm, false); |
// Push return address in preparation for the tail-call. |
__ PushReturnAddressFrom(kScratchRegister); |
- __ AssertUndefinedOrAllocationSite(rbx); |
- if (construct_type == CallableType::kJSFunction) { |
- // Tail call to the function-specific construct stub (still in the caller |
- // context at this point). |
- __ AssertFunction(rdi); |
- |
- __ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
- __ movp(rcx, FieldOperand(rcx, SharedFunctionInfo::kConstructStubOffset)); |
- __ leap(rcx, FieldOperand(rcx, Code::kHeaderSize)); |
- // Jump to the constructor function (rax, rbx, rdx passed on). |
- __ jmp(rcx); |
- } else { |
- DCHECK_EQ(construct_type, CallableType::kAny); |
- // Call the constructor (rax, rdx, rdi passed on). |
- __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
- } |
+ // Call the constructor (rax, rdx, rdi passed on). |
+ __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
} |
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |