Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b128ddd863ab9e89a71288a461606b0aee6b3bca
https://github.com/WebKit/WebKit/commit/b128ddd863ab9e89a71288a461606b0aee6b3bca
Author: Yusuke Suzuki <[email protected]>
Date: 2026-07-27 (Mon, 27 Jul 2026)
Changed paths:
A JSTests/stress/regexp-sticky-dot-star-wrapped-expression.js
M Source/JavaScriptCore/yarr/YarrPattern.cpp
Log Message:
-----------
[YARR] The dot-star-wrapped-expression optimization is wrong for sticky
patterns
https://bugs.webkit.org/show_bug.cgi?id=320348
rdar://183300106
Reviewed by Yijia Huang.
optimizeDotStarWrappedExpressions() rewrites /^.*EXPR.*$/ into EXPR
followed by a DotStarEnclosure term standing in for the deleted `^`
and the two `.*`. The enclosure reports the position of EXPR rather than
the position the leading `.*` starts at. That is invisible for an
ordinary search, but a sticky pattern must begin its match exactly at
lastIndex, so /^.*a.*$/y rejected "xa" instead of matching the whole
string at index 0. This patch disables optimizeDotStarWrappedExpressions
when sticky bit is set.
Test: JSTests/stress/regexp-sticky-dot-star-wrapped-expression.js
* JSTests/stress/regexp-sticky-dot-star-wrapped-expression.js: Added.
(shouldBe):
(check):
(step):
* Source/JavaScriptCore/yarr/YarrPattern.cpp:
(JSC::Yarr::YarrPatternConstructor::optimizeDotStarWrappedExpressions):
Canonical link: https://commits.webkit.org/317983@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications