Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 89317dd884bfa4f5ff71561d6a83740950de6de7
      
https://github.com/WebKit/WebKit/commit/89317dd884bfa4f5ff71561d6a83740950de6de7
  Author: Chris Dumez <[email protected]>
  Date:   2023-03-20 (Mon, 20 Mar 2023)

  Changed paths:
    M Source/WebCore/dom/DocumentSharedObjectPool.cpp
    M Source/WebCore/dom/DocumentSharedObjectPool.h

  Log Message:
  -----------
  DocumentSharedObjectPool prevents sharing of ElementData in case of hash 
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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to