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

Unified Diff: src/bootstrapper.cc

Issue 1132513003: Call builtin code wrapped in functions from the bootstrapper. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix extra natives Created 5 years, 7 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/arraybuffer.js ('k') | src/collection.js » ('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 d6678b81a7aa9175d6478df8e9898ba643b82301..eb0c396cc3e1f3f0fd15c839e5b9c0edd065f9f8 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1547,8 +1547,22 @@ bool Genesis::CompileScriptCached(Isolate* isolate,
? top_context->builtins()
: top_context->global_object(),
isolate);
- return !Execution::Call(
- isolate, fun, receiver, 0, NULL).is_null();
+ MaybeHandle<Object> result;
+ if (extension == NULL) {
+ // For non-extension scripts, run script to get the function wrapper.
+ Handle<Object> wrapper;
+ if (!Execution::Call(isolate, fun, receiver, 0, NULL).ToHandle(&wrapper)) {
+ return false;
+ }
+ // Then run the function wrapper.
+ Handle<Object> global_obj(top_context->global_object(), isolate);
+ Handle<Object> args[] = {global_obj};
+ result = Execution::Call(isolate, Handle<JSFunction>::cast(wrapper),
+ receiver, arraysize(args), args);
+ } else {
+ result = Execution::Call(isolate, fun, receiver, 0, NULL);
+ }
+ return !result.is_null();
}
@@ -1889,16 +1903,9 @@ bool Genesis::InstallNatives() {
builtins->set_global_proxy(native_context()->global_proxy());
- // Set up the 'global' properties of the builtins object. The
- // 'global' property that refers to the global object is the only
- // way to get from code running in the builtins context to the
- // global object.
+ // Set up the 'builtin' property, which refers to the js builtins object.
static const PropertyAttributes attributes =
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
- Handle<String> global_string =
- factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("global"));
- Handle<Object> global_obj(native_context()->global_object(), isolate());
- JSObject::AddProperty(builtins, global_string, global_obj, attributes);
Handle<String> builtins_string =
factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("builtins"));
JSObject::AddProperty(builtins, builtins_string, builtins, attributes);
« no previous file with comments | « src/arraybuffer.js ('k') | src/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698