You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bbc000a
Browse filesBrowse the repository at this point in the historyBrowse files
[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
0 commit comments