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

Unified Diff: src/bootstrapper.cc

Issue 1448933002: Introduce a BuiltinsConstructStub that sets up new.target and does a [[call]] per ES6 9.3.2 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/arm64/builtins-arm64.cc ('k') | src/builtins.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 29bff36d2cfbfc3c79f3119ef901469fde892c24..57c085e6e03423af3dfd952f648ab3ededf3c084 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1102,6 +1102,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
empty_function, Builtins::kIllegal);
function_function->initial_map()->set_is_callable();
function_function->initial_map()->set_is_constructor(true);
+ function_function->shared()->set_construct_stub(
+ isolate->builtins()->builtin(Builtins::kJSBuiltinsConstructStub));
{ // --- A r r a y ---
Handle<JSFunction> array_function =
@@ -1158,6 +1160,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
isolate->initial_object_prototype(),
Builtins::kIllegal);
native_context()->set_number_function(*number_fun);
+ number_fun->shared()->set_construct_stub(
+ isolate->builtins()->builtin(Builtins::kJSBuiltinsConstructStub));
}
{ // --- B o o l e a n ---
@@ -1208,8 +1212,11 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
{ // --- D a t e ---
// Builtin functions for Date.prototype.
- InstallFunction(global, "Date", JS_DATE_TYPE, JSDate::kSize,
- isolate->initial_object_prototype(), Builtins::kIllegal);
+ Handle<JSFunction> date_fun = InstallFunction(
+ global, "Date", JS_DATE_TYPE, JSDate::kSize,
+ isolate->initial_object_prototype(), Builtins::kIllegal);
+ date_fun->shared()->set_construct_stub(
+ isolate->builtins()->builtin(Builtins::kJSBuiltinsConstructStub));
}
{ // -- R e g E x p
@@ -1219,6 +1226,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
isolate->initial_object_prototype(),
Builtins::kIllegal);
native_context()->set_regexp_function(*regexp_fun);
+ regexp_fun->shared()->set_construct_stub(
+ isolate->builtins()->builtin(Builtins::kJSBuiltinsConstructStub));
DCHECK(regexp_fun->has_initial_map());
Handle<Map> initial_map(regexp_fun->initial_map());
@@ -1298,6 +1307,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
isolate->initial_object_prototype(),
Builtins::kIllegal);
native_context()->set_data_view_fun(*data_view_fun);
+ data_view_fun->shared()->set_construct_stub(
+ isolate->builtins()->builtin(Builtins::kJSBuiltinsConstructStub));
}
{ // -- M a p
@@ -1841,6 +1852,8 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Builtins::kIllegal, kUseStrictFunctionMap);
generator_function_function->initial_map()->set_is_callable();
generator_function_function->initial_map()->set_is_constructor(true);
+ generator_function_function->shared()->set_construct_stub(
+ isolate->builtins()->builtin(Builtins::kJSBuiltinsConstructStub));
}
{ // -- S e t I t e r a t o r
@@ -2191,8 +2204,14 @@ void Genesis::InitializeGlobal_harmony_proxies() {
Handle<JSGlobalObject> global(
JSGlobalObject::cast(native_context()->global_object()));
Isolate* isolate = global->GetIsolate();
- InstallFunction(global, "Proxy", JS_PROXY_TYPE, JSProxy::kSize,
- isolate->initial_object_prototype(), Builtins::kIllegal);
+ Handle<JSFunction> proxy_fun =
+ InstallFunction(global, "Proxy", JS_PROXY_TYPE, JSProxy::kSize,
+ isolate->initial_object_prototype(), Builtins::kIllegal);
+ // TODO(verwaest): Set to null in InstallFunction.
+ proxy_fun->initial_map()->set_prototype(isolate->heap()->null_value());
+ proxy_fun->shared()->set_construct_stub(
+ isolate->builtins()->builtin(Builtins::kJSBuiltinsConstructStub));
+ native_context()->set_proxy_function(*proxy_fun);
}
@@ -2438,6 +2457,18 @@ bool Genesis::InstallNatives(ContextType context_type) {
apply->shared()->set_length(2);
}
+ // Set up the Promise constructor.
+ {
+ Handle<String> key = factory()->Promise_string();
+ Handle<JSFunction> function = Handle<JSFunction>::cast(
+ Object::GetProperty(handle(native_context()->global_object()), key)
+ .ToHandleChecked());
+ JSFunction::EnsureHasInitialMap(function);
+ function->initial_map()->set_instance_type(JS_PROMISE_TYPE);
+ function->shared()->set_construct_stub(
+ isolate()->builtins()->builtin(Builtins::kJSBuiltinsConstructStub));
+ }
+
InstallBuiltinFunctionIds();
// Create a constructor for RegExp results (a variant of Array that
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698