Changeset 2861 in webkit for trunk/JavaScriptCore
- Timestamp:
- Nov 25, 2002, 1:34:05 PM (23 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r2851 r2861 1 2002-11-25 Darin Adler <[email protected]> 2 3 * kjs/property_map.cpp: Rearrange code a little bit and tweak indentation. 4 This might provide a tiny speedup because we don't look at the single entry 5 any more in cases where the _table pointer is non-0. 6 1 7 2002-11-24 Darin Adler <[email protected]> 2 8 -
trunk/JavaScriptCore/ChangeLog-2002-12-03
r2851 r2861 1 2002-11-25 Darin Adler <[email protected]> 2 3 * kjs/property_map.cpp: Rearrange code a little bit and tweak indentation. 4 This might provide a tiny speedup because we don't look at the single entry 5 any more in cases where the _table pointer is non-0. 6 1 7 2002-11-24 Darin Adler <[email protected]> 2 8 -
trunk/JavaScriptCore/ChangeLog-2003-10-25
r2851 r2861 1 2002-11-25 Darin Adler <[email protected]> 2 3 * kjs/property_map.cpp: Rearrange code a little bit and tweak indentation. 4 This might provide a tiny speedup because we don't look at the single entry 5 any more in cases where the _table pointer is non-0. 6 1 7 2002-11-24 Darin Adler <[email protected]> 2 8 -
trunk/JavaScriptCore/kjs/property_map.cpp
r2846 r2861 1 // -*- c-basic-offset: 2 -*-2 1 /* 3 2 * This file is part of the KDE libraries … … 78 77 PropertyMap::~PropertyMap() 79 78 { 80 #if USE_SINGLE_ENTRY 81 UString::Rep *key = _singleEntry.key; 82 if (key) 83 key->deref(); 84 #endif 85 if (_table) { 86 for (int i = 0; i < _table->size; i++) { 79 if (!_table) { 80 #if USE_SINGLE_ENTRY 81 UString::Rep *key = _singleEntry.key; 82 if (key) 83 key->deref(); 84 #endif 85 return; 86 } 87 88 for (int i = 0; i < _table->size; i++) { 87 89 UString::Rep *key = _table->entries[i].key; 88 90 if (key) 89 91 key->deref(); 90 } 91 free(_table); 92 } 92 } 93 free(_table); 93 94 } 94 95 95 96 void PropertyMap::clear() 96 97 { 97 #if USE_SINGLE_ENTRY 98 UString::Rep *key = _singleEntry.key; 99 if (key) { 100 key->deref(); 101 _singleEntry.key = 0; 102 } 103 #endif 104 if (_table) { 105 for (int i = 0; i < _table->size; i++) { 98 if (!_table) { 99 #if USE_SINGLE_ENTRY 100 UString::Rep *key = _singleEntry.key; 101 if (key) { 102 key->deref(); 103 _singleEntry.key = 0; 104 } 105 #endif 106 return; 107 } 108 109 for (int i = 0; i < _table->size; i++) { 106 110 UString::Rep *key = _table->entries[i].key; 107 111 if (key) { 108 key->deref(); 109 _table->entries[i].key = 0; 110 } 111 } 112 _table->keyCount = 0; 113 } 112 key->deref(); 113 _table->entries[i].key = 0; 114 } 115 } 116 _table->keyCount = 0; 114 117 } 115 118 … … 124 127 125 128 if (!_table) { 126 129 #if USE_SINGLE_ENTRY 127 130 UString::Rep *key = _singleEntry.key; 128 131 if (rep == key) { … … 331 334 void PropertyMap::mark() const 332 335 { 333 #if USE_SINGLE_ENTRY 334 if (_singleEntry.key) { 335 ValueImp *v = _singleEntry.value; 336 if (!v->marked()) 337 v->mark(); 338 } 339 #endif 340 341 if (!_table) { 342 return; 336 if (!_table) { 337 #if USE_SINGLE_ENTRY 338 if (_singleEntry.key) { 339 ValueImp *v = _singleEntry.value; 340 if (!v->marked()) 341 v->mark(); 342 } 343 #endif 344 return; 343 345 } 344 346 … … 354 356 void PropertyMap::addEnumerablesToReferenceList(ReferenceList &list, const Object &base) const 355 357 { 356 #if USE_SINGLE_ENTRY 357 UString::Rep *key = _singleEntry.key; 358 if (key && !(_singleEntry.attributes & DontEnum))359 list.append(Reference(base, Identifier(key)));360 #endif 361 if (!_table) { 362 return;358 if (!_table) { 359 #if USE_SINGLE_ENTRY 360 UString::Rep *key = _singleEntry.key; 361 if (key && !(_singleEntry.attributes & DontEnum)) 362 list.append(Reference(base, Identifier(key))); 363 #endif 364 return; 363 365 } 364 366 … … 372 374 void PropertyMap::addSparseArrayPropertiesToReferenceList(ReferenceList &list, const Object &base) const 373 375 { 374 #if USE_SINGLE_ENTRY 375 UString::Rep *key = _singleEntry.key; 376 if (key) { 377 UString k(key); 378 bool fitsInUInt32; 379 k.toUInt32(&fitsInUInt32); 380 if (fitsInUInt32) { 381 list.append(Reference(base, Identifier(key))); 382 } 383 } 384 #endif 385 if (!_table) { 386 return; 376 if (!_table) { 377 #if USE_SINGLE_ENTRY 378 UString::Rep *key = _singleEntry.key; 379 if (key) { 380 UString k(key); 381 bool fitsInUInt32; 382 k.toUInt32(&fitsInUInt32); 383 if (fitsInUInt32) 384 list.append(Reference(base, Identifier(key))); 385 } 386 #endif 387 return; 387 388 } 388 389 389 390 for (int i = 0; i != _table->size; ++i) { 390 UString::Rep *key = _table->entries[i].key; 391 if (key) { 392 UString k(key); 393 bool fitsInUInt32; 394 k.toUInt32(&fitsInUInt32); 395 if (fitsInUInt32) { 396 list.append(Reference(base, Identifier(key))); 397 } 398 } 391 UString::Rep *key = _table->entries[i].key; 392 if (key) { 393 UString k(key); 394 bool fitsInUInt32; 395 k.toUInt32(&fitsInUInt32); 396 if (fitsInUInt32) 397 list.append(Reference(base, Identifier(key))); 398 } 399 399 } 400 400 } … … 404 404 int count = 0; 405 405 406 #if USE_SINGLE_ENTRY 407 if (_singleEntry.key) 408 ++count; 409 #endif 410 if (_table) { 411 for (int i = 0; i != _table->size; ++i) 412 if (_table->entries[i].key && _table->entries[i].attributes == 0) 413 ++count; 406 if (!_table) { 407 #if USE_SINGLE_ENTRY 408 if (_singleEntry.key) 409 ++count; 410 #endif 411 } else { 412 for (int i = 0; i != _table->size; ++i) 413 if (_table->entries[i].key && _table->entries[i].attributes == 0) 414 ++count; 414 415 } 415 416 … … 423 424 SavedProperty *prop = p._properties; 424 425 425 #if USE_SINGLE_ENTRY 426 if (_singleEntry.key) { 427 prop->key = Identifier(_singleEntry.key); 428 prop->value = Value(_singleEntry.value); 429 ++prop; 430 } 431 #endif 432 if (_table) { 433 for (int i = 0; i != _table->size; ++i) { 434 if (_table->entries[i].key && _table->entries[i].attributes == 0) { 435 prop->key = Identifier(_table->entries[i].key); 436 prop->value = Value(_table->entries[i].value); 437 } 438 } 426 if (!_table) { 427 #if USE_SINGLE_ENTRY 428 if (_singleEntry.key) { 429 prop->key = Identifier(_singleEntry.key); 430 prop->value = Value(_singleEntry.value); 431 ++prop; 432 } 433 #endif 434 } else { 435 for (int i = 0; i != _table->size; ++i) { 436 if (_table->entries[i].key && _table->entries[i].attributes == 0) { 437 prop->key = Identifier(_table->entries[i].key); 438 prop->value = Value(_table->entries[i].value); 439 } 440 } 439 441 } 440 442 } … … 450 452 void PropertyMap::checkConsistency() 451 453 { 454 if (!_table) 455 return; 456 452 457 int count = 0; 453 if (_table) { 454 for (int j = 0; j != _table->size; ++j) { 458 for (int j = 0; j != _table->size; ++j) { 455 459 UString::Rep *rep = _table->entries[j].key; 456 460 if (!rep) 457 461 continue; 458 462 int i = hash(rep); 459 463 while (UString::Rep *key = _table->entries[i].key) { 460 461 462 464 if (rep == key) 465 break; 466 i = (i + 1) & _tableSizeMask; 463 467 } 464 468 assert(i == j); 465 469 count++; 466 } 467 } 468 469 #if USE_SINGLE_ENTRY 470 if (_singleEntry.key) 471 count++; 472 #endif 473 if (_table) { 474 assert(count == _table->keyCount); 475 assert(_table->size >= 16); 476 assert(_table->sizeMask); 477 assert(_table->size == _table->sizeMask + 1); 478 } 470 } 471 assert(count == _table->keyCount); 472 assert(_table->size >= 16); 473 assert(_table->sizeMask); 474 assert(_table->size == _table->sizeMask + 1); 479 475 } 480 476
Note:
See TracChangeset
for help on using the changeset viewer.