Title: [269017] trunk/Source/WTF
Revision
269017
Author
[email protected]
Date
2020-10-26 19:04:13 -0700 (Mon, 26 Oct 2020)

Log Message

Assert that WTF::HashTable does not visit the same bucket twice
https://bugs.webkit.org/show_bug.cgi?id=217691
<rdar://problem/69887843>

Reviewed by Saam Barati.

* wtf/HashTable.h:
(WTF::KeyTraits>::inlineLookup):
(WTF::KeyTraits>::lookupForWriting):
(WTF::KeyTraits>::fullLookupForWriting):
(WTF::KeyTraits>::addUniqueForInitialization):
(WTF::KeyTraits>::add):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (269016 => 269017)


--- trunk/Source/WTF/ChangeLog	2020-10-27 01:56:16 UTC (rev 269016)
+++ trunk/Source/WTF/ChangeLog	2020-10-27 02:04:13 UTC (rev 269017)
@@ -1,3 +1,18 @@
+2020-10-13  Tadeu Zagallo  <[email protected]>
+
+        Assert that WTF::HashTable does not visit the same bucket twice
+        https://bugs.webkit.org/show_bug.cgi?id=217691
+        <rdar://problem/69887843>
+
+        Reviewed by Saam Barati.
+
+        * wtf/HashTable.h:
+        (WTF::KeyTraits>::inlineLookup):
+        (WTF::KeyTraits>::lookupForWriting):
+        (WTF::KeyTraits>::fullLookupForWriting):
+        (WTF::KeyTraits>::addUniqueForInitialization):
+        (WTF::KeyTraits>::add):
+
 2020-10-26  Alex Christensen  <[email protected]>
 
         Inclusive software: Remove instances of "dumb" from the code

Modified: trunk/Source/WTF/wtf/HashTable.h (269016 => 269017)


--- trunk/Source/WTF/wtf/HashTable.h	2020-10-27 01:56:16 UTC (rev 269016)
+++ trunk/Source/WTF/wtf/HashTable.h	2020-10-27 02:04:13 UTC (rev 269017)
@@ -675,6 +675,7 @@
         unsigned sizeMask = tableSizeMask();
         unsigned h = HashTranslator::hash(key);
         unsigned i = h & sizeMask;
+        unsigned initialIndex = i;
 
 #if DUMP_HASHTABLE_STATS
         ++HashTableStats::numAccesses;
@@ -714,6 +715,7 @@
             if (k == 0)
                 k = 1 | doubleHash(h);
             i = (i + k) & sizeMask;
+            RELEASE_ASSERT(i != initialIndex);
         }
     }
 
@@ -729,6 +731,7 @@
         unsigned sizeMask = tableSizeMask();
         unsigned h = HashTranslator::hash(key);
         unsigned i = h & sizeMask;
+        unsigned initialIndex = i;
 
 #if DUMP_HASHTABLE_STATS
         ++HashTableStats::numAccesses;
@@ -775,6 +778,7 @@
             if (k == 0)
                 k = 1 | doubleHash(h);
             i = (i + k) & sizeMask;
+            RELEASE_ASSERT(i != initialIndex);
         }
     }
 
@@ -790,6 +794,7 @@
         unsigned sizeMask = tableSizeMask();
         unsigned h = HashTranslator::hash(key);
         unsigned i = h & sizeMask;
+        unsigned initialIndex = i;
 
 #if DUMP_HASHTABLE_STATS
         ++HashTableStats::numAccesses;
@@ -836,6 +841,7 @@
             if (k == 0)
                 k = 1 | doubleHash(h);
             i = (i + k) & sizeMask;
+            RELEASE_ASSERT(i != initialIndex);
         }
     }
 
@@ -856,6 +862,7 @@
         unsigned sizeMask = tableSizeMask();
         unsigned h = HashTranslator::hash(key);
         unsigned i = h & sizeMask;
+        unsigned initialIndex = i;
 
 #if DUMP_HASHTABLE_STATS
         ++HashTableStats::numAccesses;
@@ -885,6 +892,7 @@
             if (k == 0)
                 k = 1 | doubleHash(h);
             i = (i + k) & sizeMask;
+            RELEASE_ASSERT(i != initialIndex);
         }
 
         HashTranslator::translate(*entry, std::forward<T>(key), std::forward<Extra>(extra));
@@ -937,6 +945,7 @@
         unsigned sizeMask = tableSizeMask();
         unsigned h = HashTranslator::hash(key);
         unsigned i = h & sizeMask;
+        unsigned initialIndex = i;
 
 #if DUMP_HASHTABLE_STATS
         ++HashTableStats::numAccesses;
@@ -983,6 +992,7 @@
             if (k == 0)
                 k = 1 | doubleHash(h);
             i = (i + k) & sizeMask;
+            RELEASE_ASSERT(i != initialIndex);
         }
 
         if (deletedEntry) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to