Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ac63cc259d741c45ff70bc7109c3974b0561e103
      
https://github.com/WebKit/WebKit/commit/ac63cc259d741c45ff70bc7109c3974b0561e103
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-01-29 (Thu, 29 Jan 2026)

  Changed paths:
    A JSTests/microbenchmarks/regexp-fixed-count-non-capturing-parens.js
    A JSTests/stress/regexp-fixed-count-parentheses-unroll.js
    M Source/JavaScriptCore/yarr/Yarr.h
    M Source/JavaScriptCore/yarr/YarrJIT.cpp
    M Source/JavaScriptCore/yarr/YarrPattern.h

  Log Message:
  -----------
  [YARR] Add JIT support for non-capturing parentheses with fixed count 
quantifiers
https://bugs.webkit.org/show_bug.cgi?id=305284

Reviewed by Yusuke Suzuki.

Previously, non-capturing parenthesized subpatterns with fixed count quantifiers
like (?:abc){3} would fail JIT compilation with 
FixedCountParenthesizedSubpattern
and fall back to the slower interpreter.

This patch adds new YarrOpCodes (ParenthesesSubpatternFixedCountBegin/End) to
handle these patterns in JIT. The implementation uses a simple counter-based
loop that iterates until the required count is reached.

Also fixes a bug in checkAdjust calculation where the condition for reducing
checkAdjust was inconsistent between opCompileParenthesesSubpattern and
SimpleNestedAlternativeBegin/Next, causing incorrect character read positions
for FixedCount patterns with quantityMaxCount > 1.

                                                 TipOfTree                  
Patched

regexp-fixed-count-non-capturing-parens      159.5820+-1.7347     ^     
40.9978+-0.4434        ^ definitely 3.8925x faster

* JSTests/microbenchmarks/regexp-fixed-count-non-capturing-parens.js: Added.
(re1):
(re2):
(re3):
(re4):
* JSTests/stress/regexp-fixed-count-parentheses-unroll.js: Added.
(shouldBe):
(shouldBeFalse):
(testBasicThreeOrMore):
(testBoundedRange):
(testFourOrMore):
(testTwoToFive):
(testMarkedHrPatterns):
(testComplexPatterns):
(testNestedParentheses):
(testCapturingGroups):
(testExactCount):
(testJITCompilation):
(testGreedyNonGreedy):
(testOneToN):
* Source/JavaScriptCore/yarr/Yarr.h:
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
* Source/JavaScriptCore/yarr/YarrPattern.h:
(JSC::Yarr::BackTrackInfoParenthesesFixedCount::beginIndex):
(JSC::Yarr::BackTrackInfoParenthesesFixedCount::matchAmountIndex):

Canonical link: https://commits.webkit.org/306402@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to