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/js/array.js

Issue 2205883003: Reland [builtins] implement Array.prototype.includes in TurboFan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compiler warning Created 4 years, 4 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 c28f96e8d94eaf3b0553a3abbb2d513804c63808..8fe319e7ad30fb5bee5182848a1993eae76d0a4a 100644
--- a/src/js/array.js
+++ b/src/js/array.js
@@ -1492,47 +1492,6 @@ function ArrayFill(value, start, end) {
}
-function InnerArrayIncludes(searchElement, fromIndex, array, length) {
- if (length === 0) {
- return false;
- }
-
- var n = TO_INTEGER(fromIndex);
-
- var k;
- if (n >= 0) {
- k = n;
- } else {
- k = length + n;
- if (k < 0) {
- k = 0;
- }
- }
-
- while (k < length) {
- var elementK = array[k];
- if (%SameValueZero(searchElement, elementK)) {
- return true;
- }
-
- ++k;
- }
-
- return false;
-}
-
-
-// ES2016 draft, section 22.1.3.11
-function ArrayIncludes(searchElement, fromIndex) {
- CHECK_OBJECT_COERCIBLE(this, "Array.prototype.includes");
-
- var array = TO_OBJECT(this);
- var length = TO_LENGTH(array.length);
-
- return InnerArrayIncludes(searchElement, fromIndex, array, length);
-}
-
-
// ES6, draft 10-14-14, section 22.1.2.1
function ArrayFrom(arrayLike, mapfn, receiver) {
var items = TO_OBJECT(arrayLike);
@@ -1677,7 +1636,7 @@ utils.InstallFunctions(GlobalArray.prototype, DONT_ENUM, [
"find", getFunction("find", ArrayFind, 1),
"findIndex", getFunction("findIndex", ArrayFindIndex, 1),
"fill", getFunction("fill", ArrayFill, 1),
- "includes", getFunction("includes", ArrayIncludes, 1),
+ "includes", getFunction("includes", null, 1)
]);
utils.InstallGetter(GlobalArray, speciesSymbol, ArraySpecies);
@@ -1731,7 +1690,6 @@ utils.Export(function(to) {
to.InnerArrayFind = InnerArrayFind;
to.InnerArrayFindIndex = InnerArrayFindIndex;
to.InnerArrayForEach = InnerArrayForEach;
- to.InnerArrayIncludes = InnerArrayIncludes;
to.InnerArrayIndexOf = InnerArrayIndexOf;
to.InnerArrayJoin = InnerArrayJoin;
to.InnerArrayLastIndexOf = InnerArrayLastIndexOf;
« src/code-stub-assembler.cc ('K') | « src/factory.h ('k') | src/js/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698