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

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: Disable 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
Index: src/runtime/runtime-array.cc
diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc
index 20cd65974c0fcaa67e38c823b246b36e073bf970..677b42ec17c4617862ea619052370baff3ae76f6 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,20 @@ RUNTIME_FUNCTION(Runtime_SpecialArrayFunctions) {
kArrayValues);
InstallBuiltin(isolate, holder, "entries", Builtins::kArrayPrototypeEntries,
0, kArrayEntries);
-
return *holder;
}
+RUNTIME_FUNCTION(Runtime_SpecialExperimentalArrayFunctions) {
Yang 2017/02/03 10:20:25 This is no longer necessary, is it?
danno 2017/02/03 12:46:55 Done.
+ 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,
+ ForEachDescriptor::kStackParameterCount);
+ }
+ return *holder;
+}
RUNTIME_FUNCTION(Runtime_FixedArrayGet) {
SealHandleScope shs(isolate);

Powered by Google App Engine
This is Rietveld 408576698