Changeset 10744 in webkit for trunk/JavaScriptCore/kjs/array_object.cpp
- Timestamp:
- Oct 5, 2005, 1:05:44 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/array_object.cpp
r10701 r10744 29 29 #include "object.h" 30 30 #include "operations.h" 31 #include "reference_list.h"32 31 #include "types.h" 33 32 #include "value.h" 33 #include "IdentifierSequencedSet.h" 34 34 35 35 #include "array_object.lut.h" … … 186 186 } 187 187 188 ReferenceList ArrayInstanceImp::propList(ExecState *exec, bool recursive) 189 { 190 ReferenceList properties = ObjectImp::propList(exec,recursive); 191 188 void ArrayInstanceImp::getPropertyNames(ExecState *exec, IdentifierSequencedSet& propertyNames) 189 { 192 190 // avoid fetching this every time through the loop 193 191 ValueImp *undefined = jsUndefined(); … … 195 193 for (unsigned i = 0; i < storageLength; ++i) { 196 194 ValueImp *imp = storage[i]; 197 if (imp && imp != undefined) {198 propert ies.append(Reference(this,i));199 200 } 201 return properties;195 if (imp && imp != undefined) 196 propertyNames.insert(Identifier::from(i)); 197 } 198 199 ObjectImp::getPropertyNames(exec, propertyNames); 202 200 } 203 201 … … 231 229 232 230 if (newLength < length) { 233 ReferenceList sparseProperties; 234 235 _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, this); 236 237 ReferenceListIterator it = sparseProperties.begin(); 238 while (it != sparseProperties.end()) { 239 Reference ref = it++; 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; 240 239 bool ok; 241 unsigned index = ref.getPropertyName(exec).toArrayIndex(&ok); 242 if (ok && index > newLength) { 243 ref.deleteValue(exec); 244 } 240 unsigned index = name.toArrayIndex(&ok); 241 if (ok && index > newLength) 242 deleteProperty(exec, name); 245 243 } 246 244 } … … 349 347 } 350 348 351 ReferenceList sparseProperties;352 _prop. addSparseArrayPropertiesToReferenceList(sparseProperties, this);353 unsigned newLength = o + sparseProperties. length();354 355 if (newLength > storageLength) {349 IdentifierSequencedSet sparseProperties; 350 _prop.getSparseArrayPropertyNames(sparseProperties); 351 unsigned newLength = o + sparseProperties.size(); 352 353 if (newLength > storageLength) 356 354 resizeStorage(newLength); 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)); 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); 364 361 o++; 365 362 }
Note:
See TracChangeset
for help on using the changeset viewer.