Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 9f639f91fcaf6abb550c7a90ddeb5fe1d0dc26f2..1049344ece9ee94e3275bc627a6da599c00a2a2b 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -1898,11 +1898,11 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
// edi - function |
// edx - slot id |
// ebx - vector |
+ // eax - number of arguments - if argc_in_register() is true. |
__ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
__ cmp(edi, ecx); |
__ j(not_equal, miss); |
- __ mov(eax, arg_count()); |
// Reload ecx. |
__ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
FixedArray::kHeaderSize)); |
@@ -1914,9 +1914,13 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
__ mov(ebx, ecx); |
__ mov(edx, edi); |
- ArrayConstructorStub stub(masm->isolate(), arg_count()); |
- __ TailCallStub(&stub); |
- |
+ if (argc_in_register()) { |
+ ArrayConstructorStub stub(masm->isolate()); |
+ __ TailCallStub(&stub); |
+ } else { |
+ ArrayConstructorStub stub(masm->isolate(), arg_count()); |
mvstanton
2016/02/15 11:13:45
Okay, so you are sure ArrayConstructorStub doesn't
mythria
2016/02/17 11:02:48
Actually, it expects in eax if arg_count() >= 2. I
|
+ __ TailCallStub(&stub); |
+ } |
// Unreachable. |
} |
@@ -1925,10 +1929,13 @@ void CallICStub::Generate(MacroAssembler* masm) { |
// edi - function |
// edx - slot id |
// ebx - vector |
+ // eax - number of arguments - if argc_in_register() is true. |
Isolate* isolate = masm->isolate(); |
Label extra_checks_or_miss, call, call_function; |
- int argc = arg_count(); |
- ParameterCount actual(argc); |
+ if (!argc_in_register()) { |
+ int argc = arg_count(); |
+ __ Set(eax, argc); |
+ } |
// The checks. First, does edi match the recorded monomorphic target? |
__ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
@@ -1961,7 +1968,6 @@ void CallICStub::Generate(MacroAssembler* masm) { |
Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
__ bind(&call_function); |
- __ Set(eax, argc); |
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), |
tail_call_mode()), |
RelocInfo::CODE_TARGET); |
@@ -2001,7 +2007,6 @@ void CallICStub::Generate(MacroAssembler* masm) { |
Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); |
__ bind(&call); |
- __ Set(eax, argc); |
__ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), |
RelocInfo::CODE_TARGET); |
@@ -2038,9 +2043,15 @@ void CallICStub::Generate(MacroAssembler* masm) { |
{ |
FrameScope scope(masm, StackFrame::INTERNAL); |
CreateWeakCellStub create_stub(isolate); |
+ __ SmiTag(eax); |
+ __ push(eax); |
__ push(edi); |
+ |
__ CallStub(&create_stub); |
+ |
__ pop(edi); |
+ __ pop(eax); |
+ __ SmiUntag(eax); |
} |
__ jmp(&call_function); |
@@ -2060,6 +2071,9 @@ void CallICStub::Generate(MacroAssembler* masm) { |
void CallICStub::GenerateMiss(MacroAssembler* masm) { |
FrameScope scope(masm, StackFrame::INTERNAL); |
+ // Store eax since we need it later. |
+ __ SmiTag(eax); |
+ __ push(eax); |
// Push the function and feedback info. |
__ push(edi); |
__ push(ebx); |
@@ -2070,6 +2084,10 @@ void CallICStub::GenerateMiss(MacroAssembler* masm) { |
// Move result to edi and exit the internal frame. |
__ mov(edi, eax); |
+ |
+ // Restore eax. |
+ __ pop(eax); |
+ __ SmiUntag(eax); |
} |