| 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/api-natives.h" | 8 #include "src/api-natives.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 #endif | 948 #endif |
| 949 } else { | 949 } else { |
| 950 Handle<FunctionTemplateInfo> js_global_object_constructor( | 950 Handle<FunctionTemplateInfo> js_global_object_constructor( |
| 951 FunctionTemplateInfo::cast(js_global_object_template->constructor())); | 951 FunctionTemplateInfo::cast(js_global_object_template->constructor())); |
| 952 js_global_object_function = ApiNatives::CreateApiFunction( | 952 js_global_object_function = ApiNatives::CreateApiFunction( |
| 953 isolate(), js_global_object_constructor, factory()->the_hole_value(), | 953 isolate(), js_global_object_constructor, factory()->the_hole_value(), |
| 954 ApiNatives::GlobalObjectType); | 954 ApiNatives::GlobalObjectType); |
| 955 } | 955 } |
| 956 | 956 |
| 957 js_global_object_function->initial_map()->set_is_prototype_map(true); | 957 js_global_object_function->initial_map()->set_is_prototype_map(true); |
| 958 js_global_object_function->initial_map()->set_is_hidden_prototype(); | |
| 959 js_global_object_function->initial_map()->set_dictionary_map(true); | 958 js_global_object_function->initial_map()->set_dictionary_map(true); |
| 960 Handle<JSGlobalObject> global_object = | 959 Handle<JSGlobalObject> global_object = |
| 961 factory()->NewJSGlobalObject(js_global_object_function); | 960 factory()->NewJSGlobalObject(js_global_object_function); |
| 962 | 961 |
| 963 // Step 2: (re)initialize the global proxy object. | 962 // Step 2: (re)initialize the global proxy object. |
| 964 Handle<JSFunction> global_proxy_function; | 963 Handle<JSFunction> global_proxy_function; |
| 965 if (global_proxy_template.IsEmpty()) { | 964 if (global_proxy_template.IsEmpty()) { |
| 966 Handle<String> name = Handle<String>(heap()->empty_string()); | 965 Handle<String> name = Handle<String>(heap()->empty_string()); |
| 967 Handle<Code> code = isolate()->builtins()->Illegal(); | 966 Handle<Code> code = isolate()->builtins()->Illegal(); |
| 968 global_proxy_function = factory()->NewFunction( | 967 global_proxy_function = factory()->NewFunction( |
| 969 name, code, JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSize); | 968 name, code, JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSize); |
| 970 } else { | 969 } else { |
| 971 Handle<ObjectTemplateInfo> data = | 970 Handle<ObjectTemplateInfo> data = |
| 972 v8::Utils::OpenHandle(*global_proxy_template); | 971 v8::Utils::OpenHandle(*global_proxy_template); |
| 973 Handle<FunctionTemplateInfo> global_constructor( | 972 Handle<FunctionTemplateInfo> global_constructor( |
| 974 FunctionTemplateInfo::cast(data->constructor())); | 973 FunctionTemplateInfo::cast(data->constructor())); |
| 975 global_proxy_function = ApiNatives::CreateApiFunction( | 974 global_proxy_function = ApiNatives::CreateApiFunction( |
| 976 isolate(), global_constructor, factory()->the_hole_value(), | 975 isolate(), global_constructor, factory()->the_hole_value(), |
| 977 ApiNatives::GlobalProxyType); | 976 ApiNatives::GlobalProxyType); |
| 978 } | 977 } |
| 979 | |
| 980 Handle<String> global_name = factory()->global_string(); | 978 Handle<String> global_name = factory()->global_string(); |
| 981 global_proxy_function->shared()->set_instance_class_name(*global_name); | 979 global_proxy_function->shared()->set_instance_class_name(*global_name); |
| 982 global_proxy_function->initial_map()->set_is_access_check_needed(true); | 980 global_proxy_function->initial_map()->set_is_access_check_needed(true); |
| 981 global_proxy_function->initial_map()->set_has_hidden_prototype(true); |
| 983 | 982 |
| 984 // Set global_proxy.__proto__ to js_global after ConfigureGlobalObjects | 983 // Set global_proxy.__proto__ to js_global after ConfigureGlobalObjects |
| 985 // Return the global proxy. | 984 // Return the global proxy. |
| 986 | 985 |
| 987 factory()->ReinitializeJSGlobalProxy(global_proxy, global_proxy_function); | 986 factory()->ReinitializeJSGlobalProxy(global_proxy, global_proxy_function); |
| 988 return global_object; | 987 return global_object; |
| 989 } | 988 } |
| 990 | 989 |
| 991 | 990 |
| 992 void Genesis::HookUpGlobalProxy(Handle<JSGlobalObject> global_object, | 991 void Genesis::HookUpGlobalProxy(Handle<JSGlobalObject> global_object, |
| (...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3636 } | 3635 } |
| 3637 | 3636 |
| 3638 | 3637 |
| 3639 // Called when the top-level V8 mutex is destroyed. | 3638 // Called when the top-level V8 mutex is destroyed. |
| 3640 void Bootstrapper::FreeThreadResources() { | 3639 void Bootstrapper::FreeThreadResources() { |
| 3641 DCHECK(!IsActive()); | 3640 DCHECK(!IsActive()); |
| 3642 } | 3641 } |
| 3643 | 3642 |
| 3644 } // namespace internal | 3643 } // namespace internal |
| 3645 } // namespace v8 | 3644 } // namespace v8 |
| OLD | NEW |