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

Unified Diff: src/runtime/runtime-array.cc

Issue 2663033003: [builtins] TurboFan version of Array.prototype.forEach including fast path for FAST_ELEMENTS (Closed)
Patch Set: Rebase on ToT Created 3 years, 11 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
« src/js/array.js ('K') | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-array.cc
diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc
index 20cd65974c0fcaa67e38c823b246b36e073bf970..8598559931f4211c3c115fc07ec499298b872351 100644
--- a/src/runtime/runtime-array.cc
+++ b/src/runtime/runtime-array.cc
@@ -37,7 +37,7 @@ static void InstallCode(
BuiltinFunctionId id = static_cast<BuiltinFunctionId>(-1)) {
Handle<String> key = isolate->factory()->InternalizeUtf8String(name);
Handle<JSFunction> optimized =
- isolate->factory()->NewFunctionWithoutPrototype(key, code);
+ isolate->factory()->NewFunctionWithoutPrototype(key, code, true);
if (argc < 0) {
optimized->shared()->DontAdaptArguments();
} else {
@@ -46,6 +46,8 @@ static void InstallCode(
if (id >= 0) {
optimized->shared()->set_builtin_function_id(id);
}
+ optimized->shared()->set_language_mode(STRICT);
+ optimized->shared()->set_native(true);
JSObject::AddProperty(holder, key, optimized, NONE);
}
@@ -78,10 +80,19 @@ RUNTIME_FUNCTION(Runtime_SpecialArrayFunctions) {
kArrayValues);
InstallBuiltin(isolate, holder, "entries", Builtins::kArrayPrototypeEntries,
0, kArrayEntries);
-
return *holder;
}
+RUNTIME_FUNCTION(Runtime_SpecialExperimentalArrayFunctions) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(0, args.length());
+ Handle<JSObject> holder =
+ isolate->factory()->NewJSObject(isolate->object_function());
+ if (FLAG_enable_fast_array_builtins) {
+ InstallBuiltin(isolate, holder, "forEach", Builtins::kArrayForEach);
+ }
+ return *holder;
+}
RUNTIME_FUNCTION(Runtime_FixedArrayGet) {
SealHandleScope shs(isolate);
« src/js/array.js ('K') | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698