Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d8a2cff9580051b42872a75c826f1ef1b8ed6d6b
https://github.com/WebKit/WebKit/commit/d8a2cff9580051b42872a75c826f1ef1b8ed6d6b
Author: Sosuke Suzuki <[email protected]>
Date: 2026-09-17 (Thu, 17 Sep 2026)
Changed paths:
A JSTests/stress/regexp-test-anchored-first-char-filter-last-index.js
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
Log Message:
-----------
[JSC] `RegExp#test` anchored first-character filter must not skip the
`lastIndex` read
https://bugs.webkit.org/show_bug.cgi?id=324307
Reviewed by Yusuke Suzuki.
RegExpBuiltinExec reads lastIndex through ToLength(? Get(R, "lastIndex")) for
every RegExp, global or not, so a non-numeric lastIndex has observable effects
(a valueOf call, or the TypeError a Symbol or BigInt throws) even when
RegExp#test answers false. The first-character filter that 317836@main added
for a constant /^.../ answers false without reading lastIndex, so after DFG /
FTL tier-up those effects silently disappear.
Take the fast path only when lastIndex is an Int32, the way the sticky
first-character filter and the minimum-length filter (320582@main) already do,
and leave everything else to the slow path call.
Test: JSTests/stress/regexp-test-anchored-first-char-filter-last-index.js
* JSTests/stress/regexp-test-anchored-first-char-filter-last-index.js: Added.
(shouldBe):
(countThrows):
(testSmall):
(regExp.lastIndex.valueOf):
(shouldBe.testValueOf):
(shouldBe.testSymbol):
(shouldBe.testBigInt):
(shouldBe.testThrowingValueOf):
(shouldBe.LastIndexError):
(shouldBe.testNewRegExp):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::emitRegExpTestWithFilter):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
Canonical link: https://commits.webkit.org/321363@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications