[webkit-changes] [WebKit/WebKit] df2b10: [WTF] Introduce validateKey to HashMap (2/3)
Zak Ridouh
noreply at github.com
Thu Oct 17 00:44:20 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: df2b100eb9bbe0ffb024788c7652aa045359ed7e
https://github.com/WebKit/WebKit/commit/df2b100eb9bbe0ffb024788c7652aa045359ed7e
Author: Zak Ridouh <zakr at apple.com>
Date: 2024-10-17 (Thu, 17 Oct 2024)
Changed paths:
M Source/WTF/wtf/Forward.h
M Source/WTF/wtf/HashMap.h
M Source/WTF/wtf/HashTable.h
M Source/WebCore/style/AnchorPositionEvaluator.h
Log Message:
-----------
[WTF] Introduce validateKey to HashMap (2/3)
https://bugs.webkit.org/show_bug.cgi?id=279544
rdar://135826905
Reviewed by Geoffrey Garen.
TLDR: `WTF::HashMap` is now safe by default. Use `UncheckedKeyHashMap`
to circumvent checks in performance sensitive code. The vast majority of code should
use `HashMap`.
Elevate `ASSERT`s to `RELEASE_ASSERT`s in `WTF::HashTable::checkKey()` for `HashMap`, building on
a previous patch that a new type alias for an unsafe hashmap, aptly called `UncheckedKeyHashMap`.
Followup patches will expand on spreading this now safe HashMap across the codebase,
with the ultimate goal of having safe HashMap used in every non
performance sensitive portion of the code. [1]
[1] https://bugs.webkit.org/show_bug.cgi?id=278488
* Source/WTF/wtf/Forward.h:
* Source/WTF/wtf/HashMap.h:
(WTF::validateKey>::swap):
(WTF::validateKey>::size const):
(WTF::validateKey>::capacity const):
(WTF::validateKey>::byteSize const):
(WTF::validateKey>::isEmpty const):
(WTF::validateKey>::begin):
(WTF::validateKey>::end):
(WTF::validateKey>::begin const):
(WTF::validateKey>::end const):
(WTF::validateKey>::find):
(WTF::validateKey>::find const):
(WTF::validateKey>::contains const):
(WTF::validateKey>::get const):
(WTF::validateKey>::inlineGet const):
(WTF::validateKey>::remove):
(WTF::validateKey>::inlineSet):
(WTF::validateKey>::inlineAdd):
(WTF::validateKey>::inlineEnsure):
(WTF::validateKey>::set):
(WTF::validateKey>::ensure):
(WTF::validateKey>::add):
(WTF::validateKey>::fastAdd):
(WTF::validateKey>::getOptional const):
(WTF::validateKey>::removeIf):
(WTF::validateKey>::clear):
(WTF::validateKey>::take):
(WTF::validateKey>::takeOptional):
(WTF::validateKey>::takeFirst):
(WTF::validateKey>::checkConsistency const):
(WTF::validateKey>::isValidKey):
(WTF::operator==):
(WTF::Y>::swap): Deleted.
(WTF::Y>::size const): Deleted.
(WTF::Y>::capacity const): Deleted.
(WTF::Y>::byteSize const): Deleted.
(WTF::Y>::isEmpty const): Deleted.
(WTF::Y>::begin): Deleted.
(WTF::Y>::end): Deleted.
(WTF::Y>::begin const): Deleted.
(WTF::Y>::end const): Deleted.
(WTF::Y>::find): Deleted.
(WTF::Y>::find const): Deleted.
(WTF::Y>::contains const): Deleted.
(WTF::Y>::get const): Deleted.
(WTF::Y>::inlineGet const): Deleted.
(WTF::Y>::remove): Deleted.
(WTF::TableTraitsArg>::inlineSet): Deleted.
(WTF::TableTraitsArg>::inlineAdd): Deleted.
(WTF::TableTraitsArg>::inlineEnsure): Deleted.
(WTF::TableTraitsArg>::set): Deleted.
(WTF::TableTraitsArg>::ensure): Deleted.
(WTF::TableTraitsArg>::add): Deleted.
(WTF::TableTraitsArg>::fastAdd): Deleted.
(WTF::Y>::getOptional const): Deleted.
(WTF::Y>::removeIf): Deleted.
(WTF::Y>::clear): Deleted.
(WTF::Y>::take): Deleted.
(WTF::Y>::takeOptional): Deleted.
(WTF::Y>::takeFirst): Deleted.
(WTF::Y>::checkConsistency const): Deleted.
(WTF::Y>::isValidKey): Deleted.
* Source/WTF/wtf/HashTable.h:
(WTF::validateKey>::HashTable):
(WTF::validateKey>::checkKey):
(WTF::validateKey>::lookup):
(WTF::validateKey>::inlineLookup):
(WTF::validateKey>::lookupForReinsert):
(WTF::validateKey>::fullLookupForWriting):
(WTF::validateKey>::addUniqueForInitialization):
(WTF::validateKey>::initializeBucket):
(WTF::validateKey>::add):
(WTF::validateKey>::addPassingHashCode):
(WTF::validateKey>::reinsert):
(WTF::validateKey>::find):
(WTF::validateKey>::find const):
(WTF::validateKey>::contains const):
(WTF::validateKey>::removeAndInvalidateWithoutEntryConsistencyCheck):
(WTF::validateKey>::removeAndInvalidate):
(WTF::validateKey>::remove):
(WTF::validateKey>::removeWithoutEntryConsistencyCheck):
(WTF::validateKey>::removeIf):
(WTF::validateKey>::allocateTable):
(WTF::validateKey>::deallocateTable):
(WTF::validateKey>::expand):
(WTF::validateKey>::computeBestTableSize):
(WTF::validateKey>::shrinkToBestSize):
(WTF::validateKey>::deleteReleasedWeakBuckets):
(WTF::validateKey>::rehash):
(WTF::validateKey>::clear):
(WTF::validateKey>::swap):
(WTF::=):
(WTF::validateKey>::checkTableConsistency const):
(WTF::validateKey>::checkTableConsistencyExceptSize const):
(WTF::KeyTraits>::HashTable): Deleted.
(WTF::KeyTraits>::checkKey): Deleted.
(WTF::KeyTraits>::lookup): Deleted.
(WTF::KeyTraits>::inlineLookup): Deleted.
(WTF::KeyTraits>::lookupForReinsert): Deleted.
(WTF::KeyTraits>::fullLookupForWriting): Deleted.
(WTF::KeyTraits>::addUniqueForInitialization): Deleted.
(WTF::KeyTraits>::initializeBucket): Deleted.
(WTF::KeyTraits>::add): Deleted.
(WTF::KeyTraits>::addPassingHashCode): Deleted.
(WTF::KeyTraits>::reinsert): Deleted.
(WTF::KeyTraits>::find): Deleted.
(WTF::KeyTraits>::find const): Deleted.
(WTF::KeyTraits>::contains const): Deleted.
(WTF::KeyTraits>::removeAndInvalidateWithoutEntryConsistencyCheck): Deleted.
(WTF::KeyTraits>::removeAndInvalidate): Deleted.
(WTF::KeyTraits>::remove): Deleted.
(WTF::KeyTraits>::removeWithoutEntryConsistencyCheck): Deleted.
(WTF::KeyTraits>::removeIf): Deleted.
(WTF::KeyTraits>::allocateTable): Deleted.
(WTF::KeyTraits>::deallocateTable): Deleted.
(WTF::KeyTraits>::expand): Deleted.
(WTF::KeyTraits>::computeBestTableSize): Deleted.
(WTF::KeyTraits>::shrinkToBestSize): Deleted.
(WTF::KeyTraits>::deleteReleasedWeakBuckets): Deleted.
(WTF::KeyTraits>::rehash): Deleted.
(WTF::KeyTraits>::clear): Deleted.
(WTF::KeyTraits>::swap): Deleted.
(WTF::KeyTraits>::checkTableConsistency const): Deleted.
(WTF::KeyTraits>::checkTableConsistencyExceptSize const): Deleted.
Canonical link: https://commits.webkit.org/285319@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list