Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bbc000ae4f3ddb38ec1598977b06aad6236d9ac1
https://github.com/WebKit/WebKit/commit/bbc000ae4f3ddb38ec1598977b06aad6236d9ac1
Author: Sosuke Suzuki <[email protected]>
Date: 2026-08-10 (Mon, 10 Aug 2026)
Changed paths:
A JSTests/microbenchmarks/regexp-u-flag-character-class-greedy.js
A JSTests/microbenchmarks/regexp-u-flag-class-astral-subject.js
A JSTests/stress/regexp-unicode-code-unit-read-for-bmp-terms.js
M Source/JavaScriptCore/yarr/YarrJIT.cpp
M Source/JavaScriptCore/yarr/YarrPattern.cpp
M Source/JavaScriptCore/yarr/YarrPattern.h
Log Message:
-----------
[YARR] Read raw code units for surrogate-free BMP character classes in
unicode mode
https://bugs.webkit.org/show_bug.cgi?id=320903
Reviewed by Yusuke Suzuki.
With the /u and /v flags, YARR JIT decodes surrogate pairs for every character
read.
For a non-inverted character class holding only non-surrogate BMP code points,
the
decode is unnecessary: a surrogate code unit, a decoded non-BMP code point and
errorCodePoint all lie outside of such a class, so testing the raw code unit is
equivalent to testing the decoded code point.
This patch reads the raw code unit for such character class terms (\w, \d, \s,
[a-z],
BMP-only property escapes ...) in unicode mode and lets them use the class's 64K
m_table, which was disabled whenever surrogate pairs were being decoded.
Base Patch
regexp-u-flag-class-astral-subject 43.2756+-0.5243 ^
35.8856+-1.3000 ^ definitely 1.2059x faster
regexp-u-flag-character-class-greedy 88.1351+-4.7293 ^
39.2828+-0.2972 ^ definitely 2.2436x faster
Tests: JSTests/microbenchmarks/regexp-u-flag-character-class-greedy.js
JSTests/microbenchmarks/regexp-u-flag-class-astral-subject.js
JSTests/stress/regexp-unicode-code-unit-read-for-bmp-terms.js
* JSTests/microbenchmarks/regexp-u-flag-character-class-greedy.js: Added.
(splitmix32):
* JSTests/microbenchmarks/regexp-u-flag-class-astral-subject.js: Added.
* JSTests/stress/regexp-unicode-code-unit-read-for-bmp-terms.js: Added.
(shouldBe):
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
* Source/JavaScriptCore/yarr/YarrPattern.cpp:
(JSC::Yarr::CharacterClass::hasOnlyNonSurrogateBMPCharacters const):
* Source/JavaScriptCore/yarr/YarrPattern.h:
(JSC::Yarr::CharacterClass::hasOnlyBMPCharacters const):
Canonical link: https://commits.webkit.org/318881@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications