Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: da12fb32aeb97f8774681deafc767602667934e2
      
https://github.com/WebKit/WebKit/commit/da12fb32aeb97f8774681deafc767602667934e2
  Author: Yijia Huang <[email protected]>
  Date:   2026-08-13 (Thu, 13 Aug 2026)

  Changed paths:
    M Source/JavaScriptCore/runtime/JSONObject.cpp

  Log Message:
  -----------
  [JSC] Improve FastStringifier's short string copy tiers
https://bugs.webkit.org/show_bug.cgi?id=321622
rdar://184750925

Reviewed by Yusuke Suzuki.

stringCopySameType tiers by length: SIMD at the vector stride, an 8-byte SWAR
loop below that, then a per-character loop. Short JSON property names fall into
the lower tiers.

Add a 4-7 byte tier: copy the first and last four bytes, packed into one 64-bit
word and validated by the existing eightByteRangeNeedsJSONEscape. The two
four-byte windows overlap below 8 bytes, but they rewrite the repeated bytes
with the same values, and duplicates cannot change the escape verdict. Only
BufferMode::DynamicBuffer enables the tier, leaving StaticBuffer's inlined code
unchanged; the 16-bit site is left out since the tier is Latin1-only.

Where SIMD is compiled in, the 8-byte tier only ever sees 8-15 bytes, so its
loop always runs exactly once. Replace it with the same two-window form in both
stringCopySameType and stringCopyUpconvert, dropping a backedge and a tail
branch from each. A static_assert ties this to the SIMD threshold: two narrow
strides must cover whatever the SIMD tier leaves behind. narrowStride counts
elements, so in stringCopyUpconvert one window advances the source by eight
bytes and the destination by sixteen.

Also name that threshold condition JSON_STRING_COPY_HAS_SIMD instead of
repeating it three times, and hoist narrowStride to file scope as
sizeof(uint64_t), which is what the eight-byte helpers actually operate on.
stringCopyUpconvert now uses it in place of a bare 8.

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



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

Reply via email to