DescriptionRegexp: Optimize better in presence of lookaround.
Previously the Boyer-Moore-Horspool optimization gave up in the presence of a
submatch. A submatch is where we record the current position so that we can go
back to it, which is an essential part of the semantics of lookarounds
(lookaheads and lookbehinds). This has been the case since
Boyer-Moore-Horspool was implemented, but it was overly cautious.
* For positive lookahead it is OK to use the patterns inside the lookahead to
guide the BMS optimization.
* For positive lookbehind we harmlessly fail to optimize when the patterns
inside the lookbehind go backwards because TextNode::EatsAtLeast returns 0.
* For negative lookarounds, the NegativeLookaroundChoiceNode::FillInBMInfo method
(in jsregexp.h) knows to only look at the following pattern.
This is in response to disappointing lookbehind performance in Atom.
See https://github.com/atom/find-and-replace/issues/571
R=yangguo@chromium.org
BUG=
Review-Url: https://codereview.chromium.org/2777583003
Cr-Commit-Position: refs/heads/master@{#44139}
Committed: https://chromium.googlesource.com/v8/v8/+/8df7c2a21b07174c3704894ca1d149b2711dfa58
Patch Set 1 #
Messages
Total messages: 7 (3 generated)
|