Changeset 27127 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Oct 26, 2007, 3:45:34 PM (18 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/property_map.cpp
r26958 r27127 38 38 #define USE_SINGLE_ENTRY 1 39 39 40 // 2/28/2006 ggaren: super accurate JS iBench says that USE_SINGLE_ENTRY is a40 // 2/28/2006 ggaren: command-line JS iBench says that USE_SINGLE_ENTRY is a 41 41 // 3.2% performance boost. 42 42 … … 176 176 } 177 177 178 unsigned h = rep-> hash();178 unsigned h = rep->computedHash(); 179 179 int sizeMask = m_u.table->sizeMask; 180 180 Entry *entries = m_u.table->entries; … … 185 185 numCollisions += entries[i].key && entries[i].key != rep; 186 186 #endif 187 while (UString::Rep *key = entries[i].key) { 187 while (1) { 188 UString::Rep* key = entries[i].key; 189 190 if (!key) 191 return 0; 192 188 193 if (rep == key) { 189 194 attributes = entries[i].attributes; 190 195 return entries[i].value; 191 196 } 197 192 198 if (k == 0) 193 199 k = 1 | (h % sizeMask); … … 197 203 #endif 198 204 } 199 return 0;200 205 } 201 206 … … 215 220 } 216 221 217 unsigned h = rep-> hash();222 unsigned h = rep->computedHash(); 218 223 int sizeMask = m_u.table->sizeMask; 219 224 Entry *entries = m_u.table->entries; … … 224 229 numCollisions += entries[i].key && entries[i].key != rep; 225 230 #endif 226 while (UString::Rep *key = entries[i].key) { 231 while (1) { 232 UString::Rep* key = entries[i].key; 233 234 if (!key) 235 return 0; 236 227 237 if (rep == key) 228 238 return entries[i].value; 239 229 240 if (k == 0) 230 241 k = 1 | (h % sizeMask); … … 234 245 #endif 235 246 } 236 return 0;237 247 } 238 248 … … 252 262 } 253 263 254 unsigned h = rep-> hash();264 unsigned h = rep->computedHash(); 255 265 int sizeMask = m_u.table->sizeMask; 256 266 Entry *entries = m_u.table->entries; … … 261 271 numCollisions += entries[i].key && entries[i].key != rep; 262 272 #endif 263 while (UString::Rep *key = entries[i].key) { 273 while (1) { 274 UString::Rep* key = entries[i].key; 275 276 if (!key) 277 return 0; 278 264 279 if (rep == key) 265 280 return &entries[i].value; 281 266 282 if (k == 0) 267 283 k = 1 | (h % sizeMask); … … 271 287 #endif 272 288 } 273 return 0;274 289 } 275 290 … … 331 346 expand(); 332 347 333 unsigned h = rep-> hash();348 unsigned h = rep->computedHash(); 334 349 int sizeMask = m_u.table->sizeMask; 335 350 Entry *entries = m_u.table->entries; … … 385 400 ASSERT(m_u.table); 386 401 387 unsigned h = key-> hash();402 unsigned h = key->computedHash(); 388 403 int sizeMask = m_u.table->sizeMask; 389 404 Entry *entries = m_u.table->entries; … … 512 527 513 528 // Find the thing to remove. 514 unsigned h = rep-> hash();529 unsigned h = rep->computedHash(); 515 530 int sizeMask = m_u.table->sizeMask; 516 531 Entry *entries = m_u.table->entries; … … 729 744 continue; 730 745 } 731 unsigned h = rep-> hash();746 unsigned h = rep->computedHash(); 732 747 int i = h & m_u.table->sizeMask; 733 748 int k = 0; -
trunk/JavaScriptCore/kjs/ustring.h
r25321 r27127 148 148 149 149 unsigned hash() const { if (_hash == 0) _hash = computeHash(data(), len); return _hash; } 150 unsigned computedHash() const { ASSERT(_hash); return _hash; } // fast path for Identifiers 151 150 152 static unsigned computeHash(const UChar *, int length); 151 153 static unsigned computeHash(const char *);
Note:
See TracChangeset
for help on using the changeset viewer.