Chromium Code Reviews| Index: src/bootstrapper.cc |
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
| index 7ab076aa2d4c5facaba8471d492be81c22a0ba56..e41e43e64c22c444cb65a733ea0ea68e87e1b4d3 100644 |
| --- a/src/bootstrapper.cc |
| +++ b/src/bootstrapper.cc |
| @@ -4779,11 +4779,19 @@ Genesis::Genesis(Isolate* isolate, |
| global_proxy = factory()->NewUninitializedJSGlobalProxy(proxy_size); |
| } |
| - // CreateNewGlobals. |
| + // Create a remote object as the global object. |
| Handle<ObjectTemplateInfo> global_proxy_data = |
| - v8::Utils::OpenHandle(*global_proxy_template); |
| + Utils::OpenHandle(*global_proxy_template); |
| Handle<FunctionTemplateInfo> global_constructor( |
| FunctionTemplateInfo::cast(global_proxy_data->constructor())); |
| + |
| + Handle<ObjectTemplateInfo> global_object_template( |
| + ObjectTemplateInfo::cast(global_constructor->prototype_template())); |
| + Handle<JSObject> global_object = |
| + ApiNatives::InstantiateRemoteObject( |
| + global_object_template).ToHandleChecked(); |
| + |
| + // (Re)initialize the global proxy object. |
| Handle<SharedFunctionInfo> shared = |
| FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, |
| global_constructor); |
| @@ -4807,11 +4815,14 @@ Genesis::Genesis(Isolate* isolate, |
| global_proxy_function->shared()->set_instance_class_name(*global_name); |
| factory()->ReinitializeJSGlobalProxy(global_proxy, global_proxy_function); |
| - // GlobalProxy. |
| + // A remote global proxy has no native context. |
| global_proxy->set_native_context(heap()->null_value()); |
| - // DetachGlobal. |
| - JSObject::ForceSetPrototype(global_proxy, factory()->null_value()); |
| + // Configure the hidden prototype chain of the global proxy. |
| + JSObject::ForceSetPrototype(global_proxy, global_object); |
| + // TODO(dcheng): This is a hack. Why does this need to be manually called |
| + // here? Line 4812 should have taken care of it? |
| + global_proxy->map()->set_has_hidden_prototype(true); |
|
dcheng
2017/02/17 07:29:08
I don't actually understand why this is needed, so
jochen (gone - plz use gerrit)
2017/02/17 08:40:26
ForceSetPrototype creates a new map
dcheng
2017/02/17 10:08:27
Initialization of a full context does this too; ye
|
| global_proxy_ = global_proxy; |
| } |