Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 656d3c36830f999c3dee135b2fc80e7a3e374128
https://github.com/WebKit/WebKit/commit/656d3c36830f999c3dee135b2fc80e7a3e374128
Author: Yijia Huang <[email protected]>
Date: 2026-07-27 (Mon, 27 Jul 2026)
Changed paths:
M Source/JavaScriptCore/runtime/JSONObject.cpp
M Source/WTF/wtf/MathExtras.h
M Tools/TestWebKitAPI/Tests/WTF/MathExtras.cpp
Log Message:
-----------
[JSC] Add an 8-byte SWAR fast path to JSON.stringify's stringCopySameType for
short strings
https://bugs.webkit.org/show_bug.cgi?id=320393
rdar://183349883
Reviewed by Yusuke Suzuki.
stringCopySameType() copies a string's bytes into the output buffer while
checking for characters that need JSON escaping ('"', '\', and control
characters). It had a scalar byte-at-a-time fallback and a 16-byte SIMD fast
path, but nothing in between, so strings shorter than 16 bytes always took
the scalar loop.
Add an intermediate tier for 8-15 byte strings: a SWAR (SIMD-within-a-register)
check that packs 8 bytes into one 64-bit word and tests all of them for
escapable characters at once using plain integer arithmetic. It mirrors the
existing 16-byte tier's overlapping-tail-read technique, so it never reads or
writes outside the string's own bounds.
Test: Tools/TestWebKitAPI/Tests/WTF/MathExtras.cpp
Canonical link: https://commits.webkit.org/318021@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications