Changeset 2794 in webkit for trunk/JavaScriptCore/kjs/property_map.cpp
- Timestamp:
- Nov 20, 2002, 5:28:08 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/property_map.cpp
r2783 r2794 26 26 #include "reference_list.h" 27 27 28 // At the time I added this , the optimization still gave a 1.5% performance boost.28 // At the time I added this switch, the optimization still gave a 1.5% performance boost so I couldn't remove it. 29 29 #define USE_SINGLE_ENTRY 1 30 30 31 31 namespace KJS { 32 33 class SavedProperty { 34 public: 35 Identifier key; 36 Value value; 37 }; 32 38 33 39 // Algorithm concepts from Algorithms in C++, Sedgewick. … … 282 288 } 283 289 290 void PropertyMap::save(SavedProperties &p) const 291 { 292 int count = 0; 293 294 #if USE_SINGLE_ENTRY 295 if (_singleEntry.key) 296 ++count; 297 #endif 298 for (int i = 0; i != _tableSize; ++i) 299 if (_table[i].key && _table[i].attributes == 0) 300 ++count; 301 302 delete [] p._properties; 303 if (count == 0) { 304 p._properties = 0; 305 return; 306 } 307 p._properties = new SavedProperty [count]; 308 309 SavedProperty *prop = p._properties; 310 311 #if USE_SINGLE_ENTRY 312 if (_singleEntry.key) { 313 prop->key = Identifier(_singleEntry.key); 314 prop->value = Value(_singleEntry.value); 315 ++prop; 316 } 317 #endif 318 for (int i = 0; i != _tableSize; ++i) 319 if (_table[i].key && _table[i].attributes == 0) { 320 prop->key = Identifier(_table[i].key); 321 prop->value = Value(_table[i].value); 322 } 323 } 324 325 void PropertyMap::restore(const SavedProperties &p) 326 { 327 for (int i = 0; i != p._count; ++i) 328 put(p._properties[i].key, p._properties[i].value.imp(), 0); 329 } 330 284 331 } // namespace KJS
Note:
See TracChangeset
for help on using the changeset viewer.