Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 12492a1cf13705dfab7e9482b1338fcb077ee2c4
https://github.com/WebKit/WebKit/commit/12492a1cf13705dfab7e9482b1338fcb077ee2c4
Author: Ahmad Saleem <[email protected]>
Date: 2026-09-19 (Sat, 19 Sep 2026)
Changed paths:
M Source/WebCore/dom/Document.h
Log Message:
-----------
Consolidate Document's scattered bool members into a bitfield block to reduce
per-document memory
https://bugs.webkit.org/show_bug.cgi?id=324645
rdar://187890362
Reviewed by Chris Dumez.
Document declared ~60 standalone bool members interspersed with
differently-sized
members (unsigned counters, enums, OptionSets, a Vector). Each lone bool cost a
byte plus alignment padding, and bools sitting between larger members forced
extra
padding, inflating every Document allocation.
Consolidate the independent flags into a single contiguous run of `: 1`
bitfields
so the compiler packs them into a few bytes instead of one byte-plus-padding
each,
and move the non-bool members that were splitting the run (m_xmlStandalone,
m_colorScheme, m_compatibilityMode, m_pendingCompressionDictionaryLoads,
m_renderTreeState, m_isOriginKeyed) above the block. The lone
m_shouldNotFireMutationEvents is folded into the block as well.
Six flags are intentionally kept as full bool members because they are bound by
reference, which a bitfield cannot be: m_ignorePendingStylesheets,
m_inRenderTreeUpdate, m_isInStyleInterleavedLayout (SetForScope),
m_renderingIsSuppressedForViewTransition,
m_enableRenderingIsSuppressedForViewTransitionAfterUpdateRendering
(std::exchange),
and m_inHitTesting (SetForScope, ASSERT_ENABLED). m_compatibilityMode stays a
regular addressable member because OBJECT_OFFSETOF is taken on it for the CSS
JIT.
No behavior change; purely a memory-layout optimization. Measured on the real
WebCore::Document type (arm64, release config) via -fsyntax-only record layout:
sizeof drops from 4800 to 4752 bytes, i.e. 48 bytes saved per Document. The
exact
figure is specific to this build's enabled features; other ports/ABIs recover
padding
from the same region but the total may differ.
* Source/WebCore/dom/Document.h:
Canonical link: https://commits.webkit.org/321463@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications