| Index: src/bootstrapper.cc
|
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
|
| index 735d0992d7eeab142a438eb1eec93c58220edf41..3492e43ea0e80e96dab5c67b41fc61a1ce866649 100644
|
| --- a/src/bootstrapper.cc
|
| +++ b/src/bootstrapper.cc
|
| @@ -769,16 +769,17 @@ Handle<JSGlobalProxy> Genesis::CreateNewGlobals(
|
| Handle<String> name = Handle<String>(heap()->empty_string());
|
| Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin(
|
| Builtins::kIllegal));
|
| + Handle<JSObject> prototype = factory()->NewFunctionPrototype(
|
| + isolate()->object_function());
|
| js_global_object_function = factory()->NewFunction(
|
| - name, code, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize);
|
| - // Change the constructor property of the prototype of the
|
| - // hidden global function to refer to the Object function.
|
| - Handle<JSObject> prototype =
|
| - Handle<JSObject>(
|
| - JSObject::cast(js_global_object_function->instance_prototype()));
|
| - JSObject::SetOwnPropertyIgnoreAttributes(
|
| - prototype, factory()->constructor_string(),
|
| - isolate()->object_function(), NONE).Check();
|
| + name, code, prototype, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize);
|
| +#ifdef DEBUG
|
| + LookupIterator it(prototype, factory()->constructor_string(),
|
| + LookupIterator::CHECK_OWN_REAL);
|
| + Handle<Object> value = JSReceiver::GetProperty(&it).ToHandleChecked();
|
| + ASSERT(it.IsFound());
|
| + ASSERT_EQ(*isolate()->object_function(), *value);
|
| +#endif
|
| } else {
|
| Handle<FunctionTemplateInfo> js_global_object_constructor(
|
| FunctionTemplateInfo::cast(js_global_object_template->constructor()));
|
| @@ -2136,33 +2137,27 @@ bool Bootstrapper::InstallExtensions(Handle<Context> native_context,
|
|
|
| bool Genesis::InstallSpecialObjects(Handle<Context> native_context) {
|
| Isolate* isolate = native_context->GetIsolate();
|
| + // Don't install extensions into the snapshot.
|
| + if (isolate->serializer_enabled()) return true;
|
| +
|
| Factory* factory = isolate->factory();
|
| HandleScope scope(isolate);
|
| Handle<JSGlobalObject> global(JSGlobalObject::cast(
|
| native_context->global_object()));
|
| +
|
| + Handle<JSObject> Error = Handle<JSObject>::cast(Object::GetProperty(
|
| + isolate, global, "Error").ToHandleChecked());
|
| + Handle<String> name = factory->InternalizeOneByteString(
|
| + STATIC_ASCII_VECTOR("stackTraceLimit"));
|
| + Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit), isolate);
|
| + JSObject::AddProperty(Error, name, stack_trace_limit, NONE);
|
| +
|
| // Expose the natives in global if a name for it is specified.
|
| if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) {
|
| Handle<String> natives =
|
| factory->InternalizeUtf8String(FLAG_expose_natives_as);
|
| - RETURN_ON_EXCEPTION_VALUE(
|
| - isolate,
|
| - JSObject::SetOwnPropertyIgnoreAttributes(
|
| - global, natives, Handle<JSObject>(global->builtins()), DONT_ENUM),
|
| - false);
|
| - }
|
| -
|
| - Handle<Object> Error = Object::GetProperty(
|
| - isolate, global, "Error").ToHandleChecked();
|
| - if (Error->IsJSObject()) {
|
| - Handle<String> name = factory->InternalizeOneByteString(
|
| - STATIC_ASCII_VECTOR("stackTraceLimit"));
|
| - Handle<Smi> stack_trace_limit(
|
| - Smi::FromInt(FLAG_stack_trace_limit), isolate);
|
| - RETURN_ON_EXCEPTION_VALUE(
|
| - isolate,
|
| - JSObject::SetOwnPropertyIgnoreAttributes(
|
| - Handle<JSObject>::cast(Error), name, stack_trace_limit, NONE),
|
| - false);
|
| + JSObject::AddProperty(
|
| + global, natives, handle(global->builtins()), DONT_ENUM);
|
| }
|
|
|
| // Expose the debug global object in global if a name for it is specified.
|
| @@ -2179,11 +2174,7 @@ bool Genesis::InstallSpecialObjects(Handle<Context> native_context) {
|
| Handle<String> debug_string =
|
| factory->InternalizeUtf8String(FLAG_expose_debug_as);
|
| Handle<Object> global_proxy(debug_context->global_proxy(), isolate);
|
| - RETURN_ON_EXCEPTION_VALUE(
|
| - isolate,
|
| - JSObject::SetOwnPropertyIgnoreAttributes(
|
| - global, debug_string, global_proxy, DONT_ENUM),
|
| - false);
|
| + JSObject::AddProperty(global, debug_string, global_proxy, DONT_ENUM);
|
| }
|
| return true;
|
| }
|
|
|