Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DocumentSharedObjectPool prevents sharing of ElementData in case of hash collision #11681

Commits on Mar 20, 2023

  1. DocumentSharedObjectPool prevents sharing of ElementData in case of h…

    …ash collision
    
    https://bugs.webkit.org/show_bug.cgi?id=254114
    
    Reviewed by Darin Adler.
    
    Use a HashSet of RefPtr<ShareableElementData> for the cache, with proper traits
    and hashing so that it does what we expect. This means we can let the HashSet
    implementation deal with hash collision and we can still share ElementData in
    the event of such collision.
    
    The previous code was using a HashMap whose key was the hash and thus couldn't
    deal with hash collision and would just not share in this case.
    
    This is performance neutral on Speedometer on both iPhone and Mac.
    
    * Source/WebCore/dom/DocumentSharedObjectPool.cpp:
    (WebCore::DocumentSharedObjectPool::ShareableElementDataHash::hash):
    (WebCore::DocumentSharedObjectPool::ShareableElementDataHash::equal):
    (WebCore::AttributeSpanTranslator::hash):
    (WebCore::AttributeSpanTranslator::equal):
    (WebCore::AttributeSpanTranslator::translate):
    (WebCore::DocumentSharedObjectPool::cachedShareableElementDataWithAttributes):
    (WebCore::hasSameAttributes): Deleted.
    * Source/WebCore/dom/DocumentSharedObjectPool.h:
    
    Canonical link: https://commits.webkit.org/261893@main
    cdumez committed Mar 20, 2023
    Configuration menu
    Copy the full SHA
    89317dd View commit details
    Browse the repository at this point in the history