Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1286)

Unified Diff: src/execution.cc

Issue 7892013: Fix for .bind regression. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-bind-receiver.js » ('j') | test/mjsunit/regress/regress-bind-receiver.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698