Bug 200786

Summary: Add ability for the YARR JIT to properly handle nested expressions that can match without consuming characters
Product: WebKit Reporter: Michael Saboff <msaboff>
Component: JavaScriptCoreAssignee: Michael Saboff <msaboff>
Status: ASSIGNED    
Severity: Normal    
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Michael Saboff
Reported 2019-08-15 13:37:43 PDT
The YARR interpreter has a function for matching nested expressions that might not consume characters. This is needed when we try to match containing parenthesis which have variable counts, but their contents match an empty string. An example regex is /(a*)*x/. When we use this regex to match "aa", we'll match the "aa" via the parenthesis sub pattern and then fail trying to match the 'x'. Then we'll backtrack. The (a*)* subexpression will match a zero length string and try match the 'x'. We have now entered an infinite loop that only exits due to exceeding the loop try count. In the case where the parenthesis has a variable count, the interpreter will make sure that each time we try matching the parenthesis contents, we make sure we actually consumes characters. This is done in the interpreter with the function matchNonZeroDisjunction(). The JIT should emit the same kind of logic.
Attachments
Note You need to log in before you can comment on or make changes to this bug.