Changeset 54129 in webkit for trunk/JavaScriptCore/runtime/Structure.cpp
- Timestamp:
- Feb 1, 2010, 1:43:01 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Structure.cpp
r54100 r54129 124 124 } 125 125 126 Structure::Structure(JSValue prototype, const TypeInfo& typeInfo )126 Structure::Structure(JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount) 127 127 : m_typeInfo(typeInfo) 128 128 , m_prototype(prototype) … … 136 136 , m_attributesInPrevious(0) 137 137 , m_specificFunctionThrashCount(0) 138 , m_anonymousSlotCount(anonymousSlotCount) 138 139 { 139 140 ASSERT(m_prototype); … … 272 273 rehashPropertyMapHashTable(sizeForKeyCount(m_offset + 1)); // This could be made more efficient by combining with the copy above. 273 274 } 274 275 276 m_propertyTable->anonymousSlotCount = m_anonymousSlotCount; 275 277 for (ptrdiff_t i = structures.size() - 2; i >= 0; --i) { 276 278 structure = structures[i]; … … 367 369 } 368 370 369 RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo() );371 RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo(), structure->anonymousSlotCount()); 370 372 371 373 transition->m_cachedPrototypeChain = structure->m_cachedPrototypeChain; … … 380 382 381 383 if (structure->m_propertyTable) { 384 ASSERT(structure->m_propertyTable->anonymousSlotCount == structure->m_anonymousSlotCount); 382 385 if (structure->m_isPinnedPropertyTable) 383 386 transition->m_propertyTable = structure->copyPropertyTable(); … … 398 401 399 402 transition->m_offset = offset; 400 403 ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); 401 404 structure->table.add(make_pair(propertyName.ustring().rep(), attributes), transition.get(), specificValue); 402 405 return transition.release(); … … 416 419 PassRefPtr<Structure> Structure::changePrototypeTransition(Structure* structure, JSValue prototype) 417 420 { 418 RefPtr<Structure> transition = create(prototype, structure->typeInfo() );421 RefPtr<Structure> transition = create(prototype, structure->typeInfo(), structure->anonymousSlotCount()); 419 422 420 423 transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; … … 428 431 transition->m_propertyTable = structure->copyPropertyTable(); 429 432 transition->m_isPinnedPropertyTable = true; 430 433 434 ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); 431 435 return transition.release(); 432 436 } … … 435 439 { 436 440 ASSERT(structure->m_specificFunctionThrashCount < maxSpecificFunctionThrashCount); 437 RefPtr<Structure> transition = create(structure->storedPrototype(), structure->typeInfo() );441 RefPtr<Structure> transition = create(structure->storedPrototype(), structure->typeInfo(), structure->anonymousSlotCount()); 438 442 439 443 transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; … … 454 458 ASSERT_UNUSED(removed, removed); 455 459 } 456 460 461 ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); 457 462 return transition.release(); 458 463 } … … 460 465 PassRefPtr<Structure> Structure::getterSetterTransition(Structure* structure) 461 466 { 462 RefPtr<Structure> transition = create(structure->storedPrototype(), structure->typeInfo() );467 RefPtr<Structure> transition = create(structure->storedPrototype(), structure->typeInfo(), structure->anonymousSlotCount()); 463 468 transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; 464 469 transition->m_hasGetterSetterProperties = transition->m_hasGetterSetterProperties; … … 471 476 transition->m_propertyTable = structure->copyPropertyTable(); 472 477 transition->m_isPinnedPropertyTable = true; 473 478 479 ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); 474 480 return transition.release(); 475 481 } … … 479 485 ASSERT(!structure->isUncacheableDictionary()); 480 486 481 RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo() );487 RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo(), structure->anonymousSlotCount()); 482 488 transition->m_dictionaryKind = kind; 483 489 transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; … … 490 496 transition->m_isPinnedPropertyTable = true; 491 497 498 ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); 492 499 return transition.release(); 493 500 } … … 523 530 // reorder the storage, so we have to copy the current values out 524 531 Vector<JSValue> values(propertyCount); 532 ASSERT(m_propertyTable->anonymousSlotCount == m_anonymousSlotCount); 525 533 unsigned anonymousSlotCount = m_propertyTable->anonymousSlotCount; 526 534 for (unsigned i = 0; i < propertyCount; i++) { … … 613 621 if (!m_propertyTable) 614 622 return 0; 615 623 624 ASSERT(m_propertyTable->anonymousSlotCount == m_anonymousSlotCount); 616 625 size_t tableSize = PropertyMapHashTable::allocationSize(m_propertyTable->size); 617 626 PropertyMapHashTable* newTable = static_cast<PropertyMapHashTable*>(fastMalloc(tableSize)); … … 755 764 if (!m_propertyTable) 756 765 createPropertyMapHashTable(); 766 ASSERT(m_propertyTable->anonymousSlotCount == m_anonymousSlotCount); 757 767 758 768 // FIXME: Consider a fast case for tables with no deleted sentinels. … … 849 859 if (!m_propertyTable) 850 860 return notFound; 851 861 862 ASSERT(m_propertyTable->anonymousSlotCount == m_anonymousSlotCount); 852 863 #if DUMP_PROPERTYMAP_STATS 853 864 ++numProbes; … … 913 924 { 914 925 ASSERT(m_propertyTable); 915 926 927 ASSERT(m_propertyTable->anonymousSlotCount == m_anonymousSlotCount); 916 928 unsigned i = entry.key->existingHash(); 917 929 unsigned k = 0; … … 963 975 m_propertyTable->size = newTableSize; 964 976 m_propertyTable->sizeMask = newTableSize - 1; 977 m_propertyTable->anonymousSlotCount = m_anonymousSlotCount; 965 978 966 979 checkConsistency();
Note:
See TracChangeset
for help on using the changeset viewer.