Changeset 79963 in webkit for trunk/Source/JavaScriptCore/runtime/Structure.h
- Timestamp:
- Feb 28, 2011, 7:53:09 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/Structure.h
r79435 r79963 41 41 #include <wtf/RefCounted.h> 42 42 43 #ifndef NDEBUG44 #define DUMP_PROPERTYMAP_STATS 045 #else46 #define DUMP_PROPERTYMAP_STATS 047 #endif48 43 49 44 namespace JSC { … … 106 101 void growPropertyStorageCapacity(); 107 102 unsigned propertyStorageCapacity() const { return m_propertyStorageCapacity; } 108 unsigned propertyStorageSize() const { return m_anonymousSlotCount + (m_propertyTable ? m_propertyTable-> keyCount + (m_propertyTable->deletedOffsets ? m_propertyTable->deletedOffsets->size() : 0) : static_cast<unsigned>(m_offset + 1)); }103 unsigned propertyStorageSize() const { return m_anonymousSlotCount + (m_propertyTable ? m_propertyTable->propertyStorageSize() : static_cast<unsigned>(m_offset + 1)); } 109 104 bool isUsingInlineStorage() const; 110 105 111 106 size_t get(const Identifier& propertyName); 112 size_t get( const StringImpl* rep, unsigned& attributes, JSCell*& specificValue);107 size_t get(StringImpl* propertyName, unsigned& attributes, JSCell*& specificValue); 113 108 size_t get(const Identifier& propertyName, unsigned& attributes, JSCell*& specificValue) 114 109 { … … 125 120 unsigned anonymousSlotCount() const { return m_anonymousSlotCount; } 126 121 127 bool isEmpty() const { return m_propertyTable ? !m_propertyTable->keyCount: m_offset == noOffset; }122 bool isEmpty() const { return m_propertyTable ? m_propertyTable->isEmpty() : m_offset == noOffset; } 128 123 129 124 void despecifyDictionaryFunction(const Identifier& propertyName); … … 158 153 size_t remove(const Identifier& propertyName); 159 154 160 void expandPropertyMapHashTable(); 161 void rehashPropertyMapHashTable(); 162 void rehashPropertyMapHashTable(unsigned newTableSize); 163 void createPropertyMapHashTable(); 164 void createPropertyMapHashTable(unsigned newTableSize); 165 void insertIntoPropertyMapHashTable(const PropertyMapEntry&); 155 void createPropertyMap(unsigned keyCount = 0); 166 156 void checkConsistency(); 167 157 … … 169 159 void despecifyAllFunctions(); 170 160 171 Property MapHashTable* copyPropertyTable();161 PropertyTable* copyPropertyTable(); 172 162 void materializePropertyMap(); 173 163 void materializePropertyMapIfNecessary() 174 164 { 175 if (m_propertyTable || !m_previous) 176 return; 177 materializePropertyMap(); 165 if (!m_propertyTable && m_previous) 166 materializePropertyMap(); 178 167 } 179 168 … … 186 175 bool isValid(ExecState*, StructureChain* cachedPrototypeChain) const; 187 176 188 static const unsigned emptyEntryIndex = 0;189 190 177 static const signed char s_maxTransitionLength = 64; 191 178 … … 209 196 WeakGCPtr<JSPropertyNameIterator> m_enumerationCache; 210 197 211 PropertyMapHashTable*m_propertyTable;198 OwnPtr<PropertyTable> m_propertyTable; 212 199 213 200 uint32_t m_propertyStorageCapacity; … … 235 222 inline size_t Structure::get(const Identifier& propertyName) 236 223 { 237 ASSERT(!propertyName.isNull());238 239 224 materializePropertyMapIfNecessary(); 240 225 if (!m_propertyTable) 241 return WTF::notFound; 242 243 StringImpl* rep = propertyName.impl(); 244 245 unsigned i = rep->existingHash(); 246 247 #if DUMP_PROPERTYMAP_STATS 248 ++numProbes; 249 #endif 250 251 unsigned entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask]; 252 if (entryIndex == emptyEntryIndex) 253 return WTF::notFound; 254 255 if (rep == m_propertyTable->entries()[entryIndex - 1].key) 256 return m_propertyTable->entries()[entryIndex - 1].offset; 257 258 #if DUMP_PROPERTYMAP_STATS 259 ++numCollisions; 260 #endif 261 262 unsigned k = 1 | WTF::doubleHash(rep->existingHash()); 263 264 while (1) { 265 i += k; 266 267 #if DUMP_PROPERTYMAP_STATS 268 ++numRehashes; 269 #endif 270 271 entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask]; 272 if (entryIndex == emptyEntryIndex) 273 return WTF::notFound; 274 275 if (rep == m_propertyTable->entries()[entryIndex - 1].key) 276 return m_propertyTable->entries()[entryIndex - 1].offset; 277 } 226 return notFound; 227 228 PropertyMapEntry* entry = m_propertyTable->find(propertyName.impl()).first; 229 ASSERT(!entry || entry->offset >= m_anonymousSlotCount); 230 return entry ? entry->offset : notFound; 278 231 } 279 232
Note:
See TracChangeset
for help on using the changeset viewer.