Ignore:
Timestamp:
Oct 15, 2005, 5:46:25 PM (20 years ago)
Author:
mjs
Message:

Reverted fix for this bug, because it was part of a time range that caused a performance
regression:

<rdar://problem/4260481> Remove Reference type from JavaScriptCore

File:
1 edited

Legend:

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

    r10744 r10857  
    2929#include "object.h"
    3030#include "operations.h"
     31#include "reference_list.h"
    3132#include "types.h"
    3233#include "value.h"
    33 #include "IdentifierSequencedSet.h"
    3434
    3535#include "array_object.lut.h"
     
    186186}
    187187
    188 void ArrayInstanceImp::getPropertyNames(ExecState *exec, IdentifierSequencedSet& propertyNames)
    189 {
     188ReferenceList ArrayInstanceImp::propList(ExecState *exec, bool recursive)
     189{
     190  ReferenceList properties = ObjectImp::propList(exec,recursive);
     191
    190192  // avoid fetching this every time through the loop
    191193  ValueImp *undefined = jsUndefined();
     
    193195  for (unsigned i = 0; i < storageLength; ++i) {
    194196    ValueImp *imp = storage[i];
    195     if (imp && imp != undefined)
    196       propertyNames.insert(Identifier::from(i));
    197   }
    198 
    199   ObjectImp::getPropertyNames(exec, propertyNames);
     197    if (imp && imp != undefined) {
     198      properties.append(Reference(this, i));
     199    }
     200  }
     201  return properties;
    200202}
    201203
     
    229231
    230232  if (newLength < length) {
    231     IdentifierSequencedSet sparseProperties;
    232    
    233     _prop.getSparseArrayPropertyNames(sparseProperties);
    234 
    235     IdentifierSequencedSetIterator end = sparseProperties.end();
    236    
    237     for (IdentifierSequencedSetIterator it = sparseProperties.begin(); it != end; ++it) {
    238       Identifier name = *it;
     233    ReferenceList sparseProperties;
     234   
     235    _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, this);
     236   
     237    ReferenceListIterator it = sparseProperties.begin();
     238    while (it != sparseProperties.end()) {
     239      Reference ref = it++;
    239240      bool ok;
    240       unsigned index = name.toArrayIndex(&ok);
    241       if (ok && index > newLength)
    242         deleteProperty(exec, name);
     241      unsigned index = ref.getPropertyName(exec).toArrayIndex(&ok);
     242      if (ok && index > newLength) {
     243        ref.deleteValue(exec);
     244      }
    243245    }
    244246  }
     
    347349    }
    348350   
    349     IdentifierSequencedSet sparseProperties;
    350     _prop.getSparseArrayPropertyNames(sparseProperties);
    351     unsigned newLength = o + sparseProperties.size();
    352 
    353     if (newLength > storageLength)
     351    ReferenceList sparseProperties;
     352    _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, this);
     353    unsigned newLength = o + sparseProperties.length();
     354
     355    if (newLength > storageLength) {
    354356      resizeStorage(newLength);
    355 
    356     IdentifierSequencedSetIterator end = sparseProperties.end();
    357     for (IdentifierSequencedSetIterator it = sparseProperties.begin(); it != end; ++it) {
    358       Identifier name = *it;
    359       storage[o] = get(exec, name);
    360       ObjectImp::deleteProperty(exec, name);
     357    }
     358
     359    ReferenceListIterator it = sparseProperties.begin();
     360    while (it != sparseProperties.end()) {
     361      Reference ref = it++;
     362      storage[o] = ref.getValue(exec);
     363      ObjectImp::deleteProperty(exec, ref.getPropertyName(exec));
    361364      o++;
    362365    }
Note: See TracChangeset for help on using the changeset viewer.