Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cbde560aa655d9f1759f23336aa506ccaaef8ee2
      
https://github.com/WebKit/WebKit/commit/cbde560aa655d9f1759f23336aa506ccaaef8ee2
  Author: Michael Saboff <[email protected]>
  Date:   2023-01-04 (Wed, 04 Jan 2023)

  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 Mark Lam.

Relanding 258310@main with a fix for the issue found in 
https://bugs.webkit.org/show_bug.cgi?id=249855.
That issue was that we were hitting an ASSERT in clearSubpatternStart() where 
the subpatternId passed in was 0,
which is the whole match start index and not a subpattern.  The fix is to make 
sure that we always start with
a subpatternId of no less than 1.  This is handled in the new method 
PatternAlternative::firstCleanupSubpatternId().

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.

Updated the test accordingly.

* 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::needToCleanupCaptures const):
(JSC::Yarr::PatternAlternative::firstCleanupSubpatternId):
(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/258441@main


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

Reply via email to