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

  Changed paths:
    A JSTests/stress/regexp-fixed-count-nested-captures-reset.js
    M Source/JavaScriptCore/yarr/YarrJIT.cpp

  Log Message:
  -----------
  [YARR] Fix capture group reset in JIT-compiled fixed-count non-capturing 
parentheses
https://bugs.webkit.org/show_bug.cgi?id=306593

Reviewed by Yusuke Suzuki.

The recent optimization for non-capturing parentheses with fixed-count 
quantifiers
(bug 305284) introduced a regression where nested capture groups were not being
reset to undefined at the start of each iteration.

ECMAScript specification requires that capture groups within a quantified group
are reset to undefined at the beginning of each iteration. The existing
ParenthesesSubpatternBegin implementation handles this via saveParenContext()
which calls clearSubpatternStart() for each nested capture. However, the new
ParenthesesSubpatternFixedCountBegin was missing this logic.

This patch adds the capture group clearing code to 
ParenthesesSubpatternFixedCountBegin,
matching the behavior of the interpreter and the existing JIT implementation for
non-fixed-count quantifiers.

Test: JSTests/stress/regexp-fixed-count-nested-captures-reset.js

* JSTests/stress/regexp-fixed-count-nested-captures-reset.js: Added.
(shouldBe):
(testDuplicateNamedGroupsWithFixedCount):
(testCaptureResetInVariousPatterns):
(testNestedNonCapturingWithCaptures):
(testNonCapturingWithoutNestedCaptures):
* Source/JavaScriptCore/yarr/YarrJIT.cpp:

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



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

Reply via email to