[webkit-changes] [WebKit/WebKit] 89317d: DocumentSharedObjectPool prevents sharing of Eleme...

Chris Dumez noreply at github.com
Mon Mar 20 16:26:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 89317dd884bfa4f5ff71561d6a83740950de6de7
      https://github.com/WebKit/WebKit/commit/89317dd884bfa4f5ff71561d6a83740950de6de7
  Author: Chris Dumez <cdumez at apple.com>
  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




More information about the webkit-changes mailing list