Changeset 175602 in webkit
- Timestamp:
- Nov 4, 2014, 7:58:19 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
dom/SpaceSplitString.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r175601 r175602 1 2014-11-04 Chris Dumez <cdumez@apple.com> 2 3 Avoid double hash table lookup in SpaceSplitStringData::create() 4 https://bugs.webkit.org/show_bug.cgi?id=138396 5 6 Reviewed by Ryosuke Niwa. 7 8 Avoid double hash table lookup in SpaceSplitStringData::create() by 9 calling HashMap::add() and using the AddResult, instead of calling 10 HashMap::get() then HashMap::add(). 11 12 No new tests, no behavior change. 13 14 * dom/SpaceSplitString.cpp: 15 (WebCore::SpaceSplitStringData::create): 16 1 17 2014-11-04 Zalan Bujtas <zalan@apple.com> 2 18 -
trunk/Source/WebCore/dom/SpaceSplitString.cpp
r175028 r175602 197 197 ASSERT(!keyString.isNull()); 198 198 199 auto & table = spaceSplitStringTable();200 if ( SpaceSplitStringData* data = table.get(keyString))201 return data;199 auto addResult = spaceSplitStringTable().add(keyString, nullptr); 200 if (!addResult.isNewEntry) 201 return addResult.iterator->value; 202 202 203 203 // Nothing in the cache? Let's create a new SpaceSplitStringData if the input has something useful. … … 211 211 212 212 RefPtr<SpaceSplitStringData> spaceSplitStringData = create(keyString, tokenCount); 213 table.add(keyString, spaceSplitStringData.get());213 addResult.iterator->value = spaceSplitStringData.get(); 214 214 return spaceSplitStringData.release(); 215 215 }
Note:
See TracChangeset
for help on using the changeset viewer.