Bug 200786 - Add ability for the YARR JIT to properly handle nested expressions that can match without consuming characters
Summary: Add ability for the YARR JIT to properly handle nested expressions that can m...
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Michael Saboff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-15 13:37 PDT by Michael Saboff
Modified: 2019-08-15 13:40 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Saboff 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.