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

Unified Diff: src/js/array.js

Issue 1729653002: Ensure Array.prototype.indexOf returns +0 rather than -0 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Enable test262 tests Created 4 years, 10 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 | « no previous file | test/test262/test262.status » ('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 b8cf3ff5d222a3fb65266a9539890b218b1b30d4..69e770b66cd0187b4a3bfe9cccc4adfadd231128 100644
--- a/src/js/array.js
+++ b/src/js/array.js
@@ -1347,7 +1347,7 @@ function InnerArrayIndexOf(array, element, index, length) {
if (IS_UNDEFINED(index)) {
index = 0;
} else {
- index = TO_INTEGER(index);
+ index = TO_INTEGER(index) + 0; // Add 0 to convert -0 to 0
// If index is negative, index from the end of the array.
if (index < 0) {
index = length + index;
@@ -1409,7 +1409,7 @@ function InnerArrayLastIndexOf(array, element, index, length, argumentsLength) {
if (argumentsLength < 2) {
index = length - 1;
} else {
- index = TO_INTEGER(index);
+ index = TO_INTEGER(index) + 0; // Add 0 to convert -0 to 0
// If index is negative, index from end of the array.
if (index < 0) index += length;
// If index is still negative, do not search the array.
« no previous file with comments | « no previous file | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698