Index: src/array.js |
diff --git a/src/array.js b/src/array.js |
index ef82674d789e2460e10cc2cf5fc995a7ae6bdbc2..182cc7a16b65cecab8c74cd2d0a481f8e5126f81 100644 |
--- a/src/array.js |
+++ b/src/array.js |
@@ -1018,13 +1018,13 @@ function ArrayIndexOf(element, index) { |
} |
var min = index; |
var max = length; |
- if (UseSparseVariant(this, length, true)) { |
+ if (UseSparseVariant(this, length, IS_ARRAY(this))) { |
var intervals = %GetArrayKeys(this, length); |
if (intervals.length == 2 && intervals[0] < 0) { |
// A single interval. |
var intervalMin = -(intervals[0] + 1); |
var intervalMax = intervalMin + intervals[1]; |
- min = MAX(min, intervalMin); |
+ if (min < intervalMin) min = intervalMin; |
max = intervalMax; // Capped by length already. |
// Fall through to loop below. |
} else { |
@@ -1074,13 +1074,13 @@ function ArrayLastIndexOf(element, index) { |
} |
var min = 0; |
var max = index; |
- if (UseSparseVariant(this, length, true)) { |
+ if (UseSparseVariant(this, length, IS_ARRAY(this))) { |
var intervals = %GetArrayKeys(this, index + 1); |
if (intervals.length == 2 && intervals[0] < 0) { |
// A single interval. |
var intervalMin = -(intervals[0] + 1); |
var intervalMax = intervalMin + intervals[1]; |
- min = MAX(min, intervalMin); |
+ if (min < intervalMin) min = intervalMin; |
max = intervalMax; // Capped by index already. |
// Fall through to loop below. |
} else { |