| 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 "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/extensions/externalize-string-extension.h" | 9 #include "src/extensions/externalize-string-extension.h" |
| 10 #include "src/extensions/free-buffer-extension.h" | 10 #include "src/extensions/free-buffer-extension.h" |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 global_proxy->set_hash(heap()->undefined_value()); | 857 global_proxy->set_hash(heap()->undefined_value()); |
| 858 } | 858 } |
| 859 return global_proxy; | 859 return global_proxy; |
| 860 } | 860 } |
| 861 | 861 |
| 862 | 862 |
| 863 void Genesis::HookUpGlobalProxy(Handle<GlobalObject> global_object, | 863 void Genesis::HookUpGlobalProxy(Handle<GlobalObject> global_object, |
| 864 Handle<JSGlobalProxy> global_proxy) { | 864 Handle<JSGlobalProxy> global_proxy) { |
| 865 // Set the native context for the global object. | 865 // Set the native context for the global object. |
| 866 global_object->set_native_context(*native_context()); | 866 global_object->set_native_context(*native_context()); |
| 867 global_object->set_global_context(*native_context()); | |
| 868 global_object->set_global_proxy(*global_proxy); | 867 global_object->set_global_proxy(*global_proxy); |
| 869 global_proxy->set_native_context(*native_context()); | 868 global_proxy->set_native_context(*native_context()); |
| 870 native_context()->set_global_proxy(*global_proxy); | 869 native_context()->set_global_proxy(*global_proxy); |
| 871 } | 870 } |
| 872 | 871 |
| 873 | 872 |
| 874 void Genesis::HookUpGlobalObject(Handle<GlobalObject> global_object) { | 873 void Genesis::HookUpGlobalObject(Handle<GlobalObject> global_object) { |
| 875 Handle<GlobalObject> global_object_from_snapshot( | 874 Handle<GlobalObject> global_object_from_snapshot( |
| 876 GlobalObject::cast(native_context()->extension())); | 875 GlobalObject::cast(native_context()->extension())); |
| 877 Handle<JSBuiltinsObject> builtins_global(native_context()->builtins()); | 876 Handle<JSBuiltinsObject> builtins_global(native_context()->builtins()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 902 native_context()->set_global_object(*global_object); | 901 native_context()->set_global_object(*global_object); |
| 903 // Security setup: Set the security token of the native context to the global | 902 // Security setup: Set the security token of the native context to the global |
| 904 // object. This makes the security check between two different contexts fail | 903 // object. This makes the security check between two different contexts fail |
| 905 // by default even in case of global object reinitialization. | 904 // by default even in case of global object reinitialization. |
| 906 native_context()->set_security_token(*global_object); | 905 native_context()->set_security_token(*global_object); |
| 907 | 906 |
| 908 Isolate* isolate = global_object->GetIsolate(); | 907 Isolate* isolate = global_object->GetIsolate(); |
| 909 Factory* factory = isolate->factory(); | 908 Factory* factory = isolate->factory(); |
| 910 Heap* heap = isolate->heap(); | 909 Heap* heap = isolate->heap(); |
| 911 | 910 |
| 912 Handle<GlobalContextTable> global_context_table = | 911 Handle<ScriptContextTable> script_context_table = |
| 913 factory->NewGlobalContextTable(); | 912 factory->NewScriptContextTable(); |
| 914 native_context()->set_global_context_table(*global_context_table); | 913 native_context()->set_script_context_table(*script_context_table); |
| 915 | 914 |
| 916 Handle<String> object_name = factory->Object_string(); | 915 Handle<String> object_name = factory->Object_string(); |
| 917 JSObject::AddProperty( | 916 JSObject::AddProperty( |
| 918 global_object, object_name, isolate->object_function(), DONT_ENUM); | 917 global_object, object_name, isolate->object_function(), DONT_ENUM); |
| 919 | 918 |
| 920 Handle<JSObject> global(native_context()->global_object()); | 919 Handle<JSObject> global(native_context()->global_object()); |
| 921 | 920 |
| 922 // Install global Function object | 921 // Install global Function object |
| 923 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, | 922 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, |
| 924 empty_function, Builtins::kIllegal); | 923 empty_function, Builtins::kIllegal); |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("builtins")); | 1699 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("builtins")); |
| 1701 builtins_fun->shared()->set_instance_class_name(*name); | 1700 builtins_fun->shared()->set_instance_class_name(*name); |
| 1702 builtins_fun->initial_map()->set_dictionary_map(true); | 1701 builtins_fun->initial_map()->set_dictionary_map(true); |
| 1703 builtins_fun->initial_map()->set_prototype(heap()->null_value()); | 1702 builtins_fun->initial_map()->set_prototype(heap()->null_value()); |
| 1704 | 1703 |
| 1705 // Allocate the builtins object. | 1704 // Allocate the builtins object. |
| 1706 Handle<JSBuiltinsObject> builtins = | 1705 Handle<JSBuiltinsObject> builtins = |
| 1707 Handle<JSBuiltinsObject>::cast(factory()->NewGlobalObject(builtins_fun)); | 1706 Handle<JSBuiltinsObject>::cast(factory()->NewGlobalObject(builtins_fun)); |
| 1708 builtins->set_builtins(*builtins); | 1707 builtins->set_builtins(*builtins); |
| 1709 builtins->set_native_context(*native_context()); | 1708 builtins->set_native_context(*native_context()); |
| 1710 builtins->set_global_context(*native_context()); | |
| 1711 builtins->set_global_proxy(native_context()->global_proxy()); | 1709 builtins->set_global_proxy(native_context()->global_proxy()); |
| 1712 | 1710 |
| 1713 | 1711 |
| 1714 // Set up the 'global' properties of the builtins object. The | 1712 // Set up the 'global' properties of the builtins object. The |
| 1715 // 'global' property that refers to the global object is the only | 1713 // 'global' property that refers to the global object is the only |
| 1716 // way to get from code running in the builtins context to the | 1714 // way to get from code running in the builtins context to the |
| 1717 // global object. | 1715 // global object. |
| 1718 static const PropertyAttributes attributes = | 1716 static const PropertyAttributes attributes = |
| 1719 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE); | 1717 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE); |
| 1720 Handle<String> global_string = | 1718 Handle<String> global_string = |
| (...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2825 return from + sizeof(NestingCounterType); | 2823 return from + sizeof(NestingCounterType); |
| 2826 } | 2824 } |
| 2827 | 2825 |
| 2828 | 2826 |
| 2829 // Called when the top-level V8 mutex is destroyed. | 2827 // Called when the top-level V8 mutex is destroyed. |
| 2830 void Bootstrapper::FreeThreadResources() { | 2828 void Bootstrapper::FreeThreadResources() { |
| 2831 DCHECK(!IsActive()); | 2829 DCHECK(!IsActive()); |
| 2832 } | 2830 } |
| 2833 | 2831 |
| 2834 } } // namespace v8::internal | 2832 } } // namespace v8::internal |
| OLD | NEW |