Changeset 15468 in webkit for trunk/JavaScriptCore/kjs/array_object.cpp
- Timestamp:
- Jul 16, 2006, 2:06:28 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/array_object.cpp
r15385 r15468 29 29 #include "lookup.h" 30 30 #include "operations.h" 31 #include " reference_list.h"31 #include "PropertyNameArray.h" 32 32 #include <wtf/HashSet.h> 33 33 #include <stdio.h> … … 200 200 } 201 201 202 void ArrayInstance::getProperty List(ReferenceList& propertyList, bool recursive)202 void ArrayInstance::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 203 203 { 204 204 // avoid fetching this every time through the loop 205 JSValue *undefined = jsUndefined(); 206 207 //### FIXME: should avoid duplicates with prototype 205 JSValue* undefined = jsUndefined(); 206 208 207 for (unsigned i = 0; i < storageLength; ++i) { 209 JSValue *imp= storage[i];210 if ( imp && imp != undefined) {211 property List.append(Reference(this,i));212 213 }214 return JSObject::getPropertyList(propertyList, recursive);208 JSValue* value = storage[i]; 209 if (value && value != undefined) 210 propertyNames.add(Identifier::from(i)); 211 } 212 213 JSObject::getPropertyNames(exec, propertyNames); 215 214 } 216 215 … … 244 243 245 244 if (newLength < length) { 246 ReferenceList sparseProperties; 247 248 _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, this); 249 250 ReferenceListIterator it = sparseProperties.begin(); 251 while (it != sparseProperties.end()) { 252 Reference ref = it++; 245 PropertyNameArray sparseProperties; 246 247 _prop.getSparseArrayPropertyNames(sparseProperties); 248 249 PropertyNameArrayIterator end = sparseProperties.end(); 250 251 for (PropertyNameArrayIterator it = sparseProperties.begin(); it != end; ++it) { 252 Identifier name = *it; 253 253 bool ok; 254 unsigned index = ref.getPropertyName().toArrayIndex(&ok); 255 if (ok && index > newLength) { 256 ref.deleteValue(exec); 257 } 254 unsigned index = name.toArrayIndex(&ok); 255 if (ok && index > newLength) 256 deleteProperty(exec, name); 258 257 } 259 258 } … … 361 360 } 362 361 } 363 364 ReferenceList sparseProperties; 365 _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, this); 366 unsigned newLength = o + sparseProperties.length(); 367 368 if (newLength > storageLength) { 369 resizeStorage(newLength); 370 } 371 372 ReferenceListIterator it = sparseProperties.begin(); 373 while (it != sparseProperties.end()) { 374 Reference ref = it++; 375 storage[o] = ref.getValue(exec); 376 JSObject::deleteProperty(exec, ref.getPropertyName()); 377 o++; 362 363 PropertyNameArray sparseProperties; 364 _prop.getSparseArrayPropertyNames(sparseProperties); 365 unsigned newLength = o + sparseProperties.size(); 366 367 if (newLength > storageLength) 368 resizeStorage(newLength); 369 370 PropertyNameArrayIterator end = sparseProperties.end(); 371 for (PropertyNameArrayIterator it = sparseProperties.begin(); it != end; ++it) { 372 Identifier name = *it; 373 storage[o] = get(exec, name); 374 JSObject::deleteProperty(exec, name); 375 o++; 378 376 } 379 377
Note:
See TracChangeset
for help on using the changeset viewer.