Changeset 48582 in webkit for trunk/JavaScriptCore
- Timestamp:
- Sep 21, 2009, 8:45:13 AM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r48581 r48582 1 2009-09-21 Oliver Hunt <[email protected]> 2 3 RS=Maciej Stachowiak. 4 5 Re-land SNES fix with corrected assertion. 6 7 * interpreter/Interpreter.cpp: 8 (JSC::Interpreter::resolveGlobal): 9 (JSC::Interpreter::tryCachePutByID): 10 (JSC::Interpreter::tryCacheGetByID): 11 * jit/JITStubs.cpp: 12 (JSC::JITThunks::tryCachePutByID): 13 (JSC::JITThunks::tryCacheGetByID): 14 (JSC::DEFINE_STUB_FUNCTION): 15 * runtime/BatchedTransitionOptimizer.h: 16 (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer): 17 * runtime/JSObject.cpp: 18 (JSC::JSObject::removeDirect): 19 * runtime/Structure.cpp: 20 (JSC::Structure::Structure): 21 (JSC::Structure::getEnumerablePropertyNames): 22 (JSC::Structure::despecifyDictionaryFunction): 23 (JSC::Structure::addPropertyTransitionToExistingStructure): 24 (JSC::Structure::addPropertyTransition): 25 (JSC::Structure::removePropertyTransition): 26 (JSC::Structure::toDictionaryTransition): 27 (JSC::Structure::toCacheableDictionaryTransition): 28 (JSC::Structure::toUncacheableDictionaryTransition): 29 (JSC::Structure::fromDictionaryTransition): 30 (JSC::Structure::removePropertyWithoutTransition): 31 * runtime/Structure.h: 32 (JSC::Structure::isDictionary): 33 (JSC::Structure::isUncacheableDictionary): 34 (JSC::Structure::): 35 * runtime/StructureChain.cpp: 36 (JSC::StructureChain::isCacheable): 37 1 38 2009-09-21 Adam Roben <[email protected]> 2 39 -
trunk/JavaScriptCore/interpreter/Interpreter.cpp
r48580 r48582 170 170 if (globalObject->getPropertySlot(callFrame, ident, slot)) { 171 171 JSValue result = slot.getValue(callFrame, ident); 172 if (slot.isCacheable() && !globalObject->structure()->is Dictionary() && slot.slotBase() == globalObject) {172 if (slot.isCacheable() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) { 173 173 if (vPC[4].u.structure) 174 174 vPC[4].u.structure->deref(); … … 954 954 Structure* structure = baseCell->structure(); 955 955 956 if (structure->is Dictionary()) {956 if (structure->isUncacheableDictionary()) { 957 957 vPC[0] = getOpcode(op_put_by_id_generic); 958 958 return; … … 1041 1041 Structure* structure = asCell(baseValue)->structure(); 1042 1042 1043 if (structure->is Dictionary()) {1043 if (structure->isUncacheableDictionary()) { 1044 1044 vPC[0] = getOpcode(op_get_by_id_generic); 1045 1045 return; -
trunk/JavaScriptCore/jit/JITStubs.cpp
r48580 r48582 680 680 Structure* structure = baseCell->structure(); 681 681 682 if (structure->is Dictionary()) {682 if (structure->isUncacheableDictionary()) { 683 683 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_put_by_id_generic)); 684 684 return; … … 744 744 Structure* structure = baseCell->structure(); 745 745 746 if (structure->is Dictionary()) {746 if (structure->isUncacheableDictionary()) { 747 747 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_get_by_id_generic)); 748 748 return; … … 1155 1155 if (baseValue.isCell() 1156 1156 && slot.isCacheable() 1157 && !(structure = asCell(baseValue)->structure())->is Dictionary()1157 && !(structure = asCell(baseValue)->structure())->isUncacheableDictionary() 1158 1158 && (slotBaseObject = asObject(slot.slotBase()))->getPropertySpecificValue(callFrame, ident, specific) 1159 1159 && specific … … 1229 1229 if (baseValue.isCell() 1230 1230 && slot.isCacheable() 1231 && !asCell(baseValue)->structure()->is Dictionary()1231 && !asCell(baseValue)->structure()->isUncacheableDictionary() 1232 1232 && slot.slotBase() == baseValue) { 1233 1233 … … 1300 1300 CHECK_FOR_EXCEPTION(); 1301 1301 1302 if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->is Dictionary()) {1302 if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->isUncacheableDictionary()) { 1303 1303 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail)); 1304 1304 return JSValue::encode(result); … … 2189 2189 if (globalObject->getPropertySlot(callFrame, ident, slot)) { 2190 2190 JSValue result = slot.getValue(callFrame, ident); 2191 if (slot.isCacheable() && !globalObject->structure()->is Dictionary() && slot.slotBase() == globalObject) {2191 if (slot.isCacheable() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) { 2192 2192 GlobalResolveInfo& globalResolveInfo = callFrame->codeBlock()->globalResolveInfo(globalResolveInfoIndex); 2193 2193 if (globalResolveInfo.structure) -
trunk/JavaScriptCore/runtime/BatchedTransitionOptimizer.h
r48580 r48582 39 39 { 40 40 if (!m_object->structure()->isDictionary()) 41 m_object->setStructure(Structure::to DictionaryTransition(m_object->structure()));41 m_object->setStructure(Structure::toCacheableDictionaryTransition(m_object->structure())); 42 42 } 43 43 -
trunk/JavaScriptCore/runtime/JSObject.cpp
r48580 r48582 472 472 { 473 473 size_t offset; 474 if (m_structure->is Dictionary()) {474 if (m_structure->isUncacheableDictionary()) { 475 475 offset = m_structure->removePropertyWithoutTransition(propertyName); 476 476 if (offset != WTF::notFound) -
trunk/JavaScriptCore/runtime/Structure.cpp
r48580 r48582 128 128 , m_propertyStorageCapacity(JSObject::inlineStorageCapacity) 129 129 , m_offset(noOffset) 130 , m_ isDictionary(false)130 , m_dictionaryKind(NoneDictionaryKind) 131 131 , m_isPinnedPropertyTable(false) 132 132 , m_hasGetterSetterProperties(false) … … 291 291 void Structure::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject) 292 292 { 293 bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || m_isDictionary);293 bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || isDictionary()); 294 294 295 295 if (shouldCache && m_cachedPropertyNameArrayData) { … … 350 350 materializePropertyMapIfNecessary(); 351 351 352 ASSERT( m_isDictionary);352 ASSERT(isDictionary()); 353 353 ASSERT(m_propertyTable); 354 354 … … 392 392 PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) 393 393 { 394 ASSERT(!structure-> m_isDictionary);394 ASSERT(!structure->isDictionary()); 395 395 ASSERT(structure->typeInfo().type() == ObjectType); 396 396 … … 406 406 PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) 407 407 { 408 ASSERT(!structure-> m_isDictionary);408 ASSERT(!structure->isDictionary()); 409 409 ASSERT(structure->typeInfo().type() == ObjectType); 410 410 ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, specificValue, offset)); 411 411 412 412 if (structure->transitionCount() > s_maxTransitionLength) { 413 RefPtr<Structure> transition = to DictionaryTransition(structure);413 RefPtr<Structure> transition = toCacheableDictionaryTransition(structure); 414 414 ASSERT(structure != transition); 415 415 offset = transition->put(propertyName, attributes, specificValue); … … 455 455 PassRefPtr<Structure> Structure::removePropertyTransition(Structure* structure, const Identifier& propertyName, size_t& offset) 456 456 { 457 ASSERT(!structure-> m_isDictionary);458 459 RefPtr<Structure> transition = to DictionaryTransition(structure);457 ASSERT(!structure->isUncacheableDictionary()); 458 459 RefPtr<Structure> transition = toUncacheableDictionaryTransition(structure); 460 460 461 461 offset = transition->remove(propertyName); … … 555 555 } 556 556 557 PassRefPtr<Structure> Structure::toDictionaryTransition(Structure* structure )558 { 559 ASSERT(!structure-> m_isDictionary);560 557 PassRefPtr<Structure> Structure::toDictionaryTransition(Structure* structure, DictionaryKind kind) 558 { 559 ASSERT(!structure->isUncacheableDictionary()); 560 561 561 RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo()); 562 transition->m_ isDictionary = true;562 transition->m_dictionaryKind = kind; 563 563 transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; 564 564 transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; 565 565 566 566 structure->materializePropertyMapIfNecessary(); 567 567 transition->m_propertyTable = structure->copyPropertyTable(); 568 568 transition->m_isPinnedPropertyTable = true; 569 569 570 570 return transition.release(); 571 571 } 572 572 573 PassRefPtr<Structure> Structure::toCacheableDictionaryTransition(Structure* structure) 574 { 575 return toDictionaryTransition(structure, CachedDictionaryKind); 576 } 577 578 PassRefPtr<Structure> Structure::toUncacheableDictionaryTransition(Structure* structure) 579 { 580 return toDictionaryTransition(structure, UncachedDictionaryKind); 581 } 582 573 583 PassRefPtr<Structure> Structure::fromDictionaryTransition(Structure* structure) 574 584 { 575 ASSERT(structure-> m_isDictionary);585 ASSERT(structure->isDictionary()); 576 586 577 587 // Since dictionary Structures are not shared, and no opcodes specialize … … 582 592 // deleted offsets vector) before transitioning from dictionary. 583 593 if (!structure->m_propertyTable || !structure->m_propertyTable->deletedOffsets || structure->m_propertyTable->deletedOffsets->isEmpty()) 584 structure->m_ isDictionary = false;594 structure->m_dictionaryKind = NoneDictionaryKind; 585 595 586 596 return structure; … … 601 611 size_t Structure::removePropertyWithoutTransition(const Identifier& propertyName) 602 612 { 603 ASSERT( m_isDictionary);613 ASSERT(isUncacheableDictionary()); 604 614 605 615 materializePropertyMapIfNecessary(); -
trunk/JavaScriptCore/runtime/Structure.h
r48580 r48582 71 71 static PassRefPtr<Structure> addAnonymousSlotsTransition(Structure*, unsigned count); 72 72 static PassRefPtr<Structure> getterSetterTransition(Structure*); 73 static PassRefPtr<Structure> toDictionaryTransition(Structure*); 73 static PassRefPtr<Structure> toCacheableDictionaryTransition(Structure*); 74 static PassRefPtr<Structure> toUncacheableDictionaryTransition(Structure*); 74 75 static PassRefPtr<Structure> fromDictionaryTransition(Structure*); 75 76 … … 82 83 size_t removePropertyWithoutTransition(const Identifier& propertyName); 83 84 void setPrototypeWithoutTransition(JSValue prototype) { m_prototype = prototype; } 84 85 bool isDictionary() const { return m_isDictionary; } 85 86 bool isDictionary() const { return m_dictionaryKind != NoneDictionaryKind; } 87 bool isUncacheableDictionary() const { return m_dictionaryKind == UncachedDictionaryKind; } 86 88 87 89 const TypeInfo& typeInfo() const { return m_typeInfo; } … … 128 130 private: 129 131 Structure(JSValue prototype, const TypeInfo&); 132 133 typedef enum { 134 NoneDictionaryKind = 0, 135 CachedDictionaryKind = 1, 136 UncachedDictionaryKind = 2 137 } DictionaryKind; 138 static PassRefPtr<Structure> toDictionaryTransition(Structure*, DictionaryKind); 130 139 131 140 size_t put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue); … … 188 197 signed char m_offset; 189 198 190 bool m_isDictionary : 1;199 unsigned m_dictionaryKind : 2; 191 200 bool m_isPinnedPropertyTable : 1; 192 201 bool m_hasGetterSetterProperties : 1; -
trunk/JavaScriptCore/runtime/StructureChain.cpp
r48580 r48582 52 52 53 53 while (m_vector[i]) { 54 // Both classes of dictionary structure may change arbitrarily so we can't cache them 54 55 if (m_vector[i]->isDictionary()) 55 56 return false;
Note:
See TracChangeset
for help on using the changeset viewer.