Changeset 49717 in webkit for trunk/JavaScriptCore/runtime/JSObject.cpp
- Timestamp:
- Oct 16, 2009, 5:28:19 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/JSObject.cpp
r49694 r49717 444 444 void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 445 445 { 446 bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || m_structure->isDictionary());447 448 if (shouldCache) {449 if (PropertyNameArrayData* data = m_structure->enumerationCache()) {450 if (data->cachedPrototypeChain() == m_structure->prototypeChain(exec)) {451 propertyNames.setData(data);452 return;453 }454 455 m_structure->clearEnumerationCache();456 }457 }458 459 446 getOwnPropertyNames(exec, propertyNames); 460 447 461 if (prototype().isObject()) { 462 propertyNames.setShouldCache(false); // No need for our prototypes to waste memory on caching, since they're not being enumerated directly. 463 JSObject* prototype = asObject(this->prototype()); 464 while(1) { 465 if (prototype->structure()->typeInfo().overridesGetPropertyNames()) { 466 prototype->getPropertyNames(exec, propertyNames); 467 break; 468 } 469 prototype->getOwnPropertyNames(exec, propertyNames); 470 JSValue nextProto = prototype->prototype(); 471 if (!nextProto.isObject()) 472 break; 473 prototype = asObject(nextProto); 474 } 475 } 476 477 if (shouldCache) { 478 StructureChain* protoChain = m_structure->prototypeChain(exec); 479 if (!protoChain->isCacheable()) 480 return; 481 RefPtr<PropertyNameArrayData> data = propertyNames.data(); 482 data->setCachedPrototypeChain(protoChain); 483 data->setCachedStructure(m_structure); 484 m_structure->setEnumerationCache(data.release()); 448 if (prototype().isNull()) 449 return; 450 451 JSObject* prototype = asObject(this->prototype()); 452 while(1) { 453 if (prototype->structure()->typeInfo().overridesGetPropertyNames()) { 454 prototype->getPropertyNames(exec, propertyNames); 455 break; 456 } 457 prototype->getOwnPropertyNames(exec, propertyNames); 458 JSValue nextProto = prototype->prototype(); 459 if (nextProto.isNull()) 460 break; 461 prototype = asObject(nextProto); 485 462 } 486 463 }
Note:
See TracChangeset
for help on using the changeset viewer.