Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: fea77037ca1f856086ae677086b51233c27eb1e8
https://github.com/WebKit/WebKit/commit/fea77037ca1f856086ae677086b51233c27eb1e8
Author: Sosuke Suzuki <[email protected]>
Date: 2026-09-06 (Sun, 06 Sep 2026)
Changed paths:
A JSTests/stress/regexp-test-minimum-length-filter-last-index.js
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
Log Message:
-----------
[JSC] `RegExp#test` minimum-length filter must not skip the `lastIndex` read
https://bugs.webkit.org/show_bug.cgi?id=323501
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 throws) even when RegExp#test
answers false. The minimum-length fast path added in 320487@main 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 already does, and leave everything else to the slow
path call.
Test: JSTests/stress/regexp-test-minimum-length-filter-last-index.js
* JSTests/stress/regexp-test-minimum-length-filter-last-index.js: Added.
(shouldBe):
(testConstantUnicode):
(warmUp):
(testThrowingValueOf):
(testCountingValueOf):
(testSymbolLastIndex):
(constantRegExp.lastIndex.valueOf):
(throw.new.Error):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::emitRegExpMinimumLengthFilterGuards):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
Canonical link: https://commits.webkit.org/320582@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications