Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1e43057f135a31c9c9c893ab4efe2874cef8e426
https://github.com/WebKit/WebKit/commit/1e43057f135a31c9c9c893ab4efe2874cef8e426
Author: Yusuke Suzuki <[email protected]>
Date: 2026-07-27 (Mon, 27 Jul 2026)
Changed paths:
A
JSTests/stress/regexp-anchored-first-char-filter-inverted-class-and-groups.js
A JSTests/stress/regexp-first-char-filter-anchoring-soundness.js
M JSTests/stress/regexp-test-anchored-first-char-filter.js
A JSTests/stress/regexp-test-sticky-first-char-filter.js
M Source/JavaScriptCore/dfg/DFGCommonData.h
M Source/JavaScriptCore/dfg/DFGGraph.cpp
M Source/JavaScriptCore/dfg/DFGGraph.h
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
M Source/JavaScriptCore/runtime/RegExp.cpp
M Source/JavaScriptCore/runtime/RegExp.h
M Source/JavaScriptCore/yarr/YarrPattern.cpp
M Source/JavaScriptCore/yarr/YarrPattern.h
M Source/WTF/wtf/BitSet.h
Log Message:
-----------
[JSC][YARR] Extend first-character filter more
https://bugs.webkit.org/show_bug.cgi?id=320258
rdar://183182586
Reviewed by Yijia Huang.
This patch extends first-character fast-fail filter in DFG / FTL.
1. Inverted character class is supported. Just collecting the set
and inverted set is merged.
2. Add filter for sticky RegExp#test(string) pattern as the same to
RegExp#exec(string).
3. Move BitSet to RegExp so we can compile and store it per-RegExp cell
basis. Concurrently compiling and storing the data and we can reuse
this by anchoring RegExp cell from DFG::Graph.
4. Expand first-character collection into parentheses, like ((^a)|(^b)).
Tests:
JSTests/stress/regexp-anchored-first-char-filter-inverted-class-and-groups.js
JSTests/stress/regexp-first-char-filter-anchoring-soundness.js
JSTests/stress/regexp-test-sticky-first-char-filter.js
*
JSTests/stress/regexp-anchored-first-char-filter-inverted-class-and-groups.js:
Added.
(shouldBe):
(step):
* JSTests/stress/regexp-first-char-filter-anchoring-soundness.js: Added.
(shouldBe):
(check):
(dotStarWrapped):
(genuinelyAnchored):
* JSTests/stress/regexp-test-anchored-first-char-filter.js:
* JSTests/stress/regexp-test-sticky-first-char-filter.js: Added.
(shouldBe):
(shouldThrow):
(step):
(const.reGrp):
(check):
* Source/JavaScriptCore/dfg/DFGCommonData.h:
* Source/JavaScriptCore/dfg/DFGGraph.cpp:
(JSC::DFG::Graph::tryGetConstantRegExpFirstCharacterBitmap):
(JSC::DFG::Graph::regExpFirstCharacterBitmap):
* Source/JavaScriptCore/dfg/DFGGraph.h:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::emitRegExpAnchoredFirstCharacterFilterGuards):
(JSC::DFG::SpeculativeJIT::emitRegExpStickyFirstCharacterFilterGuards):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* Source/JavaScriptCore/runtime/RegExp.cpp:
(JSC::RegExp::estimatedSize):
(JSC::RegExp::firstCharacterBitmap):
* Source/JavaScriptCore/runtime/RegExp.h:
* Source/JavaScriptCore/yarr/YarrPattern.cpp:
(JSC::Yarr::FirstCharacterBitmapBuilder::collectLatin1Members):
(JSC::Yarr::FirstCharacterBitmapBuilder::addCharacterClass):
(JSC::Yarr::FirstCharacterBitmapBuilder::addInvertedCharacterClass):
(JSC::Yarr::FirstCharacterBitmapBuilder::addTerm):
(JSC::Yarr::FirstCharacterBitmapBuilder::addAlternative):
(JSC::Yarr::FirstCharacterBitmapBuilder::addDisjunction):
(JSC::Yarr::computeFirstCharacterBitmap):
(JSC::Yarr::computeStickyFirstCharacterBitmap): Deleted.
(JSC::Yarr::computeAnchoredFirstCharacterBitmap): Deleted.
* Source/JavaScriptCore/yarr/YarrPattern.h:
* Source/WTF/wtf/BitSet.h:
Canonical link: https://commits.webkit.org/318022@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications