Changeset 36847 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Sep 24, 2008, 1:11:35 AM (17 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/PropertyMap.cpp
r36701 r36847 36 36 #ifndef NDEBUG 37 37 #define DO_PROPERTYMAP_CONSTENCY_CHECK 0 38 #define DUMP_PROPERTYMAP_STATS 039 38 #else 40 39 #define DO_PROPERTYMAP_CONSTENCY_CHECK 0 41 #define DUMP_PROPERTYMAP_STATS 042 40 #endif 43 41 … … 76 74 #endif 77 75 78 static const unsigned emptyEntryIndex = 0;79 76 static const unsigned deletedSentinelIndex = 1; 80 77 … … 271 268 } 272 269 273 size_t PropertyMap::getOffset(const Identifier& propertyName)274 {275 ASSERT(!propertyName.isNull());276 277 if (!m_table)278 return WTF::notFound;279 280 UString::Rep* rep = propertyName._ustring.rep();281 282 unsigned i = rep->computedHash();283 284 #if DUMP_PROPERTYMAP_STATS285 ++numProbes;286 #endif287 288 unsigned entryIndex = m_table->entryIndices[i & m_table->sizeMask];289 if (entryIndex == emptyEntryIndex)290 return WTF::notFound;291 292 if (rep == m_table->entries()[entryIndex - 1].key)293 return entryIndex - 2;294 295 #if DUMP_PROPERTYMAP_STATS296 ++numCollisions;297 #endif298 299 unsigned k = 1 | doubleHash(rep->computedHash());300 301 while (1) {302 i += k;303 304 #if DUMP_PROPERTYMAP_STATS305 ++numRehashes;306 #endif307 308 entryIndex = m_table->entryIndices[i & m_table->sizeMask];309 if (entryIndex == emptyEntryIndex)310 return WTF::notFound;311 312 if (rep == m_table->entries()[entryIndex - 1].key)313 return entryIndex - 2;314 }315 }316 317 270 size_t PropertyMap::getOffset(const Identifier& propertyName, unsigned& attributes) 318 271 { -
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.