Changeset 54022 in webkit
- Timestamp:
- Jan 28, 2010 2:51:06 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 49 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSCallbackConstructor.h
r49721 r54022 42 42 static PassRefPtr<Structure> createStructure(JSValue proto) 43 43 { 44 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags) );44 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 45 45 } 46 46 -
trunk/JavaScriptCore/API/JSCallbackFunction.h
r49721 r54022 42 42 static PassRefPtr<Structure> createStructure(JSValue proto) 43 43 { 44 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags) );44 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 45 45 } 46 46 -
trunk/JavaScriptCore/API/JSCallbackObject.h
r53638 r54022 51 51 static PassRefPtr<Structure> createStructure(JSValue proto) 52 52 { 53 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags) );53 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), Base::AnonymousSlotCount); 54 54 } 55 55 -
trunk/JavaScriptCore/ChangeLog
r53970 r54022 1 2010-01-28 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Gavin Barraclough. 4 5 Simplify anonymous slot implementation 6 https://bugs.webkit.org/show_bug.cgi?id=34282 7 8 A class must now specify the number of slots it needs at construction time 9 rather than later on with a transition. This makes many things simpler, 10 we no longer need to need an additional transition on object creation to 11 add the anonymous slots, and we remove the need for a number of transition 12 type checks. 13 14 * API/JSCallbackConstructor.h: 15 (JSC::JSCallbackConstructor::createStructure): 16 * API/JSCallbackFunction.h: 17 (JSC::JSCallbackFunction::createStructure): 18 * API/JSCallbackObject.h: 19 (JSC::JSCallbackObject::createStructure): 20 * JavaScriptCore.exp: 21 * debugger/DebuggerActivation.h: 22 (JSC::DebuggerActivation::createStructure): 23 * runtime/Arguments.h: 24 (JSC::Arguments::createStructure): 25 * runtime/BooleanObject.h: 26 (JSC::BooleanObject::createStructure): 27 * runtime/DateInstance.h: 28 (JSC::DateInstance::createStructure): 29 * runtime/DatePrototype.h: 30 (JSC::DatePrototype::createStructure): 31 * runtime/FunctionPrototype.h: 32 (JSC::FunctionPrototype::createStructure): 33 * runtime/GetterSetter.h: 34 (JSC::GetterSetter::createStructure): 35 * runtime/GlobalEvalFunction.h: 36 (JSC::GlobalEvalFunction::createStructure): 37 * runtime/InternalFunction.h: 38 (JSC::InternalFunction::createStructure): 39 * runtime/JSAPIValueWrapper.h: 40 (JSC::JSAPIValueWrapper::createStructure): 41 * runtime/JSActivation.h: 42 (JSC::JSActivation::createStructure): 43 * runtime/JSArray.h: 44 (JSC::JSArray::createStructure): 45 * runtime/JSByteArray.cpp: 46 (JSC::JSByteArray::createStructure): 47 * runtime/JSCell.h: 48 (JSC::JSCell::createDummyStructure): 49 * runtime/JSFunction.h: 50 (JSC::JSFunction::createStructure): 51 * runtime/JSGlobalObject.h: 52 (JSC::JSGlobalObject::createStructure): 53 * runtime/JSNotAnObject.h: 54 (JSC::JSNotAnObject::createStructure): 55 * runtime/JSONObject.h: 56 (JSC::JSONObject::createStructure): 57 * runtime/JSObject.h: 58 (JSC::JSObject::createStructure): 59 (JSC::JSObject::putAnonymousValue): 60 (JSC::JSObject::getAnonymousValue): 61 * runtime/JSPropertyNameIterator.h: 62 (JSC::JSPropertyNameIterator::createStructure): 63 * runtime/JSStaticScopeObject.h: 64 (JSC::JSStaticScopeObject::createStructure): 65 * runtime/JSString.h: 66 (JSC::Fiber::createStructure): 67 * runtime/JSVariableObject.h: 68 (JSC::JSVariableObject::createStructure): 69 * runtime/JSWrapperObject.h: 70 (JSC::JSWrapperObject::createStructure): 71 (JSC::JSWrapperObject::JSWrapperObject): 72 * runtime/MathObject.h: 73 (JSC::MathObject::createStructure): 74 * runtime/NumberConstructor.h: 75 (JSC::NumberConstructor::createStructure): 76 * runtime/NumberObject.h: 77 (JSC::NumberObject::createStructure): 78 * runtime/RegExpConstructor.h: 79 (JSC::RegExpConstructor::createStructure): 80 * runtime/RegExpObject.h: 81 (JSC::RegExpObject::createStructure): 82 * runtime/StringObject.h: 83 (JSC::StringObject::createStructure): 84 * runtime/StringObjectThatMasqueradesAsUndefined.h: 85 (JSC::StringObjectThatMasqueradesAsUndefined::createStructure): 86 * runtime/Structure.cpp: 87 (JSC::Structure::~Structure): 88 (JSC::Structure::materializePropertyMap): 89 * runtime/Structure.h: 90 (JSC::Structure::create): 91 (JSC::Structure::anonymousSlotCount): 92 * runtime/StructureTransitionTable.h: 93 1 94 2010-01-27 Oliver Hunt <oliver@apple.com> 2 95 -
trunk/JavaScriptCore/JavaScriptCore.exp
r53969 r54022 288 288 __ZN3JSC9Structure22materializePropertyMapEv 289 289 __ZN3JSC9Structure25changePrototypeTransitionEPS0_NS_7JSValueE 290 __ZN3JSC9Structure27addAnonymousSlotsTransitionEPS0_j291 290 __ZN3JSC9Structure27despecifyDictionaryFunctionERKNS_10IdentifierE 292 291 __ZN3JSC9Structure27despecifyFunctionTransitionEPS0_RKNS_10IdentifierE -
trunk/JavaScriptCore/debugger/DebuggerActivation.h
r53170 r54022 52 52 static PassRefPtr<Structure> createStructure(JSValue prototype) 53 53 { 54 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );54 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 55 55 } 56 56 -
trunk/JavaScriptCore/runtime/Arguments.h
r53170 r54022 86 86 static PassRefPtr<Structure> createStructure(JSValue prototype) 87 87 { 88 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );88 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 89 89 } 90 90 -
trunk/JavaScriptCore/runtime/BooleanObject.h
r49721 r54022 35 35 static PassRefPtr<Structure> createStructure(JSValue prototype) 36 36 { 37 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );37 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 38 38 } 39 39 }; -
trunk/JavaScriptCore/runtime/DateInstance.h
r53969 r54022 56 56 static PassRefPtr<Structure> createStructure(JSValue prototype) 57 57 { 58 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );58 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 59 59 } 60 60 -
trunk/JavaScriptCore/runtime/DatePrototype.h
r49845 r54022 40 40 static PassRefPtr<Structure> createStructure(JSValue prototype) 41 41 { 42 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );42 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 43 43 } 44 44 -
trunk/JavaScriptCore/runtime/FunctionPrototype.h
r49721 r54022 35 35 static PassRefPtr<Structure> createStructure(JSValue proto) 36 36 { 37 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags) );37 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 38 38 } 39 39 -
trunk/JavaScriptCore/runtime/GetterSetter.h
r49649 r54022 51 51 static PassRefPtr<Structure> createStructure(JSValue prototype) 52 52 { 53 return Structure::create(prototype, TypeInfo(GetterSetterType, OverridesMarkChildren) );53 return Structure::create(prototype, TypeInfo(GetterSetterType, OverridesMarkChildren), AnonymousSlotCount); 54 54 } 55 55 private: -
trunk/JavaScriptCore/runtime/GlobalEvalFunction.h
r49721 r54022 38 38 static PassRefPtr<Structure> createStructure(JSValue prototype) 39 39 { 40 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );40 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 41 41 } 42 42 -
trunk/JavaScriptCore/runtime/InternalFunction.h
r51801 r54022 43 43 static PassRefPtr<Structure> createStructure(JSValue proto) 44 44 { 45 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags) );45 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 46 46 } 47 47 -
trunk/JavaScriptCore/runtime/JSAPIValueWrapper.h
r49694 r54022 40 40 static PassRefPtr<Structure> createStructure(JSValue prototype) 41 41 { 42 return Structure::create(prototype, TypeInfo(CompoundType, OverridesMarkChildren | OverridesGetPropertyNames) );42 return Structure::create(prototype, TypeInfo(CompoundType, OverridesMarkChildren | OverridesGetPropertyNames), AnonymousSlotCount); 43 43 } 44 44 -
trunk/JavaScriptCore/runtime/JSActivation.h
r49721 r54022 67 67 static const ClassInfo info; 68 68 69 static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, StructureFlags) ); }69 static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); } 70 70 71 71 protected: -
trunk/JavaScriptCore/runtime/JSArray.h
r53170 r54022 89 89 static PassRefPtr<Structure> createStructure(JSValue prototype) 90 90 { 91 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );91 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 92 92 } 93 93 -
trunk/JavaScriptCore/runtime/JSByteArray.cpp
r53170 r54022 54 54 PassRefPtr<Structure> JSByteArray::createStructure(JSValue prototype) 55 55 { 56 PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );56 PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 57 57 return result; 58 58 } -
trunk/JavaScriptCore/runtime/JSCell.h
r52956 r54022 53 53 static PassRefPtr<Structure> createDummyStructure() 54 54 { 55 return Structure::create(jsNull(), TypeInfo(UnspecifiedType) );55 return Structure::create(jsNull(), TypeInfo(UnspecifiedType), AnonymousSlotCount); 56 56 } 57 57 … … 114 114 void setVPtr(void* vptr) { *reinterpret_cast<void**>(this) = vptr; } 115 115 116 protected: 117 static const unsigned AnonymousSlotCount = 0; 118 116 119 private: 117 120 // Base implementation; for non-object classes implements getPropertySlot. -
trunk/JavaScriptCore/runtime/JSFunction.h
r53170 r54022 62 62 static PassRefPtr<Structure> createStructure(JSValue prototype) 63 63 { 64 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );64 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 65 65 } 66 66 -
trunk/JavaScriptCore/runtime/JSGlobalObject.h
r53969 r54022 268 268 static PassRefPtr<Structure> createStructure(JSValue prototype) 269 269 { 270 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );270 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 271 271 } 272 272 -
trunk/JavaScriptCore/runtime/JSNotAnObject.h
r53170 r54022 63 63 static PassRefPtr<Structure> createStructure(JSValue prototype) 64 64 { 65 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );65 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 66 66 } 67 67 -
trunk/JavaScriptCore/runtime/JSONObject.h
r49721 r54022 42 42 static PassRefPtr<Structure> createStructure(JSValue prototype) 43 43 { 44 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );44 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 45 45 } 46 46 -
trunk/JavaScriptCore/runtime/JSObject.h
r53437 r54022 207 207 static PassRefPtr<Structure> createStructure(JSValue prototype) 208 208 { 209 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );209 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 210 210 } 211 211 … … 218 218 static const unsigned StructureFlags = 0; 219 219 220 void addAnonymousSlots(unsigned count);221 220 void putAnonymousValue(unsigned index, JSValue value) 222 221 { 222 ASSERT(index < m_structure->anonymousSlotCount()); 223 223 *locationForOffset(index) = value; 224 224 } 225 225 JSValue getAnonymousValue(unsigned index) 226 226 { 227 ASSERT(index < m_structure->anonymousSlotCount()); 227 228 return *locationForOffset(index); 228 229 } … … 529 530 } 530 531 531 inline void JSObject::addAnonymousSlots(unsigned count)532 {533 size_t currentCapacity = m_structure->propertyStorageCapacity();534 RefPtr<Structure> structure = Structure::addAnonymousSlotsTransition(m_structure, count);535 536 if (currentCapacity != structure->propertyStorageCapacity())537 allocatePropertyStorage(currentCapacity, structure->propertyStorageCapacity());538 539 setStructure(structure.release());540 }541 542 532 inline void JSObject::putDirect(const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot) 543 533 { -
trunk/JavaScriptCore/runtime/JSPropertyNameIterator.h
r50254 r54022 48 48 static PassRefPtr<Structure> createStructure(JSValue prototype) 49 49 { 50 return Structure::create(prototype, TypeInfo(CompoundType, OverridesMarkChildren) );50 return Structure::create(prototype, TypeInfo(CompoundType, OverridesMarkChildren), AnonymousSlotCount); 51 51 } 52 52 -
trunk/JavaScriptCore/runtime/JSStaticScopeObject.h
r49721 r54022 58 58 void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes); 59 59 60 static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, StructureFlags) ); }60 static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); } 61 61 62 62 protected: -
trunk/JavaScriptCore/runtime/JSString.h
r53437 r54022 297 297 JSString* getIndex(ExecState*, unsigned); 298 298 299 static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(StringType, OverridesGetOwnPropertySlot | NeedsThisConversion) ); }299 static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(StringType, OverridesGetOwnPropertySlot | NeedsThisConversion), AnonymousSlotCount); } 300 300 301 301 private: -
trunk/JavaScriptCore/runtime/JSVariableObject.h
r53170 r54022 59 59 static PassRefPtr<Structure> createStructure(JSValue prototype) 60 60 { 61 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );61 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 62 62 } 63 63 -
trunk/JavaScriptCore/runtime/JSWrapperObject.h
r49721 r54022 39 39 static PassRefPtr<Structure> createStructure(JSValue prototype) 40 40 { 41 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );41 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 42 42 } 43 44 protected: 45 static const unsigned AnonymousSlotCount = 1 + JSObject::AnonymousSlotCount; 43 46 44 47 private: … … 51 54 : JSObject(structure) 52 55 { 53 addAnonymousSlots(1);54 56 putAnonymousValue(0, jsNull()); 55 57 } -
trunk/JavaScriptCore/runtime/MathObject.h
r49721 r54022 38 38 static PassRefPtr<Structure> createStructure(JSValue prototype) 39 39 { 40 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );40 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 41 41 } 42 42 -
trunk/JavaScriptCore/runtime/NumberConstructor.h
r49721 r54022 40 40 static PassRefPtr<Structure> createStructure(JSValue proto) 41 41 { 42 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags) );42 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 43 43 } 44 44 -
trunk/JavaScriptCore/runtime/NumberObject.h
r49721 r54022 34 34 static PassRefPtr<Structure> createStructure(JSValue prototype) 35 35 { 36 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );36 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 37 37 } 38 38 -
trunk/JavaScriptCore/runtime/RegExpConstructor.h
r49721 r54022 60 60 static PassRefPtr<Structure> createStructure(JSValue prototype) 61 61 { 62 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );62 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 63 63 } 64 64 -
trunk/JavaScriptCore/runtime/RegExpObject.h
r49721 r54022 50 50 static PassRefPtr<Structure> createStructure(JSValue prototype) 51 51 { 52 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );52 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 53 53 } 54 54 -
trunk/JavaScriptCore/runtime/StringObject.h
r53170 r54022 49 49 static PassRefPtr<Structure> createStructure(JSValue prototype) 50 50 { 51 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );51 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 52 52 } 53 53 -
trunk/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
r49721 r54022 45 45 static PassRefPtr<Structure> createStructure(JSValue proto) 46 46 { 47 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags) );47 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 48 48 } 49 49 -
trunk/JavaScriptCore/runtime/Structure.cpp
r53320 r54022 158 158 { 159 159 if (m_previous) { 160 if (m_nameInPrevious) 161 m_previous->table.remove(make_pair(m_nameInPrevious.get(), m_attributesInPrevious), m_specificValueInPrevious); 162 else 163 m_previous->table.removeAnonymousSlotTransition(m_anonymousSlotsInPrevious); 160 ASSERT(m_nameInPrevious); 161 m_previous->table.remove(make_pair(m_nameInPrevious.get(), m_attributesInPrevious), m_specificValueInPrevious); 164 162 165 163 } … … 277 275 for (ptrdiff_t i = structures.size() - 2; i >= 0; --i) { 278 276 structure = structures[i]; 279 if (!structure->m_nameInPrevious) {280 m_propertyTable->anonymousSlotCount += structure->m_anonymousSlotsInPrevious;281 continue;282 }283 277 structure->m_nameInPrevious->ref(); 284 278 PropertyMapEntry entry(structure->m_nameInPrevious.get(), structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious, ++m_propertyTable->lastIndexUsed); … … 462 456 463 457 return transition.release(); 464 }465 466 PassRefPtr<Structure> Structure::addAnonymousSlotsTransition(Structure* structure, unsigned count)467 {468 if (Structure* transition = structure->table.getAnonymousSlotTransition(count)) {469 ASSERT(transition->storedPrototype() == structure->storedPrototype());470 return transition;471 }472 ASSERT(count);473 ASSERT(count < ((1<<6) - 2));474 RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo());475 476 transition->m_cachedPrototypeChain = structure->m_cachedPrototypeChain;477 transition->m_previous = structure;478 transition->m_nameInPrevious = 0;479 transition->m_attributesInPrevious = 0;480 transition->m_anonymousSlotsInPrevious = count;481 transition->m_specificValueInPrevious = 0;482 transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity;483 transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties;484 transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties;485 transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount;486 487 if (structure->m_propertyTable) {488 if (structure->m_isPinnedPropertyTable)489 transition->m_propertyTable = structure->copyPropertyTable();490 else {491 transition->m_propertyTable = structure->m_propertyTable;492 structure->m_propertyTable = 0;493 }494 } else {495 if (structure->m_previous)496 transition->materializePropertyMap();497 else498 transition->createPropertyMapHashTable();499 }500 501 transition->addAnonymousSlots(count);502 if (transition->propertyStorageSize() > transition->propertyStorageCapacity())503 transition->growPropertyStorageCapacity();504 505 structure->table.addAnonymousSlotTransition(count, transition.get());506 return transition.release();507 458 } 508 459 … … 881 832 checkConsistency(); 882 833 return newOffset; 883 }884 885 void Structure::addAnonymousSlots(unsigned count)886 {887 m_propertyTable->anonymousSlotCount += count;888 834 } 889 835 -
trunk/JavaScriptCore/runtime/Structure.h
r53320 r54022 61 61 friend class JIT; 62 62 friend class StructureTransitionTable; 63 static PassRefPtr<Structure> create(JSValue prototype, const TypeInfo& typeInfo) 64 { 65 return adoptRef(new Structure(prototype, typeInfo)); 63 static PassRefPtr<Structure> create(JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount) 64 { 65 Structure* structure = (new Structure(prototype, typeInfo)); 66 if (anonymousSlotCount) { 67 structure->materializePropertyMap(); 68 structure->m_isPinnedPropertyTable = true; 69 structure->m_propertyTable->anonymousSlotCount = anonymousSlotCount; 70 // Currently we don't allow more anonymous slots than fit in the inline capacity 71 ASSERT(structure->propertyStorageSize() <= structure->propertyStorageCapacity()); 72 } 73 return adoptRef(structure); 66 74 } 67 75 … … 76 84 static PassRefPtr<Structure> changePrototypeTransition(Structure*, JSValue prototype); 77 85 static PassRefPtr<Structure> despecifyFunctionTransition(Structure*, const Identifier&); 78 static PassRefPtr<Structure> addAnonymousSlotsTransition(Structure*, unsigned count);79 86 static PassRefPtr<Structure> getterSetterTransition(Structure*); 80 87 static PassRefPtr<Structure> toCacheableDictionaryTransition(Structure*); … … 129 136 130 137 bool hasAnonymousSlots() const { return m_propertyTable && m_propertyTable->anonymousSlotCount; } 138 unsigned anonymousSlotCount() const { return m_propertyTable ? m_propertyTable->anonymousSlotCount : 0; } 131 139 132 140 bool isEmpty() const { return m_propertyTable ? !m_propertyTable->keyCount : m_offset == noOffset; } … … 140 148 141 149 private: 150 static PassRefPtr<Structure> create(JSValue prototype, const TypeInfo& typeInfo) 151 { 152 return adoptRef(new Structure(prototype, typeInfo)); 153 } 154 142 155 Structure(JSValue prototype, const TypeInfo&); 143 156 … … 151 164 size_t put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue); 152 165 size_t remove(const Identifier& propertyName); 153 void addAnonymousSlots(unsigned slotCount);154 166 155 167 void expandPropertyMapHashTable(); … … 219 231 unsigned m_attributesInPrevious : 7; 220 232 #endif 221 unsigned m_anonymousSlotsInPrevious : 6;222 233 unsigned m_specificFunctionThrashCount : 2; 223 // 4free bits234 // 10 free bits 224 235 }; 225 236 -
trunk/JavaScriptCore/runtime/StructureTransitionTable.h
r53320 r54022 70 70 class StructureTransitionTable { 71 71 typedef std::pair<Structure*, Structure*> Transition; 72 struct TransitionTable : public HashMap<StructureTransitionTableHash::Key, Transition, StructureTransitionTableHash, StructureTransitionTableHashTraits> { 73 typedef HashMap<unsigned, Structure*> AnonymousSlotMap; 74 75 void addSlotTransition(unsigned count, Structure* structure) 76 { 77 ASSERT(!getSlotTransition(count)); 78 if (!m_anonymousSlotTable) 79 m_anonymousSlotTable.set(new AnonymousSlotMap); 80 m_anonymousSlotTable->add(count, structure); 81 } 82 83 void removeSlotTransition(unsigned count) 84 { 85 ASSERT(getSlotTransition(count)); 86 m_anonymousSlotTable->remove(count); 87 } 88 89 Structure* getSlotTransition(unsigned count) 90 { 91 if (!m_anonymousSlotTable) 92 return 0; 93 94 AnonymousSlotMap::iterator find = m_anonymousSlotTable->find(count); 95 if (find == m_anonymousSlotTable->end()) 96 return 0; 97 return find->second; 98 } 99 private: 100 OwnPtr<AnonymousSlotMap> m_anonymousSlotTable; 101 }; 72 typedef HashMap<StructureTransitionTableHash::Key, Transition, StructureTransitionTableHash, StructureTransitionTableHashTraits> TransitionTable; 102 73 public: 103 74 StructureTransitionTable() { … … 155 126 } 156 127 157 Structure* getAnonymousSlotTransition(unsigned count)158 {159 if (usingSingleTransitionSlot())160 return 0;161 return table()->getSlotTransition(count);162 }163 164 void addAnonymousSlotTransition(unsigned count, Structure* structure)165 {166 if (usingSingleTransitionSlot())167 reifySingleTransition();168 ASSERT(!table()->getSlotTransition(count));169 table()->addSlotTransition(count, structure);170 }171 172 void removeAnonymousSlotTransition(unsigned count)173 {174 ASSERT(!usingSingleTransitionSlot());175 table()->removeSlotTransition(count);176 }177 128 private: 178 129 TransitionTable* table() const { ASSERT(!usingSingleTransitionSlot()); return m_transitions.m_table; } -
trunk/JavaScriptGlue/ChangeLog
r53170 r54022 1 2010-01-28 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Gavin Barraclough. 4 5 Simplify anonymous slot implementation 6 https://bugs.webkit.org/show_bug.cgi?id=34282 7 8 Update JSGlue Structure usage to pass the anonymous slot count. 9 10 * UserObjectImp.h: 11 (UserObjectImp::createStructure): 12 1 13 2010-01-12 Kent Hansen <kent.hansen@nokia.com> 2 14 -
trunk/JavaScriptGlue/UserObjectImp.h
r53170 r54022 62 62 static PassRefPtr<Structure> createStructure(JSValue prototype) 63 63 { 64 return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames) );64 return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames), AnonymousSlotCount); 65 65 } 66 66 -
trunk/WebCore/ChangeLog
r54020 r54022 1 2010-01-28 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Gavin Barraclough. 4 5 Simplify anonymous slot implementation 6 https://bugs.webkit.org/show_bug.cgi?id=34282 7 8 Update the WebCore JS DOM bindings to correctly pass and 9 propagate the anonymous slot count information. 10 11 * bindings/js/JSDOMBinding.h: 12 (WebCore::DOMObjectWithGlobalPointer::createStructure): 13 (WebCore::DOMConstructorObject::createStructure): 14 * bindings/js/JSDOMWindowShell.h: 15 (WebCore::JSDOMWindowShell::createStructure): 16 * bindings/scripts/CodeGeneratorJS.pm: 17 * bridge/objc/objc_runtime.h: 18 (JSC::Bindings::ObjcFallbackObjectImp::createStructure): 19 * bridge/runtime_array.h: 20 (JSC::RuntimeArray::createStructure): 21 * bridge/runtime_method.h: 22 (JSC::RuntimeMethod::createStructure): 23 * bridge/runtime_object.h: 24 (JSC::RuntimeObjectImp::createStructure): 25 1 26 2010-01-27 Evan Martin <evan@chromium.org> 2 27 -
trunk/WebCore/bindings/js/JSDOMBinding.h
r53666 r54022 82 82 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) 83 83 { 84 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags) );84 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); 85 85 } 86 86 … … 114 114 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) 115 115 { 116 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags) );116 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); 117 117 } 118 118 -
trunk/WebCore/bindings/js/JSDOMWindowShell.h
r53170 r54022 61 61 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) 62 62 { 63 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags) );63 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); 64 64 } 65 65 -
trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm
r53969 r54022 604 604 " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" . 605 605 " {\n" . 606 " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags) );\n" .606 " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);\n" . 607 607 " }\n\n"); 608 608 … … 809 809 " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" . 810 810 " {\n" . 811 " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags) );\n" .811 " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);\n" . 812 812 " }\n"); 813 813 if ($dataNode->extendedAttributes->{"DelegatingPrototypePutFunction"}) { … … 2249 2249 static PassRefPtr<Structure> createStructure(JSValue proto) 2250 2250 { 2251 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags) );2251 return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 2252 2252 } 2253 2253 -
trunk/WebCore/bridge/objc/objc_runtime.h
r53464 r54022 105 105 static PassRefPtr<Structure> createStructure(JSValue prototype) 106 106 { 107 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );107 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 108 108 } 109 109 -
trunk/WebCore/bridge/runtime_array.h
r53464 r54022 61 61 static PassRefPtr<Structure> createStructure(JSValue prototype) 62 62 { 63 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );63 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 64 64 } 65 65 -
trunk/WebCore/bridge/runtime_method.h
r53464 r54022 48 48 static PassRefPtr<Structure> createStructure(JSValue prototype) 49 49 { 50 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );50 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 51 51 } 52 52 -
trunk/WebCore/bridge/runtime_object.h
r53464 r54022 62 62 static PassRefPtr<Structure> createStructure(JSValue prototype) 63 63 { 64 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags) );64 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 65 65 } 66 66
Note: See TracChangeset
for help on using the changeset viewer.