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

Unified Diff: src/js/array.js

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
Index: src/js/array.js
diff --git a/src/js/array.js b/src/js/array.js
index fca75a3f65f85f32e3300f3669f056793fbf7973..c8b34e053dc5c209b40674781cb545597ee91160 100644
--- a/src/js/array.js
+++ b/src/js/array.js
@@ -1520,11 +1520,15 @@ utils.InstallFunctions(GlobalArray, DONT_ENUM, [
]);
var specialFunctions = %SpecialArrayFunctions();
+var specialExperimentalArrayFunctions = null;
function getFunction(name, jsBuiltin, len) {
var f = jsBuiltin;
if (specialFunctions.hasOwnProperty(name)) {
f = specialFunctions[name];
+ } else if (specialExperimentalArrayFunctions != null &&
+ specialExperimentalArrayFunctions.hasOwnProperty(name)) {
+ f = specialExperimentalArrayFunctions[name];
}
if (!IS_UNDEFINED(len)) {
%FunctionSetLength(f, len);
@@ -1551,7 +1555,6 @@ utils.InstallFunctions(GlobalArray.prototype, DONT_ENUM, [
"splice", getFunction("splice", ArraySplice, 2),
"sort", getFunction("sort", ArraySort),
"filter", getFunction("filter", ArrayFilter, 1),
- "forEach", getFunction("forEach", ArrayForEach, 1),
"some", getFunction("some", ArraySome, 1),
"every", getFunction("every", ArrayEvery, 1),
"map", getFunction("map", ArrayMap, 1),
@@ -1569,6 +1572,17 @@ utils.InstallFunctions(GlobalArray.prototype, DONT_ENUM, [
iteratorSymbol, ArrayValues
]);
+%FunctionRemovePrototype(ArrayForEach);
+
+var specialExperimentalArrayFunctions = null;
+
+function InstallExperimentalArrayFunctions() {
+ specialExperimentalArrayFunctions = %SpecialExperimentalArrayFunctions();
Yang 2017/02/02 10:04:58 Can we have all of this in C++, in the bootstrappe
danno 2017/02/02 17:15:48 Done.
+ utils.InstallFunctions(global.Array.prototype, DONT_ENUM, [
+ "forEach", getFunction("forEach", ArrayForEach, 1),
+ ], false);
+}
+
%FunctionSetName(ArrayValues, "values");
%FinishArrayPrototypeSetup(GlobalArray.prototype);
@@ -1611,6 +1625,7 @@ utils.Export(function(to) {
to.ArrayFrom = ArrayFrom;
to.ArrayJoin = ArrayJoin;
to.ArrayPush = ArrayPush;
+ to.InstallExperimentalArrayFunctions = InstallExperimentalArrayFunctions;
to.ArrayToString = ArrayToString;
to.ArrayValues = ArrayValues;
to.InnerArrayCopyWithin = InnerArrayCopyWithin;
« src/builtins/builtins-array.cc ('K') | « src/flag-definitions.h ('k') | src/js/prologue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698