Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a8416d2c6a3b7d924f976017ad15a3cd3f89ae0c
      
https://github.com/WebKit/WebKit/commit/a8416d2c6a3b7d924f976017ad15a3cd3f89ae0c
  Author: Chris Dumez <[email protected]>
  Date:   2025-05-18 (Sun, 18 May 2025)

  Changed paths:
    M Source/WTF/wtf/Forward.h
    M Source/WTF/wtf/HashMap.h
    M Source/WTF/wtf/HashSet.h
    M Source/WTF/wtf/HashTable.h
    M Source/WTF/wtf/ListHashSet.h
    M Source/WTF/wtf/RobinHoodHashTable.h

  Log Message:
  -----------
  HashTable doesn't need `ShouldValidateKey` as template parameter for the 
whole class
https://bugs.webkit.org/show_bug.cgi?id=293190

Reviewed by Geoffrey Garen and Darin Adler.

HashTable doesn't need `ShouldValidateKey` as template parameter for the whole
class. Instead, only add this template parameter for HashTable functions that
actually need it. This reduces unnecessary code duplication, reduces binary
size in WebCore by 1MB and avoids redundant key validations since we can now
be more fine-grained.

Also extract `checkKey` out of HashTable to reduce template-related duplication.
This reduces the binary size for WebKit by 1MB.

* Source/WTF/wtf/Forward.h:
* Source/WTF/wtf/HashMap.h:
(WTF::M>::find):
(WTF::M>::find const):
(WTF::M>::contains const):
(WTF::M>::get const):
(WTF::M>::inlineGet const):
(WTF::M>::inlineAdd):
(WTF::M>::inlineEnsure):
(WTF::M>::ensure):
(WTF::M>::add):
(WTF::M>::getOptional const):
* Source/WTF/wtf/HashSet.h:
(WTF::shouldValidateKey>::find const):
(WTF::shouldValidateKey>::contains const):
(WTF::shouldValidateKey>::ensure):
(WTF::shouldValidateKey>::add):
(WTF::shouldValidateKey>::addVoid):
* Source/WTF/wtf/HashTable.h:
(WTF::HashTable::add):
(WTF::HashTable::find):
(WTF::HashTable::find const):
(WTF::HashTable::contains const):
(WTF::HashTable::lookup):
(WTF::Malloc>::HashTable):
(WTF::Malloc>::checkKey):
(WTF::Malloc>::lookup):
(WTF::Malloc>::inlineLookup):
(WTF::Malloc>::lookupForReinsert):
(WTF::Malloc>::fullLookupForWriting):
(WTF::Malloc>::addUniqueForInitialization):
(WTF::Malloc>::initializeBucket):
(WTF::Malloc>::add):
(WTF::Malloc>::addPassingHashCode):
(WTF::Malloc>::reinsert):
(WTF::Malloc>::find):
(WTF::Malloc>::find const):
(WTF::Malloc>::contains const):
(WTF::Malloc>::removeAndInvalidateWithoutEntryConsistencyCheck):
(WTF::Malloc>::removeAndInvalidate):
(WTF::Malloc>::remove):
(WTF::Malloc>::removeWithoutEntryConsistencyCheck):
(WTF::Malloc>::removeIf):
(WTF::Malloc>::takeIf):
(WTF::Malloc>::allocateTable):
(WTF::Malloc>::deallocateTable):
(WTF::Malloc>::expand):
(WTF::Malloc>::computeBestTableSize):
(WTF::Malloc>::shrinkToBestSize):
(WTF::Malloc>::deleteReleasedWeakBuckets):
(WTF::Malloc>::rehash):
(WTF::Malloc>::clear):
(WTF::Malloc>::swap):
(WTF::=):
(WTF::Malloc>::checkTableConsistency const):
(WTF::Malloc>::checkTableConsistencyExceptSize const):
* Source/WTF/wtf/ListHashSet.h:
(WTF::U>::takeFirst):
(WTF::U>::takeLast):
(WTF::U>::find):
(WTF::U>::find const):
(WTF::U>::contains const):
(WTF::U>::add):
(WTF::U>::appendOrMoveToLast):
(WTF::U>::moveToLastIfPresent):
(WTF::U>::prependOrMoveToFirst):
(WTF::U>::insertBefore):
(WTF::U>::remove):
* Source/WTF/wtf/RobinHoodHashTable.h:
(WTF::RobinHoodHashTable::add):
(WTF::RobinHoodHashTable::find):
(WTF::RobinHoodHashTable::find const):
(WTF::RobinHoodHashTable::contains const):
(WTF::RobinHoodHashTable::lookup):
(WTF::Malloc>::checkKey):
(WTF::Malloc>::lookup):
(WTF::Malloc>::inlineLookup):
(WTF::Malloc>::initializeBucket):
(WTF::Malloc>::add):
(WTF::Malloc>::maintainProbeDistanceForAdd):
(WTF::Malloc>::addPassingHashCode):
(WTF::Malloc>::reinsert):
(WTF::Malloc>::find):
(WTF::Malloc>::find const):
(WTF::Malloc>::contains const):
(WTF::Malloc>::removeAndInvalidateWithoutEntryConsistencyCheck):
(WTF::Malloc>::removeAndInvalidate):
(WTF::Malloc>::remove):
(WTF::Malloc>::removeWithoutEntryConsistencyCheck):
(WTF::Malloc>::allocateTable):
(WTF::Malloc>::deallocateTable):
(WTF::Malloc>::expand):
(WTF::Malloc>::computeBestTableSize):
(WTF::Malloc>::shrinkToBestSize):
(WTF::Malloc>::rehash):
(WTF::Malloc>::clear):
(WTF::Malloc>::RobinHoodHashTable):
(WTF::Malloc>::swap):
(WTF::=):
(WTF::Malloc>::checkTableConsistency const):
(WTF::Malloc>::checkTableConsistencyExceptSize const):

Canonical link: https://commits.webkit.org/295078@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to