HashTable doesn't need ShouldValidateKey as template parameter for the whole class#45555
Merged
webkit-commit-queue merged 1 commit intoMay 18, 2025
Conversation
Collaborator
|
EWS run on previous version of this PR (hash 91e9207) Details |
91e9207 to
21c5fce
Compare
Collaborator
|
EWS run on current version of this PR (hash 21c5fce) Details |
geoffreygaren
approved these changes
May 18, 2025
darinadler
approved these changes
May 18, 2025
…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
21c5fce to
a8416d2
Compare
Collaborator
|
Committed 295078@main (a8416d2): https://commits.webkit.org/295078@main Reviewed commits have been landed. Closing PR #45555 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
a8416d2
21c5fce