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

  Changed paths:
    A JSTests/microbenchmarks/regexp-lookbehind-backreference.js
    A JSTests/stress/regexp-lookbehind-jit-backreferences-unicode.js
    A JSTests/stress/regexp-lookbehind-jit-backreferences.js
    M Source/JavaScriptCore/yarr/YarrJIT.cpp

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

Reviewed by Daniel Liu.

A backreference inside a lookbehind sent the whole pattern to the interpreter.

Matched backward, a backreference succeeds when the captured text ends at the 
current position.
The comparison loop runs down instead of up: the capture cursor starts at the 
capture end, the
subject cursor at the current position, each step reads the unit before its 
cursor and
decrements both, and the loop stops at the capture start. The availability 
check becomes
index >= length. The case-insensitive comparisons, the duplicate named group 
lookup, the
unicode reads (readCharacter() already decodes backward) and the quantifier 
bookkeeping are
the forward code with the sign of the index moves flipped. Forward code 
generation is
unchanged.

                                                 Baseline                  
Patched

regexp-lookbehind-backreference             571.5494+-5.9829     ^     
52.8080+-0.6471        ^ definitely 10.8232x faster

Tests: JSTests/microbenchmarks/regexp-lookbehind-backreference.js
       JSTests/stress/regexp-lookbehind-jit-backreferences-unicode.js
       JSTests/stress/regexp-lookbehind-jit-backreferences.js

* JSTests/microbenchmarks/regexp-lookbehind-backreference.js: Added.
* JSTests/stress/regexp-lookbehind-jit-backreferences-unicode.js: Added.
(shouldBe):
(matchOf):
(indicesOf):
(matchAllOf):
* JSTests/stress/regexp-lookbehind-jit-backreferences.js: Added.
(shouldBe):
(matchOf):
(indicesOf):
(matchAllOf):
* Source/JavaScriptCore/yarr/YarrJIT.cpp:

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



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

Reply via email to