| 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/base/ieee754.h" | 9 #include "src/base/ieee754.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical | 138 extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical |
| 139 } | 139 } |
| 140 | 140 |
| 141 | 141 |
| 142 class Genesis BASE_EMBEDDED { | 142 class Genesis BASE_EMBEDDED { |
| 143 public: | 143 public: |
| 144 Genesis(Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, | 144 Genesis(Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, |
| 145 v8::Local<v8::ObjectTemplate> global_proxy_template, | 145 v8::Local<v8::ObjectTemplate> global_proxy_template, |
| 146 size_t context_snapshot_index, | 146 size_t context_snapshot_index, |
| 147 v8::DeserializeInternalFieldsCallback internal_fields_deserializer, | 147 v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer, |
| 148 GlobalContextType context_type); | 148 GlobalContextType context_type); |
| 149 Genesis(Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, | 149 Genesis(Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, |
| 150 v8::Local<v8::ObjectTemplate> global_proxy_template); | 150 v8::Local<v8::ObjectTemplate> global_proxy_template); |
| 151 ~Genesis() { } | 151 ~Genesis() { } |
| 152 | 152 |
| 153 Isolate* isolate() const { return isolate_; } | 153 Isolate* isolate() const { return isolate_; } |
| 154 Factory* factory() const { return isolate_->factory(); } | 154 Factory* factory() const { return isolate_->factory(); } |
| 155 Heap* heap() const { return isolate_->heap(); } | 155 Heap* heap() const { return isolate_->heap(); } |
| 156 | 156 |
| 157 Handle<Context> result() { return result_; } | 157 Handle<Context> result() { return result_; } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 309 |
| 310 void Bootstrapper::Iterate(ObjectVisitor* v) { | 310 void Bootstrapper::Iterate(ObjectVisitor* v) { |
| 311 extensions_cache_.Iterate(v); | 311 extensions_cache_.Iterate(v); |
| 312 v->Synchronize(VisitorSynchronization::kExtensions); | 312 v->Synchronize(VisitorSynchronization::kExtensions); |
| 313 } | 313 } |
| 314 | 314 |
| 315 Handle<Context> Bootstrapper::CreateEnvironment( | 315 Handle<Context> Bootstrapper::CreateEnvironment( |
| 316 MaybeHandle<JSGlobalProxy> maybe_global_proxy, | 316 MaybeHandle<JSGlobalProxy> maybe_global_proxy, |
| 317 v8::Local<v8::ObjectTemplate> global_proxy_template, | 317 v8::Local<v8::ObjectTemplate> global_proxy_template, |
| 318 v8::ExtensionConfiguration* extensions, size_t context_snapshot_index, | 318 v8::ExtensionConfiguration* extensions, size_t context_snapshot_index, |
| 319 v8::DeserializeInternalFieldsCallback internal_fields_deserializer, | 319 v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer, |
| 320 GlobalContextType context_type) { | 320 GlobalContextType context_type) { |
| 321 HandleScope scope(isolate_); | 321 HandleScope scope(isolate_); |
| 322 Genesis genesis(isolate_, maybe_global_proxy, global_proxy_template, | 322 Genesis genesis(isolate_, maybe_global_proxy, global_proxy_template, |
| 323 context_snapshot_index, internal_fields_deserializer, | 323 context_snapshot_index, embedder_fields_deserializer, |
| 324 context_type); | 324 context_type); |
| 325 Handle<Context> env = genesis.result(); | 325 Handle<Context> env = genesis.result(); |
| 326 if (env.is_null() || !InstallExtensions(env, extensions)) { | 326 if (env.is_null() || !InstallExtensions(env, extensions)) { |
| 327 return Handle<Context>(); | 327 return Handle<Context>(); |
| 328 } | 328 } |
| 329 return scope.CloseAndEscape(env); | 329 return scope.CloseAndEscape(env); |
| 330 } | 330 } |
| 331 | 331 |
| 332 Handle<JSGlobalProxy> Bootstrapper::NewRemoteContext( | 332 Handle<JSGlobalProxy> Bootstrapper::NewRemoteContext( |
| 333 MaybeHandle<JSGlobalProxy> maybe_global_proxy, | 333 MaybeHandle<JSGlobalProxy> maybe_global_proxy, |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 Handle<JSGlobalObject> global_object = | 1015 Handle<JSGlobalObject> global_object = |
| 1016 factory()->NewJSGlobalObject(js_global_object_function); | 1016 factory()->NewJSGlobalObject(js_global_object_function); |
| 1017 | 1017 |
| 1018 // Step 2: (re)initialize the global proxy object. | 1018 // Step 2: (re)initialize the global proxy object. |
| 1019 Handle<JSFunction> global_proxy_function; | 1019 Handle<JSFunction> global_proxy_function; |
| 1020 if (global_proxy_template.IsEmpty()) { | 1020 if (global_proxy_template.IsEmpty()) { |
| 1021 Handle<String> name = Handle<String>(heap()->empty_string()); | 1021 Handle<String> name = Handle<String>(heap()->empty_string()); |
| 1022 Handle<Code> code = isolate()->builtins()->Illegal(); | 1022 Handle<Code> code = isolate()->builtins()->Illegal(); |
| 1023 global_proxy_function = | 1023 global_proxy_function = |
| 1024 factory()->NewFunction(name, code, JS_GLOBAL_PROXY_TYPE, | 1024 factory()->NewFunction(name, code, JS_GLOBAL_PROXY_TYPE, |
| 1025 JSGlobalProxy::SizeWithInternalFields(0)); | 1025 JSGlobalProxy::SizeWithEmbedderFields(0)); |
| 1026 } else { | 1026 } else { |
| 1027 Handle<ObjectTemplateInfo> data = | 1027 Handle<ObjectTemplateInfo> data = |
| 1028 v8::Utils::OpenHandle(*global_proxy_template); | 1028 v8::Utils::OpenHandle(*global_proxy_template); |
| 1029 Handle<FunctionTemplateInfo> global_constructor( | 1029 Handle<FunctionTemplateInfo> global_constructor( |
| 1030 FunctionTemplateInfo::cast(data->constructor())); | 1030 FunctionTemplateInfo::cast(data->constructor())); |
| 1031 global_proxy_function = ApiNatives::CreateApiFunction( | 1031 global_proxy_function = ApiNatives::CreateApiFunction( |
| 1032 isolate(), global_constructor, factory()->the_hole_value(), | 1032 isolate(), global_constructor, factory()->the_hole_value(), |
| 1033 ApiNatives::GlobalProxyType); | 1033 ApiNatives::GlobalProxyType); |
| 1034 } | 1034 } |
| 1035 Handle<String> global_name = factory()->global_string(); | 1035 Handle<String> global_name = factory()->global_string(); |
| (...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2652 InstallWithIntrinsicDefaultProto( | 2652 InstallWithIntrinsicDefaultProto( |
| 2653 isolate, construct_by_buffer, | 2653 isolate, construct_by_buffer, |
| 2654 Context::TYPED_ARRAY_CONSTRUCT_BY_ARRAY_BUFFER_INDEX); | 2654 Context::TYPED_ARRAY_CONSTRUCT_BY_ARRAY_BUFFER_INDEX); |
| 2655 } | 2655 } |
| 2656 | 2656 |
| 2657 { // -- D a t a V i e w | 2657 { // -- D a t a V i e w |
| 2658 Handle<JSObject> prototype = | 2658 Handle<JSObject> prototype = |
| 2659 factory->NewJSObject(isolate->object_function(), TENURED); | 2659 factory->NewJSObject(isolate->object_function(), TENURED); |
| 2660 Handle<JSFunction> data_view_fun = | 2660 Handle<JSFunction> data_view_fun = |
| 2661 InstallFunction(global, "DataView", JS_DATA_VIEW_TYPE, | 2661 InstallFunction(global, "DataView", JS_DATA_VIEW_TYPE, |
| 2662 JSDataView::kSizeWithInternalFields, prototype, | 2662 JSDataView::kSizeWithEmbedderFields, prototype, |
| 2663 Builtins::kDataViewConstructor); | 2663 Builtins::kDataViewConstructor); |
| 2664 InstallWithIntrinsicDefaultProto(isolate, data_view_fun, | 2664 InstallWithIntrinsicDefaultProto(isolate, data_view_fun, |
| 2665 Context::DATA_VIEW_FUN_INDEX); | 2665 Context::DATA_VIEW_FUN_INDEX); |
| 2666 data_view_fun->shared()->SetConstructStub( | 2666 data_view_fun->shared()->SetConstructStub( |
| 2667 *isolate->builtins()->DataViewConstructor_ConstructStub()); | 2667 *isolate->builtins()->DataViewConstructor_ConstructStub()); |
| 2668 data_view_fun->shared()->set_length(3); | 2668 data_view_fun->shared()->set_length(3); |
| 2669 data_view_fun->shared()->DontAdaptArguments(); | 2669 data_view_fun->shared()->DontAdaptArguments(); |
| 2670 | 2670 |
| 2671 // Install the @@toStringTag property on the {prototype}. | 2671 // Install the @@toStringTag property on the {prototype}. |
| 2672 JSObject::AddProperty( | 2672 JSObject::AddProperty( |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3041 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); | 3041 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); |
| 3042 | 3042 |
| 3043 Handle<JSObject> typed_array_prototype = | 3043 Handle<JSObject> typed_array_prototype = |
| 3044 Handle<JSObject>(isolate()->typed_array_prototype()); | 3044 Handle<JSObject>(isolate()->typed_array_prototype()); |
| 3045 Handle<JSFunction> typed_array_function = | 3045 Handle<JSFunction> typed_array_function = |
| 3046 Handle<JSFunction>(isolate()->typed_array_function()); | 3046 Handle<JSFunction>(isolate()->typed_array_function()); |
| 3047 | 3047 |
| 3048 Handle<JSObject> prototype = | 3048 Handle<JSObject> prototype = |
| 3049 factory()->NewJSObject(isolate()->object_function(), TENURED); | 3049 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 3050 Handle<JSFunction> result = InstallFunction( | 3050 Handle<JSFunction> result = InstallFunction( |
| 3051 global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSizeWithInternalFields, | 3051 global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSizeWithEmbedderFields, |
| 3052 prototype, Builtins::kIllegal); | 3052 prototype, Builtins::kIllegal); |
| 3053 result->initial_map()->set_elements_kind(elements_kind); | 3053 result->initial_map()->set_elements_kind(elements_kind); |
| 3054 | 3054 |
| 3055 CHECK(JSObject::SetPrototype(result, typed_array_function, false, | 3055 CHECK(JSObject::SetPrototype(result, typed_array_function, false, |
| 3056 Object::DONT_THROW) | 3056 Object::DONT_THROW) |
| 3057 .FromJust()); | 3057 .FromJust()); |
| 3058 | 3058 |
| 3059 CHECK(JSObject::SetPrototype(prototype, typed_array_prototype, false, | 3059 CHECK(JSObject::SetPrototype(prototype, typed_array_prototype, false, |
| 3060 Object::DONT_THROW) | 3060 Object::DONT_THROW) |
| 3061 .FromJust()); | 3061 .FromJust()); |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3942 // Setup the {prototype} with the given {name} for @@toStringTag. | 3942 // Setup the {prototype} with the given {name} for @@toStringTag. |
| 3943 Handle<JSObject> prototype = | 3943 Handle<JSObject> prototype = |
| 3944 factory()->NewJSObject(isolate()->object_function(), TENURED); | 3944 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 3945 JSObject::AddProperty(prototype, factory()->to_string_tag_symbol(), | 3945 JSObject::AddProperty(prototype, factory()->to_string_tag_symbol(), |
| 3946 factory()->NewStringFromAsciiChecked(name), | 3946 factory()->NewStringFromAsciiChecked(name), |
| 3947 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 3947 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
| 3948 | 3948 |
| 3949 // Allocate the constructor with the given {prototype}. | 3949 // Allocate the constructor with the given {prototype}. |
| 3950 Handle<JSFunction> array_buffer_fun = | 3950 Handle<JSFunction> array_buffer_fun = |
| 3951 InstallFunction(target, name, JS_ARRAY_BUFFER_TYPE, | 3951 InstallFunction(target, name, JS_ARRAY_BUFFER_TYPE, |
| 3952 JSArrayBuffer::kSizeWithInternalFields, prototype, | 3952 JSArrayBuffer::kSizeWithEmbedderFields, prototype, |
| 3953 Builtins::kArrayBufferConstructor); | 3953 Builtins::kArrayBufferConstructor); |
| 3954 array_buffer_fun->shared()->SetConstructStub( | 3954 array_buffer_fun->shared()->SetConstructStub( |
| 3955 *isolate()->builtins()->ArrayBufferConstructor_ConstructStub()); | 3955 *isolate()->builtins()->ArrayBufferConstructor_ConstructStub()); |
| 3956 array_buffer_fun->shared()->DontAdaptArguments(); | 3956 array_buffer_fun->shared()->DontAdaptArguments(); |
| 3957 array_buffer_fun->shared()->set_length(1); | 3957 array_buffer_fun->shared()->set_length(1); |
| 3958 | 3958 |
| 3959 // Install the "constructor" property on the {prototype}. | 3959 // Install the "constructor" property on the {prototype}. |
| 3960 JSObject::AddProperty(prototype, factory()->constructor_string(), | 3960 JSObject::AddProperty(prototype, factory()->constructor_string(), |
| 3961 array_buffer_fun, DONT_ENUM); | 3961 array_buffer_fun, DONT_ENUM); |
| 3962 | 3962 |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4846 | 4846 |
| 4847 private: | 4847 private: |
| 4848 bool flag_; | 4848 bool flag_; |
| 4849 bool enabled_; | 4849 bool enabled_; |
| 4850 }; | 4850 }; |
| 4851 | 4851 |
| 4852 Genesis::Genesis( | 4852 Genesis::Genesis( |
| 4853 Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, | 4853 Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, |
| 4854 v8::Local<v8::ObjectTemplate> global_proxy_template, | 4854 v8::Local<v8::ObjectTemplate> global_proxy_template, |
| 4855 size_t context_snapshot_index, | 4855 size_t context_snapshot_index, |
| 4856 v8::DeserializeInternalFieldsCallback internal_fields_deserializer, | 4856 v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer, |
| 4857 GlobalContextType context_type) | 4857 GlobalContextType context_type) |
| 4858 : isolate_(isolate), active_(isolate->bootstrapper()) { | 4858 : isolate_(isolate), active_(isolate->bootstrapper()) { |
| 4859 NoTrackDoubleFieldsForSerializerScope disable_scope(isolate); | 4859 NoTrackDoubleFieldsForSerializerScope disable_scope(isolate); |
| 4860 result_ = Handle<Context>::null(); | 4860 result_ = Handle<Context>::null(); |
| 4861 global_proxy_ = Handle<JSGlobalProxy>::null(); | 4861 global_proxy_ = Handle<JSGlobalProxy>::null(); |
| 4862 | 4862 |
| 4863 // Before creating the roots we must save the context and restore it | 4863 // Before creating the roots we must save the context and restore it |
| 4864 // on all function exits. | 4864 // on all function exits. |
| 4865 SaveContext saved_context(isolate); | 4865 SaveContext saved_context(isolate); |
| 4866 | 4866 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4880 if (!maybe_global_proxy.ToHandle(&global_proxy)) { | 4880 if (!maybe_global_proxy.ToHandle(&global_proxy)) { |
| 4881 int instance_size = 0; | 4881 int instance_size = 0; |
| 4882 if (context_snapshot_index > 0) { | 4882 if (context_snapshot_index > 0) { |
| 4883 // The global proxy function to reinitialize this global proxy is in the | 4883 // The global proxy function to reinitialize this global proxy is in the |
| 4884 // context that is yet to be deserialized. We need to prepare a global | 4884 // context that is yet to be deserialized. We need to prepare a global |
| 4885 // proxy of the correct size. | 4885 // proxy of the correct size. |
| 4886 Object* size = isolate->heap()->serialized_global_proxy_sizes()->get( | 4886 Object* size = isolate->heap()->serialized_global_proxy_sizes()->get( |
| 4887 static_cast<int>(context_snapshot_index) - 1); | 4887 static_cast<int>(context_snapshot_index) - 1); |
| 4888 instance_size = Smi::cast(size)->value(); | 4888 instance_size = Smi::cast(size)->value(); |
| 4889 } else { | 4889 } else { |
| 4890 instance_size = JSGlobalProxy::SizeWithInternalFields( | 4890 instance_size = JSGlobalProxy::SizeWithEmbedderFields( |
| 4891 global_proxy_template.IsEmpty() | 4891 global_proxy_template.IsEmpty() |
| 4892 ? 0 | 4892 ? 0 |
| 4893 : global_proxy_template->InternalFieldCount()); | 4893 : global_proxy_template->InternalFieldCount()); |
| 4894 } | 4894 } |
| 4895 global_proxy = | 4895 global_proxy = |
| 4896 isolate->factory()->NewUninitializedJSGlobalProxy(instance_size); | 4896 isolate->factory()->NewUninitializedJSGlobalProxy(instance_size); |
| 4897 } | 4897 } |
| 4898 | 4898 |
| 4899 // We can only de-serialize a context if the isolate was initialized from | 4899 // We can only de-serialize a context if the isolate was initialized from |
| 4900 // a snapshot. Otherwise we have to build the context from scratch. | 4900 // a snapshot. Otherwise we have to build the context from scratch. |
| 4901 // Also create a context from scratch to expose natives, if required by flag. | 4901 // Also create a context from scratch to expose natives, if required by flag. |
| 4902 if (!isolate->initialized_from_snapshot() || | 4902 if (!isolate->initialized_from_snapshot() || |
| 4903 !Snapshot::NewContextFromSnapshot(isolate, global_proxy, | 4903 !Snapshot::NewContextFromSnapshot(isolate, global_proxy, |
| 4904 context_snapshot_index, | 4904 context_snapshot_index, |
| 4905 internal_fields_deserializer) | 4905 embedder_fields_deserializer) |
| 4906 .ToHandle(&native_context_)) { | 4906 .ToHandle(&native_context_)) { |
| 4907 native_context_ = Handle<Context>(); | 4907 native_context_ = Handle<Context>(); |
| 4908 } | 4908 } |
| 4909 | 4909 |
| 4910 if (!native_context().is_null()) { | 4910 if (!native_context().is_null()) { |
| 4911 AddToWeakNativeContextList(*native_context()); | 4911 AddToWeakNativeContextList(*native_context()); |
| 4912 isolate->set_context(*native_context()); | 4912 isolate->set_context(*native_context()); |
| 4913 isolate->counters()->contexts_created_by_snapshot()->Increment(); | 4913 isolate->counters()->contexts_created_by_snapshot()->Increment(); |
| 4914 #if TRACE_MAPS | 4914 #if TRACE_MAPS |
| 4915 if (FLAG_trace_maps) { | 4915 if (FLAG_trace_maps) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5006 | 5006 |
| 5007 // During genesis, the boilerplate for stack overflow won't work until the | 5007 // During genesis, the boilerplate for stack overflow won't work until the |
| 5008 // environment has been at least partially initialized. Add a stack check | 5008 // environment has been at least partially initialized. Add a stack check |
| 5009 // before entering JS code to catch overflow early. | 5009 // before entering JS code to catch overflow early. |
| 5010 StackLimitCheck check(isolate); | 5010 StackLimitCheck check(isolate); |
| 5011 if (check.HasOverflowed()) { | 5011 if (check.HasOverflowed()) { |
| 5012 isolate->StackOverflow(); | 5012 isolate->StackOverflow(); |
| 5013 return; | 5013 return; |
| 5014 } | 5014 } |
| 5015 | 5015 |
| 5016 const int proxy_size = JSGlobalProxy::SizeWithInternalFields( | 5016 const int proxy_size = JSGlobalProxy::SizeWithEmbedderFields( |
| 5017 global_proxy_template->InternalFieldCount()); | 5017 global_proxy_template->InternalFieldCount()); |
| 5018 | 5018 |
| 5019 Handle<JSGlobalProxy> global_proxy; | 5019 Handle<JSGlobalProxy> global_proxy; |
| 5020 if (!maybe_global_proxy.ToHandle(&global_proxy)) { | 5020 if (!maybe_global_proxy.ToHandle(&global_proxy)) { |
| 5021 global_proxy = factory()->NewUninitializedJSGlobalProxy(proxy_size); | 5021 global_proxy = factory()->NewUninitializedJSGlobalProxy(proxy_size); |
| 5022 } | 5022 } |
| 5023 | 5023 |
| 5024 // Create a remote object as the global object. | 5024 // Create a remote object as the global object. |
| 5025 Handle<ObjectTemplateInfo> global_proxy_data = | 5025 Handle<ObjectTemplateInfo> global_proxy_data = |
| 5026 Utils::OpenHandle(*global_proxy_template); | 5026 Utils::OpenHandle(*global_proxy_template); |
| 5027 Handle<FunctionTemplateInfo> global_constructor( | 5027 Handle<FunctionTemplateInfo> global_constructor( |
| 5028 FunctionTemplateInfo::cast(global_proxy_data->constructor())); | 5028 FunctionTemplateInfo::cast(global_proxy_data->constructor())); |
| 5029 | 5029 |
| 5030 Handle<ObjectTemplateInfo> global_object_template( | 5030 Handle<ObjectTemplateInfo> global_object_template( |
| 5031 ObjectTemplateInfo::cast(global_constructor->prototype_template())); | 5031 ObjectTemplateInfo::cast(global_constructor->prototype_template())); |
| 5032 Handle<JSObject> global_object = | 5032 Handle<JSObject> global_object = |
| 5033 ApiNatives::InstantiateRemoteObject( | 5033 ApiNatives::InstantiateRemoteObject( |
| 5034 global_object_template).ToHandleChecked(); | 5034 global_object_template).ToHandleChecked(); |
| 5035 | 5035 |
| 5036 // (Re)initialize the global proxy object. | 5036 // (Re)initialize the global proxy object. |
| 5037 Handle<SharedFunctionInfo> shared = | 5037 Handle<SharedFunctionInfo> shared = |
| 5038 FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, | 5038 FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, |
| 5039 global_constructor); | 5039 global_constructor); |
| 5040 Handle<Map> initial_map = | 5040 Handle<Map> initial_map = |
| 5041 factory()->CreateSloppyFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); | 5041 factory()->CreateSloppyFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); |
| 5042 Handle<JSFunction> global_proxy_function = | 5042 Handle<JSFunction> global_proxy_function = |
| 5043 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 5043 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 5044 initial_map, shared, factory()->undefined_value()); | 5044 initial_map, shared, factory()->undefined_value()); |
| 5045 DCHECK_EQ(global_proxy_data->internal_field_count(), | 5045 DCHECK_EQ(global_proxy_data->embedder_field_count(), |
| 5046 global_proxy_template->InternalFieldCount()); | 5046 global_proxy_template->InternalFieldCount()); |
| 5047 Handle<Map> global_proxy_map = isolate->factory()->NewMap( | 5047 Handle<Map> global_proxy_map = isolate->factory()->NewMap( |
| 5048 JS_GLOBAL_PROXY_TYPE, proxy_size, FAST_HOLEY_SMI_ELEMENTS); | 5048 JS_GLOBAL_PROXY_TYPE, proxy_size, FAST_HOLEY_SMI_ELEMENTS); |
| 5049 JSFunction::SetInitialMap(global_proxy_function, global_proxy_map, | 5049 JSFunction::SetInitialMap(global_proxy_function, global_proxy_map, |
| 5050 factory()->null_value()); | 5050 factory()->null_value()); |
| 5051 global_proxy_map->set_is_access_check_needed(true); | 5051 global_proxy_map->set_is_access_check_needed(true); |
| 5052 global_proxy_map->set_has_hidden_prototype(true); | 5052 global_proxy_map->set_has_hidden_prototype(true); |
| 5053 | 5053 |
| 5054 Handle<String> global_name = factory()->global_string(); | 5054 Handle<String> global_name = factory()->global_string(); |
| 5055 global_proxy_function->shared()->set_instance_class_name(*global_name); | 5055 global_proxy_function->shared()->set_instance_class_name(*global_name); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5090 } | 5090 } |
| 5091 | 5091 |
| 5092 | 5092 |
| 5093 // Called when the top-level V8 mutex is destroyed. | 5093 // Called when the top-level V8 mutex is destroyed. |
| 5094 void Bootstrapper::FreeThreadResources() { | 5094 void Bootstrapper::FreeThreadResources() { |
| 5095 DCHECK(!IsActive()); | 5095 DCHECK(!IsActive()); |
| 5096 } | 5096 } |
| 5097 | 5097 |
| 5098 } // namespace internal | 5098 } // namespace internal |
| 5099 } // namespace v8 | 5099 } // namespace v8 |
| OLD | NEW |