Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d21310b806f3d23c9a6c0ea4478221c5eb6eafd7
      
https://github.com/WebKit/WebKit/commit/d21310b806f3d23c9a6c0ea4478221c5eb6eafd7
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-08-24 (Mon, 24 Aug 2026)

  Changed paths:
    A JSTests/microbenchmarks/regexp-lookbehind-fixed-count-group.js
    A JSTests/microbenchmarks/regexp-lookbehind-quantified-group.js
    A JSTests/stress/regexp-lookbehind-jit-quantified-groups-unicode.js
    A JSTests/stress/regexp-lookbehind-jit-quantified-groups.js
    M Source/JavaScriptCore/yarr/YarrJIT.cpp
    M Source/JavaScriptCore/yarr/YarrPattern.cpp

  Log Message:
  -----------
  [YARR] Compile lookbehinds containing quantified groups in the JIT
https://bugs.webkit.org/show_bug.cgi?id=322244

Reviewed by Daniel Liu.

A group quantified with anything other than {1} or ? inside a lookbehind, e.g. 
(?<=(?:ab)+),
sent the whole pattern to the interpreter.

The counted and ParenContext group opcodes only save, compare and restore the 
index, so they
work in either direction. Two checks did depend on it: the lazy group's "try 
one more iteration"
test must see the index move down when matching backward, and the optional copy 
the parser
splits a backward X{n,m} into must not clear the captures it shares with the 
mandatory part
when it backtracks out of zero iterations. Forward code generation is unchanged.

                                                 Baseline                  
Patched

regexp-lookbehind-quantified-group         2598.3586+-382.2034   ^    
200.9308+-11.4910       ^ definitely 12.9316x faster
regexp-lookbehind-fixed-count-group        3523.6885+-262.9262   ^    
218.0944+-3.0137        ^ definitely 16.1567x faster

Tests: JSTests/microbenchmarks/regexp-lookbehind-fixed-count-group.js
       JSTests/microbenchmarks/regexp-lookbehind-quantified-group.js
       JSTests/stress/regexp-lookbehind-jit-quantified-groups-unicode.js
       JSTests/stress/regexp-lookbehind-jit-quantified-groups.js

* JSTests/microbenchmarks/regexp-lookbehind-fixed-count-group.js: Added.
(let.re):
* JSTests/microbenchmarks/regexp-lookbehind-quantified-group.js: Added.
* JSTests/stress/regexp-lookbehind-jit-quantified-groups-unicode.js: Added.
(shouldBe):
(stringify):
(stringifyIndices):
(shouldBe.stringify):
(a.z):
(shouldBe.stringify.y):
(c.u.exec):
(shouldBe.string_appeared_here.replace):
(shouldBe.stringifyIndices):
(shouldBe.stringifyIndices.y):
* JSTests/stress/regexp-lookbehind-jit-quantified-groups.js: Added.
(shouldBe):
(stringify):
(stringifyIndices):
(shouldBe.stringify):
(shouldBe.stringify.y):
(shouldBe.stringify.y.yb):
(shouldBe.stringify.x):
(b.exec):
(shouldBe.string_appeared_here.replace):
(shouldBe.stringifyIndices):
(shouldBe.stringifyIndices.y):
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
* Source/JavaScriptCore/yarr/YarrPattern.cpp:
(JSC::Yarr::YarrPatternConstructor::quantifyAtom):

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



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

Reply via email to