Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 08d31de09e2b120d1bb2a2bb9abe97c6f3802c13
      
https://github.com/WebKit/WebKit/commit/08d31de09e2b120d1bb2a2bb9abe97c6f3802c13
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    M Source/WebCore/cssjit/SelectorCompiler.cpp

  Log Message:
  -----------
  Reduce sizeof(SelectorFragment) by eliminating struct padding in the CSS JIT
https://bugs.webkit.org/show_bug.cgi?id=320628
rdar://183591712

Reviewed by Chris Dumez.

SelectorFragment had 12 bytes of padding holes on 64-bit: 3 bytes after
isRightmostOrAdjacent, 3 bytes after backtrackingFlags, and 6 bytes of tail
padding after the two trailing bools.

Give BacktrackingAction, FragmentRelation and FragmentPositionInRootFragments
an explicit uint8_t underlying type, and move matchesHasScope and
onlyMatchesLinksInQuirksMode up beside the other byte-sized members so all ten
of them pack contiguously into offsets 0-9. This moves the first pointer member
from offset 56 down to 40 and takes sizeof(SelectorFragment) from 528 to 504,
leaving only the 2 bytes of alignment padding before the first unsigned.

These three enums are used only within SelectorCompiler.cpp for bookkeeping
during compilation; none of them are encoded into the generated code, so
narrowing them has no effect on the emitted JIT code.

SelectorFragmentList is a Vector<SelectorFragment, 4>, so its inline (stack)
storage shrinks from 2144 to 2048 bytes. That saving compounds while compiling
nested functional pseudo-classes, where notFilters, matchesFilters and the
nthChildOf filter lists nest SelectorFragmentLists recursively. See the
existing FIXME about the inline capacity in this struct.

No change in behavior.

* Source/WebCore/cssjit/SelectorCompiler.cpp:

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



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

Reply via email to