Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index 83a1c779aebc18044e8e79c9ba8780109994c7ef..7734ad0d70e6512bcd16ee4a34a43b118320e2fe 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -1757,7 +1757,9 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
__ cmpp(rdi, r8); |
__ j(not_equal, miss); |
- __ movp(rax, Immediate(arg_count())); |
+ if (!argc_in_register()) { |
+ __ movp(rax, Immediate(arg_count())); |
+ } |
// Increment the call count for monomorphic function calls. |
__ SmiAddConstant(FieldOperand(rbx, rdx, times_pointer_size, |
@@ -1766,8 +1768,13 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
__ movp(rbx, rcx); |
__ movp(rdx, rdi); |
- ArrayConstructorStub stub(masm->isolate(), arg_count()); |
- __ TailCallStub(&stub); |
+ if (!argc_in_register()) { |
rmcilroy
2016/02/12 14:21:03
nit - Swap branches around (avoid ! in condition)
mythria
2016/02/17 11:02:48
Done.
|
+ ArrayConstructorStub stub(masm->isolate(), arg_count()); |
+ __ TailCallStub(&stub); |
+ } else { |
+ ArrayConstructorStub stub(masm->isolate()); |
+ __ TailCallStub(&stub); |
+ } |
} |
@@ -1780,8 +1787,6 @@ void CallICStub::Generate(MacroAssembler* masm) { |
Isolate* isolate = masm->isolate(); |
Label extra_checks_or_miss, call, call_function; |
int argc = arg_count(); |
- StackArgumentsAccessor args(rsp, argc); |
- ParameterCount actual(argc); |
// The checks. First, does rdi match the recorded monomorphic target? |
__ SmiToInteger32(rdx, rdx); |
@@ -1815,7 +1820,9 @@ void CallICStub::Generate(MacroAssembler* masm) { |
Smi::FromInt(CallICNexus::kCallCountIncrement)); |
__ bind(&call_function); |
- __ Set(rax, argc); |
+ if (!argc_in_register()) { |
rmcilroy
2016/02/12 14:21:03
Same comment as ia32
mythria
2016/02/17 11:02:48
Done.
|
+ __ Set(rax, argc); |
+ } |
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), |
tail_call_mode()), |
RelocInfo::CODE_TARGET); |
@@ -1854,7 +1861,9 @@ void CallICStub::Generate(MacroAssembler* masm) { |
TypeFeedbackVector::MegamorphicSentinel(isolate)); |
__ bind(&call); |
- __ Set(rax, argc); |
+ if (!argc_in_register()) { |
+ __ Set(rax, argc); |
+ } |
__ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), |
RelocInfo::CODE_TARGET); |
@@ -1892,10 +1901,18 @@ void CallICStub::Generate(MacroAssembler* masm) { |
FrameScope scope(masm, StackFrame::INTERNAL); |
CreateWeakCellStub create_stub(isolate); |
+ if (argc_in_register()) { |
+ __ Integer32ToSmi(rax, rax); |
+ __ Push(rax); |
+ } |
__ Integer32ToSmi(rdx, rdx); |
__ Push(rdi); |
__ CallStub(&create_stub); |
__ Pop(rdi); |
+ if (argc_in_register()) { |
+ __ Pop(rax); |
+ __ SmiToInteger32(rax, rax); |
+ } |
} |
__ jmp(&call_function); |
@@ -1915,6 +1932,12 @@ void CallICStub::Generate(MacroAssembler* masm) { |
void CallICStub::GenerateMiss(MacroAssembler* masm) { |
FrameScope scope(masm, StackFrame::INTERNAL); |
+ // Store the number of arguments to be used later. |
+ if (argc_in_register()) { |
+ __ Integer32ToSmi(rax, rax); |
+ __ Push(rax); |
+ } |
+ |
// Push the receiver and the function and feedback info. |
__ Push(rdi); |
__ Push(rbx); |
@@ -1926,6 +1949,12 @@ void CallICStub::GenerateMiss(MacroAssembler* masm) { |
// Move result to edi and exit the internal frame. |
__ movp(rdi, rax); |
+ if (argc_in_register()) { |
+ // rdi, rbx, rdx are arguments to CallIC_Miss. They will be popped by |
+ // Runtime_CallIC_Miss. |
+ __ Pop(rax); |
+ __ SmiToInteger32(rax, rax); |
+ } |
} |