Title: [194213] trunk/Source/WebCore
Revision
194213
Author
[email protected]
Date
2015-12-16 23:49:45 -0800 (Wed, 16 Dec 2015)

Log Message

Make SessionID use intHash
https://bugs.webkit.org/show_bug.cgi?id=152356

Patch by Alex Christensen <[email protected]> on 2015-12-16
Reviewed by Darin Adler.

* page/SessionID.h:
(WTF::SessionIDHash::hash):
(WTF::SessionIDHash::equal):
(WTF::HashTraits<WebCore::SessionID>::emptyValue):
(WTF::HashTraits<WebCore::SessionID>::constructDeletedValue):
(WTF::HashTraits<WebCore::SessionID>::isDeletedValue):
Use intHash instead of just casting a uint64_t to an unsigned.
This reduces hash collisions in HashTables that are usually quite small so it isn't much of a problem.
Also, needsDestruction hasn't been in HashTraits since r156507.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (194212 => 194213)


--- trunk/Source/WebCore/ChangeLog	2015-12-17 07:36:38 UTC (rev 194212)
+++ trunk/Source/WebCore/ChangeLog	2015-12-17 07:49:45 UTC (rev 194213)
@@ -1,3 +1,20 @@
+2015-12-16  Alex Christensen  <[email protected]>
+
+        Make SessionID use intHash
+        https://bugs.webkit.org/show_bug.cgi?id=152356
+
+        Reviewed by Darin Adler.
+
+        * page/SessionID.h:
+        (WTF::SessionIDHash::hash):
+        (WTF::SessionIDHash::equal):
+        (WTF::HashTraits<WebCore::SessionID>::emptyValue):
+        (WTF::HashTraits<WebCore::SessionID>::constructDeletedValue):
+        (WTF::HashTraits<WebCore::SessionID>::isDeletedValue):
+        Use intHash instead of just casting a uint64_t to an unsigned.
+        This reduces hash collisions in HashTables that are usually quite small so it isn't much of a problem.
+        Also, needsDestruction hasn't been in HashTraits since r156507.
+
 2015-12-16  Simon Fraser  <[email protected]>
 
         Fix the debug region overlays for RTL documents

Modified: trunk/Source/WebCore/page/SessionID.h (194212 => 194213)


--- trunk/Source/WebCore/page/SessionID.h	2015-12-17 07:36:38 UTC (rev 194212)
+++ trunk/Source/WebCore/page/SessionID.h	2015-12-17 07:49:45 UTC (rev 194213)
@@ -56,13 +56,12 @@
 
 // The empty value is emptySessionID(), the deleted value is (-1)
 struct SessionIDHash {
-    static unsigned hash(const WebCore::SessionID& p) { return (unsigned)p.sessionID(); }
+    static unsigned hash(const WebCore::SessionID& p) { return intHash(p.sessionID()); }
     static bool equal(const WebCore::SessionID& a, const WebCore::SessionID& b) { return a == b; }
     static const bool safeToCompareToEmptyOrDeleted = true;
 };
 template<> struct HashTraits<WebCore::SessionID> : GenericHashTraits<WebCore::SessionID> {
-    static const uint64_t deletedValueIdentifier = 0xffffffffffffffff;
-    static const bool needsDestruction = false;
+    static const uint64_t deletedValueIdentifier = std::numeric_limits<uint64_t>::max();
     static WebCore::SessionID emptyValue() { return WebCore::SessionID::emptySessionID(); }
 
     static void constructDeletedValue(WebCore::SessionID& slot) { slot = WebCore::SessionID(deletedValueIdentifier); }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to