Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index 4e3c62cfbf8b8513385f922ed0263318248a7b1d..1474d520c86719d93b1ab9e42b2bd8595b5c4a91 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -1012,23 +1012,13 @@ Handle<JSGlobalObject> Genesis::CreateNewGlobals( |
if (js_global_object_template.is_null()) { |
Handle<String> name = Handle<String>(heap()->empty_string()); |
Handle<Code> code = isolate()->builtins()->Illegal(); |
- Handle<JSObject> prototype = |
- factory()->NewFunctionPrototype(isolate()->object_function()); |
js_global_object_function = factory()->NewFunction( |
- name, code, prototype, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize); |
-#ifdef DEBUG |
- LookupIterator it(prototype, factory()->constructor_string(), |
- LookupIterator::OWN_SKIP_INTERCEPTOR); |
- Handle<Object> value = Object::GetProperty(&it).ToHandleChecked(); |
- DCHECK(it.IsFound()); |
- DCHECK_EQ(*isolate()->object_function(), *value); |
-#endif |
+ name, code, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize); |
} else { |
Handle<FunctionTemplateInfo> js_global_object_constructor( |
FunctionTemplateInfo::cast(js_global_object_template->constructor())); |
js_global_object_function = ApiNatives::CreateApiFunction( |
- isolate(), js_global_object_constructor, factory()->the_hole_value(), |
- ApiNatives::GlobalObjectType); |
+ isolate(), js_global_object_constructor, JS_GLOBAL_OBJECT_TYPE); |
} |
js_global_object_function->initial_map()->set_is_prototype_map(true); |
@@ -1049,8 +1039,7 @@ Handle<JSGlobalObject> Genesis::CreateNewGlobals( |
Handle<FunctionTemplateInfo> global_constructor( |
FunctionTemplateInfo::cast(data->constructor())); |
global_proxy_function = ApiNatives::CreateApiFunction( |
- isolate(), global_constructor, factory()->the_hole_value(), |
- ApiNatives::GlobalProxyType); |
+ isolate(), global_constructor, JS_GLOBAL_PROXY_TYPE); |
} |
Handle<String> global_name = factory()->global_string(); |
global_proxy_function->shared()->set_instance_class_name(*global_name); |
@@ -2923,10 +2912,10 @@ bool Genesis::InstallNatives(GlobalContextType context_type) { |
// objects, that JavaScript code may not access. |
Handle<JSFunction> opaque_reference_fun = factory()->NewFunction( |
factory()->empty_string(), isolate()->builtins()->Illegal(), |
- isolate()->initial_object_prototype(), JS_VALUE_TYPE, JSValue::kSize); |
+ JS_VALUE_TYPE, JSValue::kSize); |
Handle<JSObject> prototype = |
factory()->NewJSObject(isolate()->object_function(), TENURED); |
- Accessors::FunctionSetPrototype(opaque_reference_fun, prototype).Assert(); |
+ JSFunction::SetPrototype(opaque_reference_fun, prototype); |
native_context()->set_opaque_reference_function(*opaque_reference_fun); |
} |
@@ -2952,11 +2941,6 @@ bool Genesis::InstallNatives(GlobalContextType context_type) { |
if (!CallUtilsFunction(isolate(), "PostNatives")) return false; |
- auto template_instantiations_cache = UnseededNumberDictionary::New( |
- isolate(), ApiNatives::kInitialFunctionCacheSize); |
- native_context()->set_template_instantiations_cache( |
- *template_instantiations_cache); |
- |
// Store the map for the %ObjectPrototype% after the natives has been compiled |
// and the Object function has been set up. |
Handle<JSFunction> object_function(native_context()->object_function()); |
@@ -3873,6 +3857,14 @@ Genesis::Genesis(Isolate* isolate, |
CreateStrictModeFunctionMaps(empty_function); |
CreateIteratorMaps(empty_function); |
CreateAsyncFunctionMaps(empty_function); |
+ |
+ // Set up the template instantiations cache before creating the globals, |
+ // since they may want to use the cache. |
+ auto template_instantiations_cache = UnseededNumberDictionary::New( |
+ isolate, ApiNatives::kInitialFunctionCacheSize); |
+ native_context()->set_template_instantiations_cache( |
+ *template_instantiations_cache); |
+ |
Handle<JSGlobalObject> global_object = |
CreateNewGlobals(global_proxy_template, global_proxy); |
HookUpGlobalProxy(global_object, global_proxy); |