HashTable::removeIf always shrinks the hash table by half even if there is nothing...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Apr 2019 19:16:22 +0000 (19:16 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Apr 2019 19:16:22 +0000 (19:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196681
<rdar://problem/49917764>

Reviewed by Darin Adler.

Address Darin's comments by removing the explicit type from std::max.

* wtf/HashTable.h:
(WTF::KeyTraits>::computeBestTableSize):
(WTF::KeyTraits>::shrinkToBestSize):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244489 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WTF/ChangeLog
Source/WTF/wtf/HashTable.h

index d9914fc..5c29b20 100644 (file)
@@ -1,3 +1,17 @@
+2019-04-19  Ryosuke Niwa  <rniwa@webkit.org>
+
+        HashTable::removeIf always shrinks the hash table by half even if there is nothing left
+        https://bugs.webkit.org/show_bug.cgi?id=196681
+        <rdar://problem/49917764>
+
+        Reviewed by Darin Adler.
+
+        Address Darin's comments by removing the explicit type from std::max.
+
+        * wtf/HashTable.h:
+        (WTF::KeyTraits>::computeBestTableSize):
+        (WTF::KeyTraits>::shrinkToBestSize):
+
 2019-04-18  Chris Dumez  <cdumez@apple.com>
 
         [iOS] Improve detection of when web views go to background / foreground
 2019-04-18  Chris Dumez  <cdumez@apple.com>
 
         [iOS] Improve detection of when web views go to background / foreground
index daa84e6..2281d1f 100644 (file)
@@ -1210,14 +1210,14 @@ namespace WTF {
             bestTableSize *= 2;
 
         unsigned minimumTableSize = KeyTraits::minimumTableSize;
             bestTableSize *= 2;
 
         unsigned minimumTableSize = KeyTraits::minimumTableSize;
-        return std::max<unsigned>(bestTableSize, minimumTableSize);
+        return std::max(bestTableSize, minimumTableSize);
     }
 
     template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
     void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::shrinkToBestSize()
     {
         unsigned minimumTableSize = KeyTraits::minimumTableSize;
     }
 
     template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
     void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::shrinkToBestSize()
     {
         unsigned minimumTableSize = KeyTraits::minimumTableSize;
-        rehash(std::max<unsigned>(minimumTableSize, computeBestTableSize(m_keyCount)), nullptr);
+        rehash(std::max(minimumTableSize, computeBestTableSize(m_keyCount)), nullptr);
     }
 
     template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
     }
 
     template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>