Changeset 52948 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Jan 7, 2010, 2:07:36 PM (15 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Structure.cpp
r51875 r52948 135 135 , m_hasGetterSetterProperties(false) 136 136 , m_attributesInPrevious(0) 137 , m_specificFunctionThrashCount(0) 137 138 { 138 139 ASSERT(m_prototype); … … 359 360 ASSERT(structure->typeInfo().type() == ObjectType); 360 361 ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, specificValue, offset)); 362 363 if (structure->m_specificFunctionThrashCount == maxSpecificFunctionThrashCount) 364 specificValue = 0; 361 365 362 366 if (structure->transitionCount() > s_maxTransitionLength) { … … 379 383 transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; 380 384 transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; 385 transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount; 381 386 382 387 if (structure->m_propertyTable) { … … 422 427 transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; 423 428 transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; 429 transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount; 424 430 425 431 // Don't set m_offset, as one can not transition to this. … … 434 440 PassRefPtr<Structure> Structure::despecifyFunctionTransition(Structure* structure, const Identifier& replaceFunction) 435 441 { 442 ASSERT(structure->m_specificFunctionThrashCount < maxSpecificFunctionThrashCount); 436 443 RefPtr<Structure> transition = create(structure->storedPrototype(), structure->typeInfo()); 437 444 … … 439 446 transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; 440 447 transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; 448 transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount + 1; 441 449 442 450 // Don't set m_offset, as one can not transition to this. … … 446 454 transition->m_isPinnedPropertyTable = true; 447 455 448 bool removed = transition->despecifyFunction(replaceFunction); 449 ASSERT_UNUSED(removed, removed); 456 if (transition->m_specificFunctionThrashCount == maxSpecificFunctionThrashCount) 457 transition->despecifyAllFunctions(); 458 else { 459 bool removed = transition->despecifyFunction(replaceFunction); 460 ASSERT_UNUSED(removed, removed); 461 } 450 462 451 463 return transition.release(); … … 471 483 transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; 472 484 transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; 485 transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount; 473 486 474 487 if (structure->m_propertyTable) { … … 500 513 transition->m_hasGetterSetterProperties = transition->m_hasGetterSetterProperties; 501 514 transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; 515 transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount; 502 516 503 517 // Don't set m_offset, as one can not transition to this. … … 519 533 transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; 520 534 transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; 535 transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount; 521 536 522 537 structure->materializePropertyMapIfNecessary(); … … 583 598 { 584 599 ASSERT(!m_enumerationCache); 600 601 if (m_specificFunctionThrashCount == maxSpecificFunctionThrashCount) 602 specificValue = 0; 603 585 604 materializePropertyMapIfNecessary(); 586 605 … … 758 777 } 759 778 } 779 } 780 781 void Structure::despecifyAllFunctions() 782 { 783 materializePropertyMapIfNecessary(); 784 if (!m_propertyTable) 785 return; 786 787 unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount; 788 for (unsigned i = 1; i <= entryCount; ++i) 789 m_propertyTable->entries()[i].specificValue = 0; 760 790 } 761 791 -
trunk/JavaScriptCore/runtime/Structure.h
r51955 r52948 127 127 bool isEmpty() const { return m_propertyTable ? !m_propertyTable->keyCount : m_offset == noOffset; } 128 128 129 JSCell* specificValue() { return m_specificValueInPrevious; }130 129 void despecifyDictionaryFunction(const Identifier& propertyName); 130 void disableSpecificFunctionTracking() { m_specificFunctionThrashCount = maxSpecificFunctionThrashCount; } 131 131 132 132 void setEnumerationCache(JSPropertyNameIterator* enumerationCache); // Defined in JSPropertyNameIterator.h. 133 133 JSPropertyNameIterator* enumerationCache() { return m_enumerationCache.get(); } 134 134 void getEnumerablePropertyNames(PropertyNameArray&); 135 135 136 136 private: 137 137 Structure(JSValue prototype, const TypeInfo&); … … 157 157 158 158 bool despecifyFunction(const Identifier&); 159 void despecifyAllFunctions(); 159 160 160 161 PropertyMapHashTable* copyPropertyTable(); … … 180 181 181 182 static const signed char noOffset = -1; 183 184 static const unsigned maxSpecificFunctionThrashCount = 3; 182 185 183 186 TypeInfo m_typeInfo; … … 212 215 #endif 213 216 unsigned m_anonymousSlotsInPrevious : 6; 217 unsigned m_specificFunctionThrashCount : 2; 218 // 4 free bits 214 219 }; 215 220
Note:
See TracChangeset
for help on using the changeset viewer.