Ignore:
Timestamp:
Dec 3, 2007, 7:46:14 AM (17 years ago)
Author:
Darin Adler
Message:

JavaScriptCore:

Reviewed by Mitz.

Test: fast/js/sparse-array.html

  • kjs/array_instance.cpp: (KJS::ArrayInstance::inlineGetOwnPropertySlot): Check sparse array cutoff before looking in hash map. Can't avoid the branch because we can't look for 0 in the hash. (KJS::ArrayInstance::deleteProperty): Ditto.

LayoutTests:

Reviewed by Mitz.

  • fast/js/resources/sparse-array.js: Added.
  • fast/js/sparse-array-expected.txt: Added.
  • fast/js/sparse-array.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/array_instance.cpp

    r28110 r28346  
    152152        }
    153153    } else if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
    154         SparseArrayValueMap::iterator it = map->find(i);
    155         if (it != map->end()) {
    156             slot.setValueSlot(this, &it->second);
    157             return true;
     154        if (i >= sparseArrayCutoff) {
     155            SparseArrayValueMap::iterator it = map->find(i);
     156            if (it != map->end()) {
     157                slot.setValueSlot(this, &it->second);
     158                return true;
     159            }
    158160        }
    159161    }
     
    319321
    320322    if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
    321         SparseArrayValueMap::iterator it = map->find(i);
    322         if (it != map->end()) {
    323             map->remove(it);
    324             return true;
     323        if (i >= sparseArrayCutoff) {
     324            SparseArrayValueMap::iterator it = map->find(i);
     325            if (it != map->end()) {
     326                map->remove(it);
     327                return true;
     328            }
    325329        }
    326330    }
Note: See TracChangeset for help on using the changeset viewer.