Index: src/execution.cc |
diff --git a/src/execution.cc b/src/execution.cc |
index cdea005829fb4e1fec14d4402272592cb58138d5..e956706d39d00b4da22c2567bd82c257ac1d29dd 100644 |
--- a/src/execution.cc |
+++ b/src/execution.cc |
@@ -161,10 +161,11 @@ Handle<Object> Execution::Call(Handle<Object> callable, |
if (convert_receiver && !receiver->IsJSReceiver() && |
!func->shared()->native() && !func->shared()->strict_mode()) { |
if (receiver->IsUndefined() || receiver->IsNull()) { |
- // Careful, func->context()->global()->global_receiver() gives |
- // the JSBuiltinsObject if func is a builtin. Not what we want here. |
- receiver = |
- Handle<Object>(func->GetIsolate()->global()->global_receiver()); |
+ Object* global = func->context()->global()->global_receiver(); |
+ // For reasons that escape me, `global' can be the JSBuiltinsObject |
Jakob Kummerow
2011/09/13 17:09:54
It's a nit, but please don't use accents for quoti
rossberg
2011/09/13 17:14:00
Done.
|
+ // under some circumstances. In that case, don't rewrite. |
+ // FWIW, the same holds for GetIsolate()->global()->global_receiver(). |
+ if (!global->IsJSBuiltinsObject()) receiver = Handle<Object>(global); |
} else { |
receiver = ToObject(receiver, pending_exception); |
} |