Changeset 10857 in webkit for trunk/JavaScriptCore/kjs/array_object.cpp
- Timestamp:
- Oct 15, 2005, 5:46:25 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/array_object.cpp
r10744 r10857 29 29 #include "object.h" 30 30 #include "operations.h" 31 #include "reference_list.h" 31 32 #include "types.h" 32 33 #include "value.h" 33 #include "IdentifierSequencedSet.h"34 34 35 35 #include "array_object.lut.h" … … 186 186 } 187 187 188 void ArrayInstanceImp::getPropertyNames(ExecState *exec, IdentifierSequencedSet& propertyNames) 189 { 188 ReferenceList ArrayInstanceImp::propList(ExecState *exec, bool recursive) 189 { 190 ReferenceList properties = ObjectImp::propList(exec,recursive); 191 190 192 // avoid fetching this every time through the loop 191 193 ValueImp *undefined = jsUndefined(); … … 193 195 for (unsigned i = 0; i < storageLength; ++i) { 194 196 ValueImp *imp = storage[i]; 195 if (imp && imp != undefined) 196 propert yNames.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; 200 202 } 201 203 … … 229 231 230 232 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++; 239 240 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 } 243 245 } 244 246 } … … 347 349 } 348 350 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) { 354 356 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)); 361 364 o++; 362 365 }
Note:
See TracChangeset
for help on using the changeset viewer.