Changeset 39593 in webkit for trunk/JavaScriptCore
- Timestamp:
- Jan 4, 2009, 4:18:53 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r39585 r39593 1 2009-01-04 Alice Liu <[email protected]> 2 3 <rdar://problem/6341776> Merge m_transitionCount and m_offset in Structure. 4 5 Reviewed by Darin Adler. 6 7 * runtime/Structure.cpp: 8 (JSC::Structure::Structure): Remove m_transitionCount 9 (JSC::Structure::addPropertyTransitionToExistingStructure): No need to wait until after the assignment to offset to assert if it's notFound; move it up. 10 (JSC::Structure::addPropertyTransition): Use method for transitionCount instead of m_transitionCount. Remove line that maintains the m_transitionCount. 11 (JSC::Structure::changePrototypeTransition): Remove line that maintains the m_transitionCount. 12 (JSC::Structure::getterSetterTransition): Remove line that maintains the m_transitionCount. 13 * runtime/Structure.h: 14 Changed s_maxTransitionLength and m_offset from size_t to signed char. m_offset will never become greater than 64 15 because the structure transitions to a dictionary at that time. 16 (JSC::Structure::transitionCount): method to replace the data member 17 1 18 2009-01-04 Darin Adler <[email protected]> 2 19 -
trunk/JavaScriptCore/runtime/Structure.cpp
r39505 r39593 48 48 49 49 using namespace std; 50 using WTF::doubleHash;50 using namespace WTF; 51 51 52 52 namespace JSC { … … 127 127 , m_previous(0) 128 128 , m_nameInPrevious(0) 129 , m_transitionCount(0)130 129 , m_propertyTable(0) 131 130 , m_propertyStorageCapacity(JSObject::inlineStorageCapacity) 132 , m_offset( WTF::notFound)131 , m_offset(noOffset) 133 132 , m_isDictionary(false) 134 133 , m_isPinnedPropertyTable(false) … … 238 237 static unsigned sizeForKeyCount(size_t keyCount) 239 238 { 240 if (keyCount == WTF::notFound)239 if (keyCount == notFound) 241 240 return newTableSize; 242 241 … … 362 361 Structure* existingTransition = structure->m_transitions.singleTransition; 363 362 if (existingTransition && existingTransition->m_nameInPrevious.get() == propertyName.ustring().rep() && existingTransition->m_attributesInPrevious == attributes) { 363 ASSERT(structure->m_transitions.singleTransition->m_offset != noOffset); 364 364 offset = structure->m_transitions.singleTransition->m_offset; 365 ASSERT(offset != WTF::notFound);366 365 return existingTransition; 367 366 } 368 367 } else { 369 368 if (Structure* existingTransition = structure->m_transitions.table->get(make_pair(propertyName.ustring().rep(), attributes))) { 369 ASSERT(existingTransition->m_offset != noOffset); 370 370 offset = existingTransition->m_offset; 371 ASSERT(offset != WTF::notFound);372 371 return existingTransition; 373 372 } … … 383 382 ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, offset)); 384 383 385 if (structure-> m_transitionCount> s_maxTransitionLength) {384 if (structure->transitionCount() > s_maxTransitionLength) { 386 385 RefPtr<Structure> transition = toDictionaryTransition(structure); 387 386 offset = transition->put(propertyName, attributes); … … 396 395 transition->m_nameInPrevious = propertyName.ustring().rep(); 397 396 transition->m_attributesInPrevious = attributes; 398 transition->m_transitionCount = structure->m_transitionCount + 1;399 397 transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; 400 398 transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; … … 451 449 RefPtr<Structure> transition = create(prototype, structure->typeInfo()); 452 450 453 transition->m_transitionCount = structure->m_transitionCount + 1;454 451 transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; 455 452 transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; … … 467 464 { 468 465 RefPtr<Structure> transition = create(structure->storedPrototype(), structure->typeInfo()); 469 transition->m_transitionCount = structure->m_transitionCount + 1;470 466 transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; 471 467 transition->m_hasGetterSetterProperties = transition->m_hasGetterSetterProperties; … … 615 611 materializePropertyMapIfNecessary(); 616 612 if (!m_propertyTable) 617 return WTF::notFound;613 return notFound; 618 614 619 615 UString::Rep* rep = propertyName._ustring.rep(); … … 627 623 unsigned entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask]; 628 624 if (entryIndex == emptyEntryIndex) 629 return WTF::notFound;625 return notFound; 630 626 631 627 if (rep == m_propertyTable->entries()[entryIndex - 1].key) { … … 649 645 entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask]; 650 646 if (entryIndex == emptyEntryIndex) 651 return WTF::notFound;647 return notFound; 652 648 653 649 if (rep == m_propertyTable->entries()[entryIndex - 1].key) { … … 661 657 { 662 658 ASSERT(!propertyName.isNull()); 663 ASSERT(get(propertyName) == WTF::notFound);659 ASSERT(get(propertyName) == notFound); 664 660 665 661 checkConsistency(); … … 756 752 757 753 if (!m_propertyTable) 758 return WTF::notFound;754 return notFound; 759 755 760 756 #if DUMP_PROPERTYMAP_STATS … … 771 767 entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask]; 772 768 if (entryIndex == emptyEntryIndex) 773 return WTF::notFound;769 return notFound; 774 770 775 771 key = m_propertyTable->entries()[entryIndex - 1].key; -
trunk/JavaScriptCore/runtime/Structure.h
r39502 r39593 107 107 void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; } 108 108 109 bool isEmpty() const { return m_propertyTable ? !m_propertyTable->keyCount : m_offset == WTF::notFound; }109 bool isEmpty() const { return m_propertyTable ? !m_propertyTable->keyCount : m_offset == noOffset; } 110 110 111 111 private: … … 140 140 } 141 141 142 signed char transitionCount() const 143 { 144 // Since the number of transitions is always the same as m_offset, we keep the size of Structure down by not storing both. 145 return m_offset == noOffset ? 0 : m_offset + 1; 146 } 147 142 148 static const unsigned emptyEntryIndex = 0; 143 149 144 static const size_t s_maxTransitionLength = 64; 150 static const signed char s_maxTransitionLength = 64; 151 152 static const signed char noOffset = -1; 145 153 146 154 TypeInfo m_typeInfo; … … 152 160 RefPtr<UString::Rep> m_nameInPrevious; 153 161 154 size_t m_transitionCount;155 162 union { 156 163 Structure* singleTransition; … … 163 170 164 171 size_t m_propertyStorageCapacity; 165 si ze_tm_offset;172 signed char m_offset; 166 173 167 174 bool m_isDictionary : 1;
Note:
See TracChangeset
for help on using the changeset viewer.