| Index: src/bootstrapper.cc
|
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
|
| index 9eca9e8dddd2a057b446046875468a9503d1f1be..82a02f13549b6c5d27231d67867f8bac364ae5f6 100644
|
| --- a/src/bootstrapper.cc
|
| +++ b/src/bootstrapper.cc
|
| @@ -1514,8 +1514,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();
|
| }
|
|
|
|
|
| @@ -1862,10 +1876,6 @@ bool Genesis::InstallNatives() {
|
| // global 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);
|
|
|