Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(596)

Unified Diff: src/bootstrapper.cc

Issue 2677653002: Fix receiver checks for v8::Function on a remote context. (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-access-checks.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index f624e52e83ed4aef899380f298acb2f849da353f..b0402fa1de8a8782c4ef0736a22f5c1bde37e6bc 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -4927,11 +4927,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);
@@ -4955,11 +4963,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);
global_proxy_ = global_proxy;
}
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-access-checks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698