| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical | 141 extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical |
| 142 } | 142 } |
| 143 | 143 |
| 144 | 144 |
| 145 class Genesis BASE_EMBEDDED { | 145 class Genesis BASE_EMBEDDED { |
| 146 public: | 146 public: |
| 147 Genesis(Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, | 147 Genesis(Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, |
| 148 v8::Local<v8::ObjectTemplate> global_proxy_template, | 148 v8::Local<v8::ObjectTemplate> global_proxy_template, |
| 149 size_t context_snapshot_index, | 149 size_t context_snapshot_index, |
| 150 v8::DeserializeInternalFieldsCallback internal_fields_deserializer, | 150 v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer, |
| 151 GlobalContextType context_type); | 151 GlobalContextType context_type); |
| 152 Genesis(Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, | 152 Genesis(Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, |
| 153 v8::Local<v8::ObjectTemplate> global_proxy_template); | 153 v8::Local<v8::ObjectTemplate> global_proxy_template); |
| 154 ~Genesis() { } | 154 ~Genesis() { } |
| 155 | 155 |
| 156 Isolate* isolate() const { return isolate_; } | 156 Isolate* isolate() const { return isolate_; } |
| 157 Factory* factory() const { return isolate_->factory(); } | 157 Factory* factory() const { return isolate_->factory(); } |
| 158 Heap* heap() const { return isolate_->heap(); } | 158 Heap* heap() const { return isolate_->heap(); } |
| 159 | 159 |
| 160 Handle<Context> result() { return result_; } | 160 Handle<Context> result() { return result_; } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 void Bootstrapper::Iterate(ObjectVisitor* v) { | 314 void Bootstrapper::Iterate(ObjectVisitor* v) { |
| 315 extensions_cache_.Iterate(v); | 315 extensions_cache_.Iterate(v); |
| 316 v->Synchronize(VisitorSynchronization::kExtensions); | 316 v->Synchronize(VisitorSynchronization::kExtensions); |
| 317 } | 317 } |
| 318 | 318 |
| 319 Handle<Context> Bootstrapper::CreateEnvironment( | 319 Handle<Context> Bootstrapper::CreateEnvironment( |
| 320 MaybeHandle<JSGlobalProxy> maybe_global_proxy, | 320 MaybeHandle<JSGlobalProxy> maybe_global_proxy, |
| 321 v8::Local<v8::ObjectTemplate> global_proxy_template, | 321 v8::Local<v8::ObjectTemplate> global_proxy_template, |
| 322 v8::ExtensionConfiguration* extensions, size_t context_snapshot_index, | 322 v8::ExtensionConfiguration* extensions, size_t context_snapshot_index, |
| 323 v8::DeserializeInternalFieldsCallback internal_fields_deserializer, | 323 v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer, |
| 324 GlobalContextType context_type) { | 324 GlobalContextType context_type) { |
| 325 HandleScope scope(isolate_); | 325 HandleScope scope(isolate_); |
| 326 Genesis genesis(isolate_, maybe_global_proxy, global_proxy_template, | 326 Genesis genesis(isolate_, maybe_global_proxy, global_proxy_template, |
| 327 context_snapshot_index, internal_fields_deserializer, | 327 context_snapshot_index, embedder_fields_deserializer, |
| 328 context_type); | 328 context_type); |
| 329 Handle<Context> env = genesis.result(); | 329 Handle<Context> env = genesis.result(); |
| 330 if (env.is_null() || !InstallExtensions(env, extensions)) { | 330 if (env.is_null() || !InstallExtensions(env, extensions)) { |
| 331 return Handle<Context>(); | 331 return Handle<Context>(); |
| 332 } | 332 } |
| 333 return scope.CloseAndEscape(env); | 333 return scope.CloseAndEscape(env); |
| 334 } | 334 } |
| 335 | 335 |
| 336 Handle<JSGlobalProxy> Bootstrapper::NewRemoteContext( | 336 Handle<JSGlobalProxy> Bootstrapper::NewRemoteContext( |
| 337 MaybeHandle<JSGlobalProxy> maybe_global_proxy, | 337 MaybeHandle<JSGlobalProxy> maybe_global_proxy, |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 Handle<JSGlobalObject> global_object = | 1019 Handle<JSGlobalObject> global_object = |
| 1020 factory()->NewJSGlobalObject(js_global_object_function); | 1020 factory()->NewJSGlobalObject(js_global_object_function); |
| 1021 | 1021 |
| 1022 // Step 2: (re)initialize the global proxy object. | 1022 // Step 2: (re)initialize the global proxy object. |
| 1023 Handle<JSFunction> global_proxy_function; | 1023 Handle<JSFunction> global_proxy_function; |
| 1024 if (global_proxy_template.IsEmpty()) { | 1024 if (global_proxy_template.IsEmpty()) { |
| 1025 Handle<String> name = Handle<String>(heap()->empty_string()); | 1025 Handle<String> name = Handle<String>(heap()->empty_string()); |
| 1026 Handle<Code> code = isolate()->builtins()->Illegal(); | 1026 Handle<Code> code = isolate()->builtins()->Illegal(); |
| 1027 global_proxy_function = | 1027 global_proxy_function = |
| 1028 factory()->NewFunction(name, code, JS_GLOBAL_PROXY_TYPE, | 1028 factory()->NewFunction(name, code, JS_GLOBAL_PROXY_TYPE, |
| 1029 JSGlobalProxy::SizeWithInternalFields(0)); | 1029 JSGlobalProxy::SizeWithEmbedderFields(0)); |
| 1030 } else { | 1030 } else { |
| 1031 Handle<ObjectTemplateInfo> data = | 1031 Handle<ObjectTemplateInfo> data = |
| 1032 v8::Utils::OpenHandle(*global_proxy_template); | 1032 v8::Utils::OpenHandle(*global_proxy_template); |
| 1033 Handle<FunctionTemplateInfo> global_constructor( | 1033 Handle<FunctionTemplateInfo> global_constructor( |
| 1034 FunctionTemplateInfo::cast(data->constructor())); | 1034 FunctionTemplateInfo::cast(data->constructor())); |
| 1035 global_proxy_function = ApiNatives::CreateApiFunction( | 1035 global_proxy_function = ApiNatives::CreateApiFunction( |
| 1036 isolate(), global_constructor, factory()->the_hole_value(), | 1036 isolate(), global_constructor, factory()->the_hole_value(), |
| 1037 ApiNatives::GlobalProxyType); | 1037 ApiNatives::GlobalProxyType); |
| 1038 } | 1038 } |
| 1039 Handle<String> global_name = factory()->global_string(); | 1039 Handle<String> global_name = factory()->global_string(); |
| (...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2642 InstallWithIntrinsicDefaultProto( | 2642 InstallWithIntrinsicDefaultProto( |
| 2643 isolate, construct_by_length, | 2643 isolate, construct_by_length, |
| 2644 Context::TYPED_ARRAY_CONSTRUCT_BY_LENGTH_INDEX); | 2644 Context::TYPED_ARRAY_CONSTRUCT_BY_LENGTH_INDEX); |
| 2645 } | 2645 } |
| 2646 | 2646 |
| 2647 { // -- D a t a V i e w | 2647 { // -- D a t a V i e w |
| 2648 Handle<JSObject> prototype = | 2648 Handle<JSObject> prototype = |
| 2649 factory->NewJSObject(isolate->object_function(), TENURED); | 2649 factory->NewJSObject(isolate->object_function(), TENURED); |
| 2650 Handle<JSFunction> data_view_fun = | 2650 Handle<JSFunction> data_view_fun = |
| 2651 InstallFunction(global, "DataView", JS_DATA_VIEW_TYPE, | 2651 InstallFunction(global, "DataView", JS_DATA_VIEW_TYPE, |
| 2652 JSDataView::kSizeWithInternalFields, prototype, | 2652 JSDataView::kSizeWithEmbedderFields, prototype, |
| 2653 Builtins::kDataViewConstructor); | 2653 Builtins::kDataViewConstructor); |
| 2654 InstallWithIntrinsicDefaultProto(isolate, data_view_fun, | 2654 InstallWithIntrinsicDefaultProto(isolate, data_view_fun, |
| 2655 Context::DATA_VIEW_FUN_INDEX); | 2655 Context::DATA_VIEW_FUN_INDEX); |
| 2656 data_view_fun->shared()->SetConstructStub( | 2656 data_view_fun->shared()->SetConstructStub( |
| 2657 *isolate->builtins()->DataViewConstructor_ConstructStub()); | 2657 *isolate->builtins()->DataViewConstructor_ConstructStub()); |
| 2658 data_view_fun->shared()->set_length(3); | 2658 data_view_fun->shared()->set_length(3); |
| 2659 data_view_fun->shared()->DontAdaptArguments(); | 2659 data_view_fun->shared()->DontAdaptArguments(); |
| 2660 | 2660 |
| 2661 // Install the @@toStringTag property on the {prototype}. | 2661 // Install the @@toStringTag property on the {prototype}. |
| 2662 JSObject::AddProperty( | 2662 JSObject::AddProperty( |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3031 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); | 3031 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); |
| 3032 | 3032 |
| 3033 Handle<JSObject> typed_array_prototype = | 3033 Handle<JSObject> typed_array_prototype = |
| 3034 Handle<JSObject>(isolate()->typed_array_prototype()); | 3034 Handle<JSObject>(isolate()->typed_array_prototype()); |
| 3035 Handle<JSFunction> typed_array_function = | 3035 Handle<JSFunction> typed_array_function = |
| 3036 Handle<JSFunction>(isolate()->typed_array_function()); | 3036 Handle<JSFunction>(isolate()->typed_array_function()); |
| 3037 | 3037 |
| 3038 Handle<JSObject> prototype = | 3038 Handle<JSObject> prototype = |
| 3039 factory()->NewJSObject(isolate()->object_function(), TENURED); | 3039 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 3040 Handle<JSFunction> result = InstallFunction( | 3040 Handle<JSFunction> result = InstallFunction( |
| 3041 global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSizeWithInternalFields, | 3041 global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSizeWithEmbedderFields, |
| 3042 prototype, Builtins::kIllegal); | 3042 prototype, Builtins::kIllegal); |
| 3043 result->initial_map()->set_elements_kind(elements_kind); | 3043 result->initial_map()->set_elements_kind(elements_kind); |
| 3044 | 3044 |
| 3045 CHECK(JSObject::SetPrototype(result, typed_array_function, false, | 3045 CHECK(JSObject::SetPrototype(result, typed_array_function, false, |
| 3046 Object::DONT_THROW) | 3046 Object::DONT_THROW) |
| 3047 .FromJust()); | 3047 .FromJust()); |
| 3048 | 3048 |
| 3049 CHECK(JSObject::SetPrototype(prototype, typed_array_prototype, false, | 3049 CHECK(JSObject::SetPrototype(prototype, typed_array_prototype, false, |
| 3050 Object::DONT_THROW) | 3050 Object::DONT_THROW) |
| 3051 .FromJust()); | 3051 .FromJust()); |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3898 // Setup the {prototype} with the given {name} for @@toStringTag. | 3898 // Setup the {prototype} with the given {name} for @@toStringTag. |
| 3899 Handle<JSObject> prototype = | 3899 Handle<JSObject> prototype = |
| 3900 factory()->NewJSObject(isolate()->object_function(), TENURED); | 3900 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 3901 JSObject::AddProperty(prototype, factory()->to_string_tag_symbol(), | 3901 JSObject::AddProperty(prototype, factory()->to_string_tag_symbol(), |
| 3902 factory()->NewStringFromAsciiChecked(name), | 3902 factory()->NewStringFromAsciiChecked(name), |
| 3903 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 3903 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
| 3904 | 3904 |
| 3905 // Allocate the constructor with the given {prototype}. | 3905 // Allocate the constructor with the given {prototype}. |
| 3906 Handle<JSFunction> array_buffer_fun = | 3906 Handle<JSFunction> array_buffer_fun = |
| 3907 InstallFunction(target, name, JS_ARRAY_BUFFER_TYPE, | 3907 InstallFunction(target, name, JS_ARRAY_BUFFER_TYPE, |
| 3908 JSArrayBuffer::kSizeWithInternalFields, prototype, | 3908 JSArrayBuffer::kSizeWithEmbedderFields, prototype, |
| 3909 Builtins::kArrayBufferConstructor); | 3909 Builtins::kArrayBufferConstructor); |
| 3910 array_buffer_fun->shared()->SetConstructStub( | 3910 array_buffer_fun->shared()->SetConstructStub( |
| 3911 *isolate()->builtins()->ArrayBufferConstructor_ConstructStub()); | 3911 *isolate()->builtins()->ArrayBufferConstructor_ConstructStub()); |
| 3912 array_buffer_fun->shared()->DontAdaptArguments(); | 3912 array_buffer_fun->shared()->DontAdaptArguments(); |
| 3913 array_buffer_fun->shared()->set_length(1); | 3913 array_buffer_fun->shared()->set_length(1); |
| 3914 | 3914 |
| 3915 // Install the "constructor" property on the {prototype}. | 3915 // Install the "constructor" property on the {prototype}. |
| 3916 JSObject::AddProperty(prototype, factory()->constructor_string(), | 3916 JSObject::AddProperty(prototype, factory()->constructor_string(), |
| 3917 array_buffer_fun, DONT_ENUM); | 3917 array_buffer_fun, DONT_ENUM); |
| 3918 | 3918 |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4874 | 4874 |
| 4875 private: | 4875 private: |
| 4876 bool flag_; | 4876 bool flag_; |
| 4877 bool enabled_; | 4877 bool enabled_; |
| 4878 }; | 4878 }; |
| 4879 | 4879 |
| 4880 Genesis::Genesis( | 4880 Genesis::Genesis( |
| 4881 Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, | 4881 Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, |
| 4882 v8::Local<v8::ObjectTemplate> global_proxy_template, | 4882 v8::Local<v8::ObjectTemplate> global_proxy_template, |
| 4883 size_t context_snapshot_index, | 4883 size_t context_snapshot_index, |
| 4884 v8::DeserializeInternalFieldsCallback internal_fields_deserializer, | 4884 v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer, |
| 4885 GlobalContextType context_type) | 4885 GlobalContextType context_type) |
| 4886 : isolate_(isolate), active_(isolate->bootstrapper()) { | 4886 : isolate_(isolate), active_(isolate->bootstrapper()) { |
| 4887 NoTrackDoubleFieldsForSerializerScope disable_scope(isolate); | 4887 NoTrackDoubleFieldsForSerializerScope disable_scope(isolate); |
| 4888 result_ = Handle<Context>::null(); | 4888 result_ = Handle<Context>::null(); |
| 4889 global_proxy_ = Handle<JSGlobalProxy>::null(); | 4889 global_proxy_ = Handle<JSGlobalProxy>::null(); |
| 4890 | 4890 |
| 4891 // Before creating the roots we must save the context and restore it | 4891 // Before creating the roots we must save the context and restore it |
| 4892 // on all function exits. | 4892 // on all function exits. |
| 4893 SaveContext saved_context(isolate); | 4893 SaveContext saved_context(isolate); |
| 4894 | 4894 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4908 if (!maybe_global_proxy.ToHandle(&global_proxy)) { | 4908 if (!maybe_global_proxy.ToHandle(&global_proxy)) { |
| 4909 int instance_size = 0; | 4909 int instance_size = 0; |
| 4910 if (context_snapshot_index > 0) { | 4910 if (context_snapshot_index > 0) { |
| 4911 // The global proxy function to reinitialize this global proxy is in the | 4911 // The global proxy function to reinitialize this global proxy is in the |
| 4912 // context that is yet to be deserialized. We need to prepare a global | 4912 // context that is yet to be deserialized. We need to prepare a global |
| 4913 // proxy of the correct size. | 4913 // proxy of the correct size. |
| 4914 Object* size = isolate->heap()->serialized_global_proxy_sizes()->get( | 4914 Object* size = isolate->heap()->serialized_global_proxy_sizes()->get( |
| 4915 static_cast<int>(context_snapshot_index) - 1); | 4915 static_cast<int>(context_snapshot_index) - 1); |
| 4916 instance_size = Smi::cast(size)->value(); | 4916 instance_size = Smi::cast(size)->value(); |
| 4917 } else { | 4917 } else { |
| 4918 instance_size = JSGlobalProxy::SizeWithInternalFields( | 4918 instance_size = JSGlobalProxy::SizeWithEmbedderFields( |
| 4919 global_proxy_template.IsEmpty() | 4919 global_proxy_template.IsEmpty() |
| 4920 ? 0 | 4920 ? 0 |
| 4921 : global_proxy_template->InternalFieldCount()); | 4921 : global_proxy_template->EmbedderFieldCount()); |
| 4922 } | 4922 } |
| 4923 global_proxy = | 4923 global_proxy = |
| 4924 isolate->factory()->NewUninitializedJSGlobalProxy(instance_size); | 4924 isolate->factory()->NewUninitializedJSGlobalProxy(instance_size); |
| 4925 } | 4925 } |
| 4926 | 4926 |
| 4927 // We can only de-serialize a context if the isolate was initialized from | 4927 // We can only de-serialize a context if the isolate was initialized from |
| 4928 // a snapshot. Otherwise we have to build the context from scratch. | 4928 // a snapshot. Otherwise we have to build the context from scratch. |
| 4929 // Also create a context from scratch to expose natives, if required by flag. | 4929 // Also create a context from scratch to expose natives, if required by flag. |
| 4930 if (!isolate->initialized_from_snapshot() || | 4930 if (!isolate->initialized_from_snapshot() || |
| 4931 !Snapshot::NewContextFromSnapshot(isolate, global_proxy, | 4931 !Snapshot::NewContextFromSnapshot(isolate, global_proxy, |
| 4932 context_snapshot_index, | 4932 context_snapshot_index, |
| 4933 internal_fields_deserializer) | 4933 embedder_fields_deserializer) |
| 4934 .ToHandle(&native_context_)) { | 4934 .ToHandle(&native_context_)) { |
| 4935 native_context_ = Handle<Context>(); | 4935 native_context_ = Handle<Context>(); |
| 4936 } | 4936 } |
| 4937 | 4937 |
| 4938 if (!native_context().is_null()) { | 4938 if (!native_context().is_null()) { |
| 4939 AddToWeakNativeContextList(*native_context()); | 4939 AddToWeakNativeContextList(*native_context()); |
| 4940 isolate->set_context(*native_context()); | 4940 isolate->set_context(*native_context()); |
| 4941 isolate->counters()->contexts_created_by_snapshot()->Increment(); | 4941 isolate->counters()->contexts_created_by_snapshot()->Increment(); |
| 4942 #if TRACE_MAPS | 4942 #if TRACE_MAPS |
| 4943 if (FLAG_trace_maps) { | 4943 if (FLAG_trace_maps) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5037 | 5037 |
| 5038 // During genesis, the boilerplate for stack overflow won't work until the | 5038 // During genesis, the boilerplate for stack overflow won't work until the |
| 5039 // environment has been at least partially initialized. Add a stack check | 5039 // environment has been at least partially initialized. Add a stack check |
| 5040 // before entering JS code to catch overflow early. | 5040 // before entering JS code to catch overflow early. |
| 5041 StackLimitCheck check(isolate); | 5041 StackLimitCheck check(isolate); |
| 5042 if (check.HasOverflowed()) { | 5042 if (check.HasOverflowed()) { |
| 5043 isolate->StackOverflow(); | 5043 isolate->StackOverflow(); |
| 5044 return; | 5044 return; |
| 5045 } | 5045 } |
| 5046 | 5046 |
| 5047 const int proxy_size = JSGlobalProxy::SizeWithInternalFields( | 5047 const int proxy_size = JSGlobalProxy::SizeWithEmbedderFields( |
| 5048 global_proxy_template->InternalFieldCount()); | 5048 global_proxy_template->EmbedderFieldCount()); |
| 5049 | 5049 |
| 5050 Handle<JSGlobalProxy> global_proxy; | 5050 Handle<JSGlobalProxy> global_proxy; |
| 5051 if (!maybe_global_proxy.ToHandle(&global_proxy)) { | 5051 if (!maybe_global_proxy.ToHandle(&global_proxy)) { |
| 5052 global_proxy = factory()->NewUninitializedJSGlobalProxy(proxy_size); | 5052 global_proxy = factory()->NewUninitializedJSGlobalProxy(proxy_size); |
| 5053 } | 5053 } |
| 5054 | 5054 |
| 5055 // Create a remote object as the global object. | 5055 // Create a remote object as the global object. |
| 5056 Handle<ObjectTemplateInfo> global_proxy_data = | 5056 Handle<ObjectTemplateInfo> global_proxy_data = |
| 5057 Utils::OpenHandle(*global_proxy_template); | 5057 Utils::OpenHandle(*global_proxy_template); |
| 5058 Handle<FunctionTemplateInfo> global_constructor( | 5058 Handle<FunctionTemplateInfo> global_constructor( |
| 5059 FunctionTemplateInfo::cast(global_proxy_data->constructor())); | 5059 FunctionTemplateInfo::cast(global_proxy_data->constructor())); |
| 5060 | 5060 |
| 5061 Handle<ObjectTemplateInfo> global_object_template( | 5061 Handle<ObjectTemplateInfo> global_object_template( |
| 5062 ObjectTemplateInfo::cast(global_constructor->prototype_template())); | 5062 ObjectTemplateInfo::cast(global_constructor->prototype_template())); |
| 5063 Handle<JSObject> global_object = | 5063 Handle<JSObject> global_object = |
| 5064 ApiNatives::InstantiateRemoteObject( | 5064 ApiNatives::InstantiateRemoteObject( |
| 5065 global_object_template).ToHandleChecked(); | 5065 global_object_template).ToHandleChecked(); |
| 5066 | 5066 |
| 5067 // (Re)initialize the global proxy object. | 5067 // (Re)initialize the global proxy object. |
| 5068 Handle<SharedFunctionInfo> shared = | 5068 Handle<SharedFunctionInfo> shared = |
| 5069 FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, | 5069 FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, |
| 5070 global_constructor); | 5070 global_constructor); |
| 5071 Handle<Map> initial_map = | 5071 Handle<Map> initial_map = |
| 5072 factory()->CreateSloppyFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); | 5072 factory()->CreateSloppyFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); |
| 5073 Handle<JSFunction> global_proxy_function = | 5073 Handle<JSFunction> global_proxy_function = |
| 5074 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 5074 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 5075 initial_map, shared, factory()->undefined_value()); | 5075 initial_map, shared, factory()->undefined_value()); |
| 5076 DCHECK_EQ(global_proxy_data->internal_field_count(), | 5076 DCHECK_EQ(global_proxy_data->embedder_field_count(), |
| 5077 global_proxy_template->InternalFieldCount()); | 5077 global_proxy_template->EmbedderFieldCount()); |
| 5078 Handle<Map> global_proxy_map = isolate->factory()->NewMap( | 5078 Handle<Map> global_proxy_map = isolate->factory()->NewMap( |
| 5079 JS_GLOBAL_PROXY_TYPE, proxy_size, FAST_HOLEY_SMI_ELEMENTS); | 5079 JS_GLOBAL_PROXY_TYPE, proxy_size, FAST_HOLEY_SMI_ELEMENTS); |
| 5080 JSFunction::SetInitialMap(global_proxy_function, global_proxy_map, | 5080 JSFunction::SetInitialMap(global_proxy_function, global_proxy_map, |
| 5081 factory()->null_value()); | 5081 factory()->null_value()); |
| 5082 global_proxy_map->set_is_access_check_needed(true); | 5082 global_proxy_map->set_is_access_check_needed(true); |
| 5083 global_proxy_map->set_has_hidden_prototype(true); | 5083 global_proxy_map->set_has_hidden_prototype(true); |
| 5084 | 5084 |
| 5085 Handle<String> global_name = factory()->global_string(); | 5085 Handle<String> global_name = factory()->global_string(); |
| 5086 global_proxy_function->shared()->set_instance_class_name(*global_name); | 5086 global_proxy_function->shared()->set_instance_class_name(*global_name); |
| 5087 factory()->ReinitializeJSGlobalProxy(global_proxy, global_proxy_function); | 5087 factory()->ReinitializeJSGlobalProxy(global_proxy, global_proxy_function); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5121 } | 5121 } |
| 5122 | 5122 |
| 5123 | 5123 |
| 5124 // Called when the top-level V8 mutex is destroyed. | 5124 // Called when the top-level V8 mutex is destroyed. |
| 5125 void Bootstrapper::FreeThreadResources() { | 5125 void Bootstrapper::FreeThreadResources() { |
| 5126 DCHECK(!IsActive()); | 5126 DCHECK(!IsActive()); |
| 5127 } | 5127 } |
| 5128 | 5128 |
| 5129 } // namespace internal | 5129 } // namespace internal |
| 5130 } // namespace v8 | 5130 } // namespace v8 |
| OLD | NEW |