Index: src/ia32/builtins-ia32.cc |
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc |
index 67503e3963509dde3dcca2f4f5f9f2af9f898b5d..1c95fa9eb6ecb755ce86b7805f3dd298c8ad7e8d 100644 |
--- a/src/ia32/builtins-ia32.cc |
+++ b/src/ia32/builtins-ia32.cc |
@@ -781,10 +781,10 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
__ mov(edi, Operand(esp, eax, times_4, 1 * kPointerSize)); |
__ jmp(&patch_receiver); |
- // Use the global receiver object from the called function as the |
- // receiver. |
__ bind(&use_global_receiver); |
- CallStubCompiler::FetchGlobalProxy(masm, ebx, edi); |
+ __ mov(ebx, |
+ Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
+ __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); |
__ bind(&patch_receiver); |
__ mov(Operand(esp, eax, times_4, 0), ebx); |
@@ -855,14 +855,14 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); |
__ mov(edx, FieldOperand(edi, JSFunction::kCodeEntryOffset)); |
__ SmiUntag(ebx); |
- __ SetCallKind(ecx, CALL_AS_METHOD); |
+ __ SetCallKind(ecx, CALL_AS_FUNCTION); |
__ cmp(eax, ebx); |
__ j(not_equal, |
masm->isolate()->builtins()->ArgumentsAdaptorTrampoline()); |
ParameterCount expected(0); |
__ InvokeCode(edx, expected, expected, JUMP_FUNCTION, NullCallWrapper(), |
- CALL_AS_METHOD); |
+ CALL_AS_FUNCTION); |
} |
@@ -914,7 +914,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
__ mov(ebx, Operand(ebp, kReceiverOffset)); |
// Check that the function is a JS function (otherwise it must be a proxy). |
- Label push_receiver; |
+ Label push_receiver, use_global_receiver; |
__ mov(edi, Operand(ebp, kFunctionOffset)); |
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
__ j(not_equal, &push_receiver); |
@@ -924,7 +924,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
// Compute the receiver. |
// Do not transform the receiver for strict mode functions. |
- Label call_to_object, use_global_receiver; |
+ Label call_to_object; |
__ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
__ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrictModeByteOffset), |
1 << SharedFunctionInfo::kStrictModeBitWithinByte); |
@@ -955,9 +955,10 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
__ mov(ebx, eax); |
__ jmp(&push_receiver); |
- // Use the current global receiver object as the receiver. |
__ bind(&use_global_receiver); |
- CallStubCompiler::FetchGlobalProxy(masm, ebx, edi); |
+ __ mov(ebx, |
+ Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
+ __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); |
// Push the receiver. |
__ bind(&push_receiver); |
@@ -990,7 +991,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
__ cmp(ecx, Operand(ebp, kLimitOffset)); |
__ j(not_equal, &loop); |
- // Invoke the function. |
+ // Call the function. |
Label call_proxy; |
__ mov(eax, ecx); |
ParameterCount actual(eax); |
@@ -999,17 +1000,17 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
__ j(not_equal, &call_proxy); |
__ InvokeFunction(edi, actual, CALL_FUNCTION, |
- NullCallWrapper(), CALL_AS_METHOD); |
+ NullCallWrapper(), CALL_AS_FUNCTION); |
frame_scope.GenerateLeaveFrame(); |
__ ret(3 * kPointerSize); // remove this, receiver, and arguments |
- // Invoke the function proxy. |
+ // Call the function proxy. |
__ bind(&call_proxy); |
__ push(edi); // add function proxy as last argument |
__ inc(eax); |
__ Set(ebx, Immediate(0)); |
- __ SetCallKind(ecx, CALL_AS_METHOD); |
+ __ SetCallKind(ecx, CALL_AS_FUNCTION); |
__ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); |
__ call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
RelocInfo::CODE_TARGET); |