Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 75fbfaa3238f9597ec0cb28dfbc7432ea3895c19..f6efdde10497c33457ff3b2f7e0cd088d201fdd7 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -1429,6 +1429,7 @@ static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector, |
} |
void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
+ // eax - number of arguments |
// edi - function |
// edx - slot id |
// ebx - vector |
@@ -1436,7 +1437,6 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
__ cmp(edi, ecx); |
__ j(not_equal, miss); |
- __ mov(eax, arg_count()); |
// Reload ecx. |
__ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
FixedArray::kHeaderSize)); |
@@ -1454,13 +1454,12 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
void CallICStub::Generate(MacroAssembler* masm) { |
+ // edi - number of arguments |
// edi - function |
// edx - slot id |
// ebx - vector |
Isolate* isolate = masm->isolate(); |
Label extra_checks_or_miss, call, call_function, call_count_incremented; |
- int argc = arg_count(); |
- ParameterCount actual(argc); |
// The checks. First, does edi match the recorded monomorphic target? |
__ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
@@ -1492,7 +1491,6 @@ void CallICStub::Generate(MacroAssembler* masm) { |
// Increment the call count for monomorphic function calls. |
IncrementCallCount(masm, ebx, edx); |
- __ Set(eax, argc); |
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), |
tail_call_mode()), |
RelocInfo::CODE_TARGET); |
@@ -1538,7 +1536,6 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ bind(&call_count_incremented); |
- __ Set(eax, argc); |
__ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), |
RelocInfo::CODE_TARGET); |
@@ -1564,12 +1561,15 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ j(not_equal, &miss); |
// Store the function. Use a stub since we need a frame for allocation. |
+ // eax - number of arguments |
// ebx - vector |
// edx - slot |
// edi - function |
{ |
FrameScope scope(masm, StackFrame::INTERNAL); |
CreateWeakCellStub create_stub(isolate); |
+ __ SmiTag(eax); |
+ __ push(eax); |
__ push(ebx); |
__ push(edx); |
__ push(edi); |
@@ -1579,6 +1579,8 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ pop(edi); |
__ pop(edx); |
__ pop(ebx); |
+ __ pop(eax); |
+ __ SmiUntag(eax); |
} |
__ jmp(&call_function); |
@@ -1598,6 +1600,10 @@ void CallICStub::Generate(MacroAssembler* masm) { |
void CallICStub::GenerateMiss(MacroAssembler* masm) { |
FrameScope scope(masm, StackFrame::INTERNAL); |
+ // Preserve the number of arguments. |
+ __ SmiTag(eax); |
+ __ push(eax); |
+ |
// Push the function and feedback info. |
__ push(edi); |
__ push(ebx); |
@@ -1608,6 +1614,10 @@ void CallICStub::GenerateMiss(MacroAssembler* masm) { |
// Move result to edi and exit the internal frame. |
__ mov(edi, eax); |
+ |
+ // Restore number of arguments. |
+ __ pop(eax); |
+ __ SmiUntag(eax); |
} |