Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6204c47b8556717fab441b61e56c668e6a2655dc
      
https://github.com/WebKit/WebKit/commit/6204c47b8556717fab441b61e56c668e6a2655dc
  Author: Michael Saboff <[email protected]>
  Date:   2022-12-21 (Wed, 21 Dec 2022)

  Changed paths:
    A JSTests/stress/regexp-lookaround-captures.js
    M Source/JavaScriptCore/yarr/YarrInterpreter.cpp
    M Source/JavaScriptCore/yarr/YarrInterpreter.h
    M Source/JavaScriptCore/yarr/YarrJIT.cpp
    M Source/JavaScriptCore/yarr/YarrParser.h
    M Source/JavaScriptCore/yarr/YarrPattern.cpp
    M Source/JavaScriptCore/yarr/YarrPattern.h
    M Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp
    M Source/WebCore/contentextensions/URLFilterParser.cpp

  Log Message:
  -----------
  REGRESSION(257823@main): named-groups/lookbehind.js Test262-test is failing
https://bugs.webkit.org/show_bug.cgi?id=249330
rdar://103367993

Reviewed by Yusuke Suzuki.

Fixed the case where a nested capturing group within a lookahead / lookbehind 
doesn't get its capture cleared if
the lookaround fails.  This has been a long standing issue for lookaheads.

The fix is slightly different in the Yarr interpreter than in the Yarr JIT.  
For the interpreter, the Parenthetical
Assertion processing will clear the nested captures within the assertion for 
the case where an inverted assertion
succeeds or a normal assertion fails.  For the JIT, the clearing is done at the 
end of a failed top level alternative
for all the contained captures for that alternative.

* JSTests/stress/regexp-lookaround-captures.js: Added.
(arrayToString):
(dumpValue):
(compareArray):
(testRegExp):
(testRegExp.c):
* Source/JavaScriptCore/yarr/YarrInterpreter.cpp:
(JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::ParenthesesDisjunctionContext):
(JSC::Yarr::Interpreter::matchBackReference):
(JSC::Yarr::Interpreter::backtrackBackReference):
(JSC::Yarr::Interpreter::recordParenthesesMatch):
(JSC::Yarr::Interpreter::resetMatches):
(JSC::Yarr::Interpreter::matchParenthesesOnceBegin):
(JSC::Yarr::Interpreter::matchParenthesesOnceEnd):
(JSC::Yarr::Interpreter::backtrackParenthesesOnceBegin):
(JSC::Yarr::Interpreter::backtrackParenthesesOnceEnd):
(JSC::Yarr::Interpreter::matchParentheticalAssertionEnd):
(JSC::Yarr::Interpreter::backtrackParentheticalAssertionEnd):
(JSC::Yarr::Interpreter::matchDisjunction):
(JSC::Yarr::ByteCompiler::atomParentheticalAssertionEnd):
(JSC::Yarr::ByteCompiler::atomParenthesesSubpatternEnd):
(JSC::Yarr::ByteCompiler::atomParenthesesOnceEnd):
(JSC::Yarr::ByteCompiler::atomParenthesesTerminalEnd):
(JSC::Yarr::ByteCompiler::emitDisjunction):
(JSC::Yarr::ByteTermDumper::dumpTerm):
* Source/JavaScriptCore/yarr/YarrInterpreter.h:
(JSC::Yarr::ByteTerm::ByteTerm):
(JSC::Yarr::ByteTerm::containsAnyCaptures):
(JSC::Yarr::ByteTerm::subpatternId):
(JSC::Yarr::ByteTerm::lastSubpatternId):
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
* Source/JavaScriptCore/yarr/YarrParser.h:
(JSC::Yarr::Parser::parseTokens):
* Source/JavaScriptCore/yarr/YarrPattern.cpp:
(JSC::Yarr::YarrPatternConstructor::atomParenthesesSubpatternBegin):
(JSC::Yarr::YarrPatternConstructor::atomParentheticalAssertionBegin):
(JSC::Yarr::YarrPatternConstructor::copyDisjunction):
(JSC::Yarr::YarrPatternConstructor::disjunction):
* Source/JavaScriptCore/yarr/YarrPattern.h:
(JSC::Yarr::PatternTerm::containsAnyCaptures):
(JSC::Yarr::PatternAlternative::PatternAlternative):
(JSC::Yarr::PatternAlternative::cleanupCaptures const):
(JSC::Yarr::PatternDisjunction::addNewAlternative):
* Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp:
(JSC::Yarr::SyntaxChecker::disjunction):
* Source/WebCore/contentextensions/URLFilterParser.cpp:
(WebCore::ContentExtensions::PatternParser::disjunction):

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to