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

Unified Diff: src/bootstrapper.cc

Issue 2663033003: [builtins] TurboFan version of Array.prototype.forEach including fast path for FAST_ELEMENTS (Closed)
Patch Set: Review feedback Created 3 years, 10 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 | « no previous file | src/builtins/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 da25d060ff14446258a2760ec2dc8b9dc2379130..e3b1354370bbfd1c52e27a4ac1c35fbdfb6016d0 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -217,6 +217,8 @@ class Genesis BASE_EMBEDDED {
HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION)
#undef DECLARE_FEATURE_INITIALIZATION
+ void InitializeGlobal_enable_fast_array_builtins();
+
Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target,
const char* name, Builtins::Name call,
BuiltinFunctionId id);
@@ -2911,6 +2913,8 @@ void Genesis::InitializeExperimentalGlobal() {
HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL)
HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL)
#undef FEATURE_INITIALIZE_GLOBAL
+
+ InitializeGlobal_enable_fast_array_builtins();
}
@@ -3540,6 +3544,28 @@ void InstallPublicSymbol(Factory* factory, Handle<Context> native_context,
JSObject::AddProperty(symbol, name_string, value, attributes);
}
+void Genesis::InitializeGlobal_enable_fast_array_builtins() {
+ if (!FLAG_enable_fast_array_builtins) return;
+
+ Handle<JSGlobalObject> global(native_context()->global_object());
+ Isolate* isolate = global->GetIsolate();
+ Factory* factory = isolate->factory();
+
+ LookupIterator it1(global, factory->NewStringFromAsciiChecked("Array"),
+ LookupIterator::OWN_SKIP_INTERCEPTOR);
+ Handle<Object> array_object = Object::GetProperty(&it1).ToHandleChecked();
+ LookupIterator it2(array_object,
+ factory->NewStringFromAsciiChecked("prototype"),
+ LookupIterator::OWN_SKIP_INTERCEPTOR);
+ Handle<Object> array_prototype = Object::GetProperty(&it2).ToHandleChecked();
+ LookupIterator it3(array_prototype,
+ factory->NewStringFromAsciiChecked("forEach"),
+ LookupIterator::OWN_SKIP_INTERCEPTOR);
+ Handle<Object> for_each_function =
+ Object::GetProperty(&it3).ToHandleChecked();
+ Handle<JSFunction>::cast(for_each_function)
+ ->set_code(isolate->builtins()->builtin(Builtins::kArrayForEach));
+}
void Genesis::InitializeGlobal_harmony_sharedarraybuffer() {
if (!FLAG_harmony_sharedarraybuffer) return;
« no previous file with comments | « no previous file | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698