OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 369 |
370 Handle<Object> js_builtin = | 370 Handle<Object> js_builtin = |
371 GetProperty(Handle<JSObject>(isolate->native_context()->builtins()), | 371 GetProperty(Handle<JSObject>(isolate->native_context()->builtins()), |
372 name).ToHandleChecked(); | 372 name).ToHandleChecked(); |
373 Handle<JSFunction> function = Handle<JSFunction>::cast(js_builtin); | 373 Handle<JSFunction> function = Handle<JSFunction>::cast(js_builtin); |
374 int argc = args.length() - 1; | 374 int argc = args.length() - 1; |
375 ScopedVector<Handle<Object> > argv(argc); | 375 ScopedVector<Handle<Object> > argv(argc); |
376 for (int i = 0; i < argc; ++i) { | 376 for (int i = 0; i < argc; ++i) { |
377 argv[i] = args.at<Object>(i + 1); | 377 argv[i] = args.at<Object>(i + 1); |
378 } | 378 } |
379 bool pending_exception; | 379 Handle<Object> result; |
380 Handle<Object> result = Execution::Call(isolate, | 380 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
381 function, | 381 isolate, result, |
382 args.receiver(), | 382 Execution::Call(isolate, |
383 argc, | 383 function, |
384 argv.start(), | 384 args.receiver(), |
385 &pending_exception); | 385 argc, |
386 if (pending_exception) return Failure::Exception(); | 386 argv.start())); |
387 return *result; | 387 return *result; |
388 } | 388 } |
389 | 389 |
390 | 390 |
391 BUILTIN(ArrayPush) { | 391 BUILTIN(ArrayPush) { |
392 HandleScope scope(isolate); | 392 HandleScope scope(isolate); |
393 Handle<Object> receiver = args.receiver(); | 393 Handle<Object> receiver = args.receiver(); |
394 MaybeHandle<FixedArrayBase> maybe_elms_obj = | 394 MaybeHandle<FixedArrayBase> maybe_elms_obj = |
395 EnsureJSArrayWithWritableFastElements(isolate, receiver, &args, 1); | 395 EnsureJSArrayWithWritableFastElements(isolate, receiver, &args, 1); |
396 Handle<FixedArrayBase> elms_obj; | 396 Handle<FixedArrayBase> elms_obj; |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 template <bool is_construct> | 1162 template <bool is_construct> |
1163 MUST_USE_RESULT static MaybeObject* HandleApiCallHelper( | 1163 MUST_USE_RESULT static MaybeObject* HandleApiCallHelper( |
1164 BuiltinArguments<NEEDS_CALLED_FUNCTION> args, Isolate* isolate) { | 1164 BuiltinArguments<NEEDS_CALLED_FUNCTION> args, Isolate* isolate) { |
1165 ASSERT(is_construct == CalledAsConstructor(isolate)); | 1165 ASSERT(is_construct == CalledAsConstructor(isolate)); |
1166 Heap* heap = isolate->heap(); | 1166 Heap* heap = isolate->heap(); |
1167 | 1167 |
1168 HandleScope scope(isolate); | 1168 HandleScope scope(isolate); |
1169 Handle<JSFunction> function = args.called_function(); | 1169 Handle<JSFunction> function = args.called_function(); |
1170 ASSERT(function->shared()->IsApiFunction()); | 1170 ASSERT(function->shared()->IsApiFunction()); |
1171 | 1171 |
1172 FunctionTemplateInfo* fun_data = function->shared()->get_api_func_data(); | 1172 Handle<FunctionTemplateInfo> fun_data( |
| 1173 function->shared()->get_api_func_data(), isolate); |
1173 if (is_construct) { | 1174 if (is_construct) { |
1174 Handle<FunctionTemplateInfo> desc(fun_data, isolate); | 1175 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1175 bool pending_exception = false; | 1176 isolate, fun_data, |
1176 isolate->factory()->ConfigureInstance( | 1177 isolate->factory()->ConfigureInstance( |
1177 desc, Handle<JSObject>::cast(args.receiver()), &pending_exception); | 1178 fun_data, Handle<JSObject>::cast(args.receiver()))); |
1178 ASSERT(isolate->has_pending_exception() == pending_exception); | |
1179 if (pending_exception) return Failure::Exception(); | |
1180 fun_data = *desc; | |
1181 } | 1179 } |
1182 | 1180 |
1183 SharedFunctionInfo* shared = function->shared(); | 1181 SharedFunctionInfo* shared = function->shared(); |
1184 if (shared->strict_mode() == SLOPPY && !shared->native()) { | 1182 if (shared->strict_mode() == SLOPPY && !shared->native()) { |
1185 Object* recv = args[0]; | 1183 Object* recv = args[0]; |
1186 ASSERT(!recv->IsNull()); | 1184 ASSERT(!recv->IsNull()); |
1187 if (recv->IsUndefined()) { | 1185 if (recv->IsUndefined()) { |
1188 args[0] = function->context()->global_object()->global_receiver(); | 1186 args[0] = function->context()->global_object()->global_receiver(); |
1189 } | 1187 } |
1190 } | 1188 } |
1191 | 1189 |
1192 Object* raw_holder = TypeCheck(heap, args.length(), &args[0], fun_data); | 1190 Object* raw_holder = TypeCheck(heap, args.length(), &args[0], *fun_data); |
1193 | 1191 |
1194 if (raw_holder->IsNull()) { | 1192 if (raw_holder->IsNull()) { |
1195 // This function cannot be called with the given receiver. Abort! | 1193 // This function cannot be called with the given receiver. Abort! |
1196 Handle<Object> obj = | 1194 Handle<Object> obj = |
1197 isolate->factory()->NewTypeError( | 1195 isolate->factory()->NewTypeError( |
1198 "illegal_invocation", HandleVector(&function, 1)); | 1196 "illegal_invocation", HandleVector(&function, 1)); |
1199 return isolate->Throw(*obj); | 1197 return isolate->Throw(*obj); |
1200 } | 1198 } |
1201 | 1199 |
1202 Object* raw_call_data = fun_data->call_code(); | 1200 Object* raw_call_data = fun_data->call_code(); |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 } | 1743 } |
1746 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1744 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1747 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1745 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1748 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1746 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
1749 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1747 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1750 #undef DEFINE_BUILTIN_ACCESSOR_C | 1748 #undef DEFINE_BUILTIN_ACCESSOR_C |
1751 #undef DEFINE_BUILTIN_ACCESSOR_A | 1749 #undef DEFINE_BUILTIN_ACCESSOR_A |
1752 | 1750 |
1753 | 1751 |
1754 } } // namespace v8::internal | 1752 } } // namespace v8::internal |
OLD | NEW |