Changeset 48403 in webkit for trunk/JavaScriptCore/runtime/StructureTransitionTable.h
- Timestamp:
- Sep 15, 2009, 4:17:19 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/StructureTransitionTable.h
r48265 r48403 32 32 #include <wtf/HashTraits.h> 33 33 #include <wtf/PtrAndFlags.h> 34 #include <wtf/OwnPtr.h> 34 35 #include <wtf/RefPtr.h> 35 36 … … 69 70 class StructureTransitionTable { 70 71 typedef std::pair<Structure*, Structure*> Transition; 71 typedef HashMap<StructureTransitionTableHash::Key, Transition, StructureTransitionTableHash, StructureTransitionTableHashTraits> TransitionTable; 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 102 public: 73 103 StructureTransitionTable() { … … 124 154 } 125 155 } 156 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 } 126 177 private: 127 178 TransitionTable* table() const { ASSERT(!usingSingleTransitionSlot()); return m_transitions.m_table; }
Note:
See TracChangeset
for help on using the changeset viewer.