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

Unified Diff: src/js/typedarray.js

Issue 2733193002: [typedarrays] Move %TypedArray%.prototype.indexOf to C++ (Closed)
Patch Set: Add comments Created 3 years, 9 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/builtins/builtins-typedarray.cc ('K') | « src/builtins/builtins-typedarray.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/typedarray.js
diff --git a/src/js/typedarray.js b/src/js/typedarray.js
index bfbcef60599275725ffb731301cdbfc0b20f389d..e5b14112cc7f2f61329eff8134bad45dd7965e63 100644
--- a/src/js/typedarray.js
+++ b/src/js/typedarray.js
@@ -531,40 +531,6 @@ function TypedArraySort(comparefn) {
}
-// ES6 section 22.2.3.13
-function TypedArrayIndexOf(element, index) {
- if (!IS_TYPEDARRAY(this)) throw %make_type_error(kNotTypedArray);
-
- var length = %_TypedArrayGetLength(this);
-
- if (length === 0) return -1;
- if (!IS_NUMBER(element)) return -1;
- var n = TO_INTEGER(index);
-
- var k;
- if (n === 0) {
- k = 0;
- } else if (n > 0) {
- k = n;
- } else {
- k = length + n;
- if (k < 0) {
- k = 0;
- }
- }
-
- while (k < length) {
- var elementK = this[k];
- if (element === elementK) {
- return k;
- }
- ++k;
- }
- return -1;
-}
-%FunctionSetLength(TypedArrayIndexOf, 1);
-
-
// ES6 section 22.2.3.16
function TypedArrayLastIndexOf(element, index) {
if (!IS_TYPEDARRAY(this)) throw %make_type_error(kNotTypedArray);
@@ -797,7 +763,6 @@ utils.InstallFunctions(GlobalTypedArray.prototype, DONT_ENUM, [
"filter", TypedArrayFilter,
"find", TypedArrayFind,
"findIndex", TypedArrayFindIndex,
- "indexOf", TypedArrayIndexOf,
"join", TypedArrayJoin,
"lastIndexOf", TypedArrayLastIndexOf,
"forEach", TypedArrayForEach,
« src/builtins/builtins-typedarray.cc ('K') | « src/builtins/builtins-typedarray.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698