Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 208bd91a0db7cc6a74fc879e681a8bece0e930e6..9819ca5ca38ba8f0789441b582d2b63f4926d05d 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -2506,30 +2506,41 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { |
Isolate* isolate = masm->isolate(); |
Label slow, non_function; |
+ // Check that the function really is a JavaScript function. |
+ __ JumpIfSmi(edi, &non_function); |
+ |
// The receiver might implicitly be the global object. This is |
// indicated by passing the hole as the receiver to the call |
// function stub. |
- if (ReceiverMightBeImplicit()) { |
- Label receiver_ok; |
- // Get the receiver from the stack. |
- // +1 ~ return address |
- __ mov(eax, Operand(esp, (argc_ + 1) * kPointerSize)); |
- // Call as function is indicated with the hole. |
- __ cmp(eax, isolate->factory()->the_hole_value()); |
- __ j(not_equal, &receiver_ok, Label::kNear); |
+ if (ReceiverMightBeImplicit() || ReceiverIsImplicit()) { |
+ Label call, patch_current_context; |
+ if (ReceiverMightBeImplicit()) { |
+ // Get the receiver from the stack. |
+ // +1 ~ return address |
+ __ mov(eax, Operand(esp, (argc_ + 1) * kPointerSize)); |
+ // Call as function is indicated with the hole. |
+ __ cmp(eax, isolate->factory()->the_hole_value()); |
+ __ j(not_equal, &call, Label::kNear); |
+ } |
// Patch the receiver on the stack with the global receiver object. |
+ // Goto slow case if we do not have a function. |
+ __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
+ __ j(not_equal, &patch_current_context); |
+ CallStubCompiler::FetchGlobalProxy(masm, ecx, edi); |
+ __ mov(Operand(esp, (argc_ + 1) * kPointerSize), ecx); |
+ __ jmp(&call, Label::kNear); |
+ __ bind(&patch_current_context); |
__ mov(ecx, GlobalObjectOperand()); |
dcarney
2013/12/26 13:35:52
this should have a TODO to fix for function proxie
Toon Verwaest
2014/01/03 17:56:26
I decided to just fix it anyway. I discovered some
|
__ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); |
__ mov(Operand(esp, (argc_ + 1) * kPointerSize), ecx); |
- __ bind(&receiver_ok); |
+ __ jmp(&slow); |
+ __ bind(&call); |
+ } else { |
+ // Goto slow case if we do not have a function. |
+ __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
+ __ j(not_equal, &slow); |
} |
- // Check that the function really is a JavaScript function. |
- __ JumpIfSmi(edi, &non_function); |
- // Goto slow case if we do not have a function. |
- __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
- __ j(not_equal, &slow); |
- |
if (RecordCallTarget()) { |
GenerateRecordCallTarget(masm); |
} |