Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 76449f2142c4ac0525718c83016c7e4c122dea0e
      
https://github.com/WebKit/WebKit/commit/76449f2142c4ac0525718c83016c7e4c122dea0e
  Author: Yusuke Suzuki <[email protected]>
  Date:   2023-08-14 (Mon, 14 Aug 2023)

  Changed paths:
    M Source/JavaScriptCore/runtime/HashMapImpl.h
    M Source/JavaScriptCore/runtime/HashMapImplInlines.h

  Log Message:
  -----------
  [JSC] Remove distinct tail bucket in JSMap / JSSet
https://bugs.webkit.org/show_bug.cgi?id=260117
rdar://113791351

Reviewed by Michael Saboff.

JSMap / JSSet's m_tail can just point to the same entry to the head initially.
And we can keep this head's next() as nullptr.
So,

1. Iterating entries is just doing it until we hit nullptr.
2. Adding a entry is chaining a new entry after m_tail and replace m_tail with 
this new entry.
3. Removing a entry is unchaining from this linked-list. But we must correctly 
update m_tail when removing a entry which is pointed by m_tail too.

Then, we do not need to have distinct tail entry for JSMap and JSSet.

* Source/JavaScriptCore/runtime/HashMapImplInlines.h:
(JSC::HashMapImpl<HashMapBucketType>::removeNormalized):
(JSC::HashMapImpl<HashMapBucketType>::clear):
(JSC::HashMapImpl<HashMapBucketType>::setUpHeadAndTail):
(JSC::HashMapImpl<HashMapBucketType>::addNormalizedInternal):
(JSC::HashMapImpl<HashMapBucketType>::rehash):
(JSC::HashMapImpl<HashMapBucketType>::checkConsistency const):

Canonical link: https://commits.webkit.org/266869@main


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

Reply via email to