OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "bootstrapper.h" | 5 #include "bootstrapper.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
9 #include "natives.h" | 9 #include "natives.h" |
10 #include "snapshot.h" | 10 #include "snapshot.h" |
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 Handle<JSFunction> fun = | 1501 Handle<JSFunction> fun = |
1502 factory->NewFunctionFromSharedFunctionInfo(function_info, context); | 1502 factory->NewFunctionFromSharedFunctionInfo(function_info, context); |
1503 | 1503 |
1504 // Call function using either the runtime object or the global | 1504 // Call function using either the runtime object or the global |
1505 // object as the receiver. Provide no parameters. | 1505 // object as the receiver. Provide no parameters. |
1506 Handle<Object> receiver = | 1506 Handle<Object> receiver = |
1507 Handle<Object>(use_runtime_context | 1507 Handle<Object>(use_runtime_context |
1508 ? top_context->builtins() | 1508 ? top_context->builtins() |
1509 : top_context->global_object(), | 1509 : top_context->global_object(), |
1510 isolate); | 1510 isolate); |
1511 bool has_pending_exception; | 1511 return !Execution::Call( |
1512 Execution::Call(isolate, fun, receiver, 0, NULL, &has_pending_exception); | 1512 isolate, fun, receiver, 0, NULL).is_null(); |
1513 if (has_pending_exception) return false; | |
1514 return true; | |
1515 } | 1513 } |
1516 | 1514 |
1517 | 1515 |
1518 #define INSTALL_NATIVE(Type, name, var) \ | 1516 #define INSTALL_NATIVE(Type, name, var) \ |
1519 Handle<String> var##_name = \ | 1517 Handle<String> var##_name = \ |
1520 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ | 1518 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ |
1521 Handle<Object> var##_native = GlobalObject::GetPropertyNoExceptionThrown( \ | 1519 Handle<Object> var##_native = GlobalObject::GetPropertyNoExceptionThrown( \ |
1522 handle(native_context()->builtins()), var##_name); \ | 1520 handle(native_context()->builtins()), var##_name); \ |
1523 native_context()->set_##var(Type::cast(*var##_native)); | 1521 native_context()->set_##var(Type::cast(*var##_native)); |
1524 | 1522 |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2394 return true; | 2392 return true; |
2395 } | 2393 } |
2396 | 2394 |
2397 | 2395 |
2398 bool Genesis::ConfigureApiObject(Handle<JSObject> object, | 2396 bool Genesis::ConfigureApiObject(Handle<JSObject> object, |
2399 Handle<ObjectTemplateInfo> object_template) { | 2397 Handle<ObjectTemplateInfo> object_template) { |
2400 ASSERT(!object_template.is_null()); | 2398 ASSERT(!object_template.is_null()); |
2401 ASSERT(FunctionTemplateInfo::cast(object_template->constructor()) | 2399 ASSERT(FunctionTemplateInfo::cast(object_template->constructor()) |
2402 ->IsTemplateFor(object->map()));; | 2400 ->IsTemplateFor(object->map()));; |
2403 | 2401 |
2404 bool pending_exception = false; | 2402 MaybeHandle<JSObject> maybe_obj = |
2405 Handle<JSObject> obj = | 2403 Execution::InstantiateObject(object_template); |
2406 Execution::InstantiateObject(object_template, &pending_exception); | 2404 Handle<JSObject> obj; |
2407 if (pending_exception) { | 2405 if (!maybe_obj.ToHandle(&obj)) { |
2408 ASSERT(isolate()->has_pending_exception()); | 2406 ASSERT(isolate()->has_pending_exception()); |
2409 isolate()->clear_pending_exception(); | 2407 isolate()->clear_pending_exception(); |
2410 return false; | 2408 return false; |
2411 } | 2409 } |
2412 TransferObject(obj, object); | 2410 TransferObject(obj, object); |
2413 return true; | 2411 return true; |
2414 } | 2412 } |
2415 | 2413 |
2416 | 2414 |
2417 void Genesis::TransferNamedProperties(Handle<JSObject> from, | 2415 void Genesis::TransferNamedProperties(Handle<JSObject> from, |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2718 return from + sizeof(NestingCounterType); | 2716 return from + sizeof(NestingCounterType); |
2719 } | 2717 } |
2720 | 2718 |
2721 | 2719 |
2722 // Called when the top-level V8 mutex is destroyed. | 2720 // Called when the top-level V8 mutex is destroyed. |
2723 void Bootstrapper::FreeThreadResources() { | 2721 void Bootstrapper::FreeThreadResources() { |
2724 ASSERT(!IsActive()); | 2722 ASSERT(!IsActive()); |
2725 } | 2723 } |
2726 | 2724 |
2727 } } // namespace v8::internal | 2725 } } // namespace v8::internal |
OLD | NEW |