Ignore:
Timestamp:
Nov 23, 2002, 11:49:26 PM (23 years ago)
Author:
mjs
Message:
  • completed Darin's mostly-fix for 3037795 - Resource use increases when accessing very high index value in array

The two missing pieces were handling sparse properties when
shrinking the array, and when sorting. Thse are now both taken
care of.

  • kjs/array_instance.h:
  • kjs/array_object.cpp: (ArrayInstanceImp::put): (ArrayInstanceImp::deleteProperty): (ArrayInstanceImp::resizeStorage): (ArrayInstanceImp::setLength): (ArrayInstanceImp::sort): (ArrayInstanceImp::pushUndefinedObjectsToEnd):
  • kjs/identifier.h:
  • kjs/object.h:
  • kjs/property_map.cpp:
  • kjs/property_map.h:
  • kjs/reference_list.cpp: (ReferenceList::append): (ReferenceList::length):
  • kjs/reference_list.h:
  • kjs/ustring.cpp: (UString::toUInt32):
  • kjs/ustring.h:
File:
1 edited

Legend:

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

    r2834 r2846  
    370370}
    371371
     372void PropertyMap::addSparseArrayPropertiesToReferenceList(ReferenceList &list, const Object &base) const
     373{
     374#if USE_SINGLE_ENTRY
     375    UString::Rep *key = _singleEntry.key;
     376    if (key) {
     377      UString k(key);
     378      bool fitsInUInt32;
     379      k.toUInt32(&fitsInUInt32);
     380      if (fitsInUInt32) {
     381        list.append(Reference(base, Identifier(key)));
     382      }
     383    }
     384#endif
     385    if (!_table) {
     386      return;
     387    }
     388
     389    for (int i = 0; i != _table->size; ++i) {
     390      UString::Rep *key = _table->entries[i].key;
     391      if (key) {
     392        UString k(key);
     393        bool fitsInUInt32;
     394        k.toUInt32(&fitsInUInt32);
     395        if (fitsInUInt32) {
     396          list.append(Reference(base, Identifier(key)));
     397        }
     398      }
     399    }
     400}
     401
    372402void PropertyMap::save(SavedProperties &p) const
    373403{
Note: See TracChangeset for help on using the changeset viewer.