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

Unified Diff: src/js/array.js

Issue 2744283002: [typedarrays] Implement %TypedArray%.prototype.lastIndexOf in C++ (Closed)
Patch Set: Correct integral value check 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
« no previous file with comments | « src/elements.cc ('k') | src/js/typedarray.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/array.js
diff --git a/src/js/array.js b/src/js/array.js
index 88e8cb3ea7dcfe6ab10e5514f777100d135f7980..0af620c48d4ec2633accf39f9807c1b11ebf880a 100644
--- a/src/js/array.js
+++ b/src/js/array.js
@@ -1134,9 +1134,14 @@ function ArrayMap(f, receiver) {
}
-function InnerArrayLastIndexOf(array, element, index, length, argumentsLength) {
+function ArrayLastIndexOf(element, index) {
+ CHECK_OBJECT_COERCIBLE(this, "Array.prototype.lastIndexOf");
+
+ var array = this;
+ var length = TO_LENGTH(this.length);
+
if (length == 0) return -1;
- if (argumentsLength < 2) {
+ if (arguments.length < 2) {
index = length - 1;
} else {
index = INVERT_NEG_ZERO(TO_INTEGER(index));
@@ -1184,15 +1189,6 @@ function InnerArrayLastIndexOf(array, element, index, length, argumentsLength) {
}
-function ArrayLastIndexOf(element, index) {
- CHECK_OBJECT_COERCIBLE(this, "Array.prototype.lastIndexOf");
-
- var length = TO_LENGTH(this.length);
- return InnerArrayLastIndexOf(this, element, index, length,
- arguments.length);
-}
-
-
function InnerArrayReduce(callback, current, array, length, argumentsLength) {
if (!IS_CALLABLE(callback)) {
throw %make_type_error(kCalledNonCallable, callback);
@@ -1628,7 +1624,6 @@ utils.Export(function(to) {
to.InnerArrayFindIndex = InnerArrayFindIndex;
to.InnerArrayForEach = InnerArrayForEach;
to.InnerArrayJoin = InnerArrayJoin;
- to.InnerArrayLastIndexOf = InnerArrayLastIndexOf;
to.InnerArrayReduce = InnerArrayReduce;
to.InnerArrayReduceRight = InnerArrayReduceRight;
to.InnerArraySome = InnerArraySome;
« no previous file with comments | « src/elements.cc ('k') | src/js/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698