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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 if (!callable->IsJSFunction()) { 154 if (!callable->IsJSFunction()) {
155 callable = TryGetFunctionDelegate(callable, pending_exception); 155 callable = TryGetFunctionDelegate(callable, pending_exception);
156 if (*pending_exception) return callable; 156 if (*pending_exception) return callable;
157 } 157 }
158 Handle<JSFunction> func = Handle<JSFunction>::cast(callable); 158 Handle<JSFunction> func = Handle<JSFunction>::cast(callable);
159 159
160 // In non-strict mode, convert receiver. 160 // In non-strict mode, convert receiver.
161 if (convert_receiver && !receiver->IsJSReceiver() && 161 if (convert_receiver && !receiver->IsJSReceiver() &&
162 !func->shared()->native() && !func->shared()->strict_mode()) { 162 !func->shared()->native() && !func->shared()->strict_mode()) {
163 if (receiver->IsUndefined() || receiver->IsNull()) { 163 if (receiver->IsUndefined() || receiver->IsNull()) {
164 // Careful, func->context()->global()->global_receiver() gives 164 Object* global = func->context()->global()->global_receiver();
165 // the JSBuiltinsObject if func is a builtin. Not what we want here. 165 // 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.
166 receiver = 166 // under some circumstances. In that case, don't rewrite.
167 Handle<Object>(func->GetIsolate()->global()->global_receiver()); 167 // FWIW, the same holds for GetIsolate()->global()->global_receiver().
168 if (!global->IsJSBuiltinsObject()) receiver = Handle<Object>(global);
168 } else { 169 } else {
169 receiver = ToObject(receiver, pending_exception); 170 receiver = ToObject(receiver, pending_exception);
170 } 171 }
171 if (*pending_exception) return callable; 172 if (*pending_exception) return callable;
172 } 173 }
173 174
174 return Invoke(false, func, receiver, argc, args, pending_exception); 175 return Invoke(false, func, receiver, argc, args, pending_exception);
175 } 176 }
176 177
177 178
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 return isolate->TerminateExecution(); 869 return isolate->TerminateExecution();
869 } 870 }
870 if (stack_guard->IsInterrupted()) { 871 if (stack_guard->IsInterrupted()) {
871 stack_guard->Continue(INTERRUPT); 872 stack_guard->Continue(INTERRUPT);
872 return isolate->StackOverflow(); 873 return isolate->StackOverflow();
873 } 874 }
874 return isolate->heap()->undefined_value(); 875 return isolate->heap()->undefined_value();
875 } 876 }
876 877
877 } } // namespace v8::internal 878 } } // namespace v8::internal
OLDNEW
« 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