OLD | NEW |
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Object* global = func->context()->global()->global_receiver(); | 164 Object* global = func->context()->global()->global_receiver(); |
165 // For reasons that escape me, 'global' can be the JSBuiltinsObject | 165 // Under some circumstances, 'global' can be the JSBuiltinsObject |
166 // under some circumstances. In that case, don't rewrite. | 166 // In that case, don't rewrite. |
167 // FWIW, the same holds for GetIsolate()->global()->global_receiver(). | 167 // (FWIW, the same holds for GetIsolate()->global()->global_receiver().) |
168 if (!global->IsJSBuiltinsObject()) receiver = Handle<Object>(global); | 168 if (!global->IsJSBuiltinsObject()) receiver = Handle<Object>(global); |
169 } else { | 169 } else { |
170 receiver = ToObject(receiver, pending_exception); | 170 receiver = ToObject(receiver, pending_exception); |
171 } | 171 } |
172 if (*pending_exception) return callable; | 172 if (*pending_exception) return callable; |
173 } | 173 } |
174 | 174 |
175 return Invoke(false, func, receiver, argc, args, pending_exception); | 175 return Invoke(false, func, receiver, argc, args, pending_exception); |
176 } | 176 } |
177 | 177 |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 return isolate->TerminateExecution(); | 869 return isolate->TerminateExecution(); |
870 } | 870 } |
871 if (stack_guard->IsInterrupted()) { | 871 if (stack_guard->IsInterrupted()) { |
872 stack_guard->Continue(INTERRUPT); | 872 stack_guard->Continue(INTERRUPT); |
873 return isolate->StackOverflow(); | 873 return isolate->StackOverflow(); |
874 } | 874 } |
875 return isolate->heap()->undefined_value(); | 875 return isolate->heap()->undefined_value(); |
876 } | 876 } |
877 | 877 |
878 } } // namespace v8::internal | 878 } } // namespace v8::internal |
OLD | NEW |