Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index 8adff9a1b20728ab5ffe4f76a5a37b0cbb75d502..f890d84ca79f77e7ce1943ecf6fc83a5cc46e10b 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -1329,7 +1329,6 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
__ movp(rbx, rcx); |
__ movp(rdx, rdi); |
- __ Set(rax, arg_count()); |
ArrayConstructorStub stub(masm->isolate()); |
__ TailCallStub(&stub); |
} |
@@ -1337,15 +1336,13 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
void CallICStub::Generate(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
+ // -- rax - number of arguments |
// -- rdi - function |
// -- rdx - slot id |
// -- rbx - vector |
// ----------------------------------- |
Isolate* isolate = masm->isolate(); |
Label extra_checks_or_miss, call, call_function, call_count_incremented; |
- int argc = arg_count(); |
- StackArgumentsAccessor args(rsp, argc); |
- ParameterCount actual(argc); |
// The checks. First, does rdi match the recorded monomorphic target? |
__ SmiToInteger32(rdx, rdx); |
@@ -1377,7 +1374,6 @@ void CallICStub::Generate(MacroAssembler* masm) { |
// Increment the call count for monomorphic function calls. |
IncrementCallCount(masm, rbx, rdx); |
- __ Set(rax, argc); |
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), |
tail_call_mode()), |
RelocInfo::CODE_TARGET); |
@@ -1421,7 +1417,6 @@ void CallICStub::Generate(MacroAssembler* masm) { |
IncrementCallCount(masm, rbx, rdx); |
__ bind(&call_count_incremented); |
- __ Set(rax, argc); |
__ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), |
RelocInfo::CODE_TARGET); |
@@ -1454,7 +1449,9 @@ void CallICStub::Generate(MacroAssembler* masm) { |
FrameScope scope(masm, StackFrame::INTERNAL); |
CreateWeakCellStub create_stub(isolate); |
+ __ Integer32ToSmi(rax, rax); |
__ Integer32ToSmi(rdx, rdx); |
+ __ Push(rax); |
__ Push(rbx); |
__ Push(rdx); |
__ Push(rdi); |
@@ -1464,7 +1461,9 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ Pop(rdi); |
__ Pop(rdx); |
__ Pop(rbx); |
+ __ Pop(rax); |
__ SmiToInteger32(rdx, rdx); |
+ __ SmiToInteger32(rax, rax); |
} |
__ jmp(&call_function); |
@@ -1483,6 +1482,10 @@ void CallICStub::Generate(MacroAssembler* masm) { |
void CallICStub::GenerateMiss(MacroAssembler* masm) { |
FrameScope scope(masm, StackFrame::INTERNAL); |
+ // Preserve the number of arguments. |
+ __ Integer32ToSmi(rax, rax); |
+ __ Push(rax); |
+ |
// Push the receiver and the function and feedback info. |
__ Integer32ToSmi(rdx, rdx); |
__ Push(rdi); |
@@ -1494,6 +1497,10 @@ void CallICStub::GenerateMiss(MacroAssembler* masm) { |
// Move result to edi and exit the internal frame. |
__ movp(rdi, rax); |
+ |
+ // Restore number of arguments. |
+ __ Pop(rax); |
+ __ SmiToInteger32(rax, rax); |
} |
bool CEntryStub::NeedsImmovableCode() { |