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

Unified Diff: src/bootstrapper.cc

Issue 2099983004: Revert of Refactor CreateApiFunction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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-natives.cc ('k') | src/factory.h » ('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 1474d520c86719d93b1ab9e42b2bd8595b5c4a91..4e3c62cfbf8b8513385f922ed0263318248a7b1d 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1012,13 +1012,23 @@
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, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize);
+ 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
} 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, JS_GLOBAL_OBJECT_TYPE);
+ isolate(), js_global_object_constructor, factory()->the_hole_value(),
+ ApiNatives::GlobalObjectType);
}
js_global_object_function->initial_map()->set_is_prototype_map(true);
@@ -1039,7 +1049,8 @@
Handle<FunctionTemplateInfo> global_constructor(
FunctionTemplateInfo::cast(data->constructor()));
global_proxy_function = ApiNatives::CreateApiFunction(
- isolate(), global_constructor, JS_GLOBAL_PROXY_TYPE);
+ isolate(), global_constructor, factory()->the_hole_value(),
+ ApiNatives::GlobalProxyType);
}
Handle<String> global_name = factory()->global_string();
global_proxy_function->shared()->set_instance_class_name(*global_name);
@@ -2912,10 +2923,10 @@
// objects, that JavaScript code may not access.
Handle<JSFunction> opaque_reference_fun = factory()->NewFunction(
factory()->empty_string(), isolate()->builtins()->Illegal(),
- JS_VALUE_TYPE, JSValue::kSize);
+ isolate()->initial_object_prototype(), JS_VALUE_TYPE, JSValue::kSize);
Handle<JSObject> prototype =
factory()->NewJSObject(isolate()->object_function(), TENURED);
- JSFunction::SetPrototype(opaque_reference_fun, prototype);
+ Accessors::FunctionSetPrototype(opaque_reference_fun, prototype).Assert();
native_context()->set_opaque_reference_function(*opaque_reference_fun);
}
@@ -2940,6 +2951,11 @@
}
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.
@@ -3857,14 +3873,6 @@
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);
« no previous file with comments | « src/api-natives.cc ('k') | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698