| Index: src/ia32/full-codegen-ia32.cc
|
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
|
| index 04a0f7fe75790bb931a649d15ff95f6083c6fde9..9a811a260f8a8b196d1a852a503b05db2778e1b8 100644
|
| --- a/src/ia32/full-codegen-ia32.cc
|
| +++ b/src/ia32/full-codegen-ia32.cc
|
| @@ -133,22 +133,26 @@ void FullCodeGenerator::Generate() {
|
| }
|
| #endif
|
|
|
| - // Strict mode functions and builtins need to replace the receiver
|
| - // with undefined when called as functions (without an explicit
|
| - // receiver object). ecx is zero for method calls and non-zero for
|
| - // function calls.
|
| - if (!info->is_classic_mode() || info->is_native()) {
|
| + // Classic mode functions and builtins need to replace the receiver with the
|
| + // global proxy when called as functions (without an explicit receiver
|
| + // object).
|
| + if (info->is_classic_mode() && !info->is_native()) {
|
| Label ok;
|
| __ test(ecx, ecx);
|
| __ j(zero, &ok, Label::kNear);
|
| +
|
| // +1 for return address.
|
| int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize;
|
| __ mov(ecx, Operand(esp, receiver_offset));
|
| - __ JumpIfSmi(ecx, &ok);
|
| - __ CmpObjectType(ecx, JS_GLOBAL_PROXY_TYPE, ecx);
|
| +
|
| + __ cmp(ecx, isolate()->factory()->undefined_value());
|
| __ j(not_equal, &ok, Label::kNear);
|
| - __ mov(Operand(esp, receiver_offset),
|
| - Immediate(isolate()->factory()->undefined_value()));
|
| +
|
| + __ mov(ecx, GlobalObjectOperand());
|
| + __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset));
|
| +
|
| + __ mov(Operand(esp, receiver_offset), ecx);
|
| +
|
| __ bind(&ok);
|
| }
|
|
|
| @@ -2753,11 +2757,9 @@ void FullCodeGenerator::VisitCall(Call* expr) {
|
| { PreservePositionScope scope(masm()->positions_recorder());
|
| VisitForStackValue(callee);
|
| }
|
| - // Push the hole as receiver.
|
| - // It will be correctly replaced in the call stub.
|
| - __ push(Immediate(isolate()->factory()->the_hole_value()));
|
| + __ push(Immediate(isolate()->factory()->undefined_value()));
|
| // Emit function call.
|
| - EmitCallWithStub(expr, RECEIVER_IS_IMPLICIT);
|
| + EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
|
| }
|
|
|
| #ifdef DEBUG
|
| @@ -3693,7 +3695,7 @@ void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
|
| __ mov(edi, result_register());
|
| ParameterCount count(arg_count);
|
| __ InvokeFunction(edi, count, CALL_FUNCTION,
|
| - NullCallWrapper(), CALL_AS_METHOD);
|
| + NullCallWrapper(), CALL_AS_FUNCTION);
|
| __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
| __ jmp(&done);
|
|
|
|
|