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

Unified Diff: src/js/array.js

Issue 1950073002: Convert negative zero in ArraySpeciesCreate (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Re-use macro in another location Created 4 years, 7 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 | src/js/macros.py » ('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 8c1a0aefa66bcc82ab154b7ab43723f58b284d24..0a77b23ca356b69dceb9ae1acb9f1cbbf2ffa369 100644
--- a/src/js/array.js
+++ b/src/js/array.js
@@ -43,6 +43,9 @@ utils.ImportFromExperimental(function(from) {
function ArraySpeciesCreate(array, length) {
var constructor;
+
+ length = INVERT_NEG_ZERO(length);
+
if (FLAG_harmony_species) {
constructor = %ArraySpeciesConstructor(array);
} else {
@@ -1193,7 +1196,7 @@ function InnerArrayIndexOf(array, element, index, length) {
if (IS_UNDEFINED(index)) {
index = 0;
} else {
- index = TO_INTEGER(index) + 0; // Add 0 to convert -0 to 0
+ index = INVERT_NEG_ZERO(TO_INTEGER(index));
// If index is negative, index from the end of the array.
if (index < 0) {
index = length + index;
@@ -1255,7 +1258,7 @@ function InnerArrayLastIndexOf(array, element, index, length, argumentsLength) {
if (argumentsLength < 2) {
index = length - 1;
} else {
- index = TO_INTEGER(index) + 0; // Add 0 to convert -0 to 0
+ index = INVERT_NEG_ZERO(TO_INTEGER(index));
// 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 | src/js/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698