Changeset 194213 in webkit


Ignore:
Timestamp:
Dec 16, 2015 11:49:45 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Alex Christensen <achristensen@webkit.org> 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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r194210 r194213  
     12015-12-16  Alex Christensen  <achristensen@webkit.org>
     2
     3        Make SessionID use intHash
     4        https://bugs.webkit.org/show_bug.cgi?id=152356
     5
     6        Reviewed by Darin Adler.
     7
     8        * page/SessionID.h:
     9        (WTF::SessionIDHash::hash):
     10        (WTF::SessionIDHash::equal):
     11        (WTF::HashTraits<WebCore::SessionID>::emptyValue):
     12        (WTF::HashTraits<WebCore::SessionID>::constructDeletedValue):
     13        (WTF::HashTraits<WebCore::SessionID>::isDeletedValue):
     14        Use intHash instead of just casting a uint64_t to an unsigned.
     15        This reduces hash collisions in HashTables that are usually quite small so it isn't much of a problem.
     16        Also, needsDestruction hasn't been in HashTraits since r156507.
     17
    1182015-12-16  Simon Fraser  <simon.fraser@apple.com>
    219
  • trunk/Source/WebCore/page/SessionID.h

    r177692 r194213  
    5757// The empty value is emptySessionID(), the deleted value is (-1)
    5858struct SessionIDHash {
    59     static unsigned hash(const WebCore::SessionID& p) { return (unsigned)p.sessionID(); }
     59    static unsigned hash(const WebCore::SessionID& p) { return intHash(p.sessionID()); }
    6060    static bool equal(const WebCore::SessionID& a, const WebCore::SessionID& b) { return a == b; }
    6161    static const bool safeToCompareToEmptyOrDeleted = true;
    6262};
    6363template<> struct HashTraits<WebCore::SessionID> : GenericHashTraits<WebCore::SessionID> {
    64     static const uint64_t deletedValueIdentifier = 0xffffffffffffffff;
    65     static const bool needsDestruction = false;
     64    static const uint64_t deletedValueIdentifier = std::numeric_limits<uint64_t>::max();
    6665    static WebCore::SessionID emptyValue() { return WebCore::SessionID::emptySessionID(); }
    6766
Note: See TracChangeset for help on using the changeset viewer.