Title: [175949] releases/WebKitGTK/webkit-2.6/Source/WebCore
Revision
175949
Author
[email protected]
Date
2014-11-11 09:40:07 -0800 (Tue, 11 Nov 2014)

Log Message

Merge r175602 - Avoid double hash table lookup in SpaceSplitStringData::create()
https://bugs.webkit.org/show_bug.cgi?id=138396

Reviewed by Ryosuke Niwa.

Avoid double hash table lookup in SpaceSplitStringData::create() by
calling HashMap::add() and using the AddResult, instead of calling
HashMap::get() then HashMap::add().

No new tests, no behavior change.

* dom/SpaceSplitString.cpp:
(WebCore::SpaceSplitStringData::create):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog (175948 => 175949)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog	2014-11-11 17:39:08 UTC (rev 175948)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog	2014-11-11 17:40:07 UTC (rev 175949)
@@ -1,3 +1,19 @@
+2014-11-04  Chris Dumez  <[email protected]>
+
+        Avoid double hash table lookup in SpaceSplitStringData::create()
+        https://bugs.webkit.org/show_bug.cgi?id=138396
+
+        Reviewed by Ryosuke Niwa.
+
+        Avoid double hash table lookup in SpaceSplitStringData::create() by
+        calling HashMap::add() and using the AddResult, instead of calling
+        HashMap::get() then HashMap::add().
+
+        No new tests, no behavior change.
+
+        * dom/SpaceSplitString.cpp:
+        (WebCore::SpaceSplitStringData::create):
+
 2014-11-04  Andreas Kling  <[email protected]>
 
         RenderBox shouldn't need a pre-destructor hook.

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/dom/SpaceSplitString.cpp (175948 => 175949)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/dom/SpaceSplitString.cpp	2014-11-11 17:39:08 UTC (rev 175948)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/dom/SpaceSplitString.cpp	2014-11-11 17:40:07 UTC (rev 175949)
@@ -192,9 +192,9 @@
     ASSERT(isMainThread());
     ASSERT(!keyString.isNull());
 
-    auto& table = spaceSplitStringTable();
-    if (SpaceSplitStringData* data = ""
-        return data;
+    auto addResult = spaceSplitStringTable().add(keyString, nullptr);
+    if (!addResult.isNewEntry)
+        return addResult.iterator->value;
 
     // Nothing in the cache? Let's create a new SpaceSplitStringData if the input has something useful.
     // 1) We find the number of strings in the input to know how much size we need to allocate.
@@ -206,7 +206,7 @@
         return nullptr;
 
     RefPtr<SpaceSplitStringData> spaceSplitStringData = create(keyString, tokenCount);
-    table.add(keyString, spaceSplitStringData.get());
+    addResult.iterator->value = spaceSplitStringData.get();
     return spaceSplitStringData.release();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to