Fix bug 73940.

I think this actually turns the code in question into dead code, because the current definition of UseSparseVariant only allows arrays in DictionaryMode, and these never return encoded ranges from %GetArrayKeys. This is a subtle link between the definition of %GetArrayKeys and UseSparseVariant, so I would prefer to keep the code rather than having an invisible depeendency.

BUG=73940

Review URL: http://codereview.chromium.org/6596004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6946 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
lrn@chromium.org 2011-02-25 11:30:22 +00:00
parent 485f4ea0d9
commit 735dc96461

View File

@ -1017,13 +1017,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 {
@ -1073,13 +1073,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 {