Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f3f8a5374a00497279556db7d3e423668506dcba
      
https://github.com/WebKit/WebKit/commit/f3f8a5374a00497279556db7d3e423668506dcba
  Author: Mark Lam <[email protected]>
  Date:   2026-02-03 (Tue, 03 Feb 2026)

  Changed paths:
    M Source/WTF/wtf/FastMalloc.h
    M Source/WebCore/dom/Node.h
    M Source/bmalloc/bmalloc/BCompiler.h
    M Source/bmalloc/bmalloc/TZoneHeap.h
    M Source/bmalloc/bmalloc/TZoneHeapInlines.h
    M Source/bmalloc/bmalloc/TZoneHeapManager.cpp

  Log Message:
  -----------
  Introducing a TZone Category using __builtin_tmo_get_type_descriptor.
https://bugs.webkit.org/show_bug.cgi?id=306883
rdar://169541053

Reviewed by Marcus Plutowski.

This change redefines the 64-bit TZoneDescriptor into several bit fields:

   bits 0-35 [ 36 bits ]: TZone Category defined hash.
  bits 36-40 [  5 bits ]: log2(alignment)
  bits 41-61 [ 31 bits ]: sizeClass divided by 16
  bits 62-63 [  2 bits ]: TZone Category

We also clearly defines 2 TZone Categories:

1. SizeAndAlignment
   - sorts TZone types by size and alignment alone.
   - This is the default TZone category is the type is not opted into another 
category.

2. BuiltinTypeDescriptor
   - adds __builtin_tmo_get_type_descriptor to size and alignment for sorting 
TZone types.
   - TZone types can opt their entire class hierarchy into this category by 
declaring
     `static constexpr bool usesBuiltinTypeDescriptorTZoneCategory = true` in 
their root
     base class.
   - Each derived class still needs to be declared TZONE_ALLOCATED individually 
(in order
     to instantiate type specific TZone support methods and data structures), 
but with
     `usesBuiltinTypeDescriptorTZoneCategory`, they will be opted into the
     BuiltinTypeDescriptor category.
   - Currently, we're only opting DOM nodes into this new category.

AB tests show that this change is perf neutral on all benchmarks.

No new tests because we're changing the way we sort TZone types into heaps.  
There's
currently no way to inquire as to which heap the type is sorted into.  This 
code was
manually tested by adding instrumentation to trace TZone type allocations, and 
then, decode
and check the TZoneDescriptor used for the types.  This instrumentation is too 
expensive in
terms of performance to keep in the build, and too intrusive to keep in the 
code base.

* Source/WTF/wtf/FastMalloc.h:
* Source/WebCore/dom/Node.h:
* Source/bmalloc/bmalloc/BCompiler.h:
* Source/bmalloc/bmalloc/TZoneHeap.h:
(bmalloc::api::TZoneSpecification::usesBuiltinTypeDescriptor):
(bmalloc::api::TZoneSpecification::encodeDefaultDescriptor):
(bmalloc::api::TZoneSpecification::encodeBuiltinTypeDescriptorHash):
(bmalloc::api::TZoneSpecification::encodeCategory):
(bmalloc::api::TZoneSpecification::encodeDescriptor):
* Source/bmalloc/bmalloc/TZoneHeapInlines.h:
* Source/bmalloc/bmalloc/TZoneHeapManager.cpp:
(bmalloc::api::TZoneDescriptorDecoder::category const):
(bmalloc::api::TZoneDescriptorDecoder::sizeClass const):
(bmalloc::api::TZoneDescriptorDecoder::alignment const):
(bmalloc::api::TZoneHeapManager::dumpRegisteredTypes):
(bmalloc::api::TZoneHeapManager::TZoneHeapManager::heapRefForTZoneTypeDifferentSize):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to