Changeset 36847 in webkit for trunk/JavaScriptCore/kjs/PropertyMap.h
- Timestamp:
- Sep 24, 2008, 1:11:35 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/PropertyMap.h
r36701 r36847 26 26 #include <wtf/OwnArrayPtr.h> 27 27 #include <wtf/NotFound.h> 28 29 #ifndef NDEBUG 30 #define DUMP_PROPERTYMAP_STATS 0 31 #else 32 #define DUMP_PROPERTYMAP_STATS 0 33 #endif 28 34 29 35 namespace JSC { … … 103 109 unsigned storageSize() const { return m_table ? m_table->keyCount + m_table->deletedSentinelCount : 0; } 104 110 111 static const unsigned emptyEntryIndex = 0; 112 105 113 private: 106 114 typedef PropertyMapEntry Entry; … … 126 134 } 127 135 136 inline size_t PropertyMap::getOffset(const Identifier& propertyName) 137 { 138 ASSERT(!propertyName.isNull()); 139 140 if (!m_table) 141 return WTF::notFound; 142 143 UString::Rep* rep = propertyName._ustring.rep(); 144 145 unsigned i = rep->computedHash(); 146 147 #if DUMP_PROPERTYMAP_STATS 148 ++numProbes; 149 #endif 150 151 unsigned entryIndex = m_table->entryIndices[i & m_table->sizeMask]; 152 if (entryIndex == emptyEntryIndex) 153 return WTF::notFound; 154 155 if (rep == m_table->entries()[entryIndex - 1].key) 156 return entryIndex - 2; 157 158 #if DUMP_PROPERTYMAP_STATS 159 ++numCollisions; 160 #endif 161 162 unsigned k = 1 | WTF::doubleHash(rep->computedHash()); 163 164 while (1) { 165 i += k; 166 167 #if DUMP_PROPERTYMAP_STATS 168 ++numRehashes; 169 #endif 170 171 entryIndex = m_table->entryIndices[i & m_table->sizeMask]; 172 if (entryIndex == emptyEntryIndex) 173 return WTF::notFound; 174 175 if (rep == m_table->entries()[entryIndex - 1].key) 176 return entryIndex - 2; 177 } 178 } 179 128 180 } // namespace JSC 129 181
Note:
See TracChangeset
for help on using the changeset viewer.