Log Message
REGRESSION (r200946): Improper backtracking from last alternative in sticky patterns https://bugs.webkit.org/show_bug.cgi?id=159233
Reviewed by Mark Lam. Source/_javascript_Core: Jump to fail exit code when the last alternative of a sticky pattern fails. * yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::backtrack): LayoutTests: Updated tests. * js/regexp-sticky-expected.txt: * js/script-tests/regexp-sticky.js:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (202596 => 202597)
--- trunk/LayoutTests/ChangeLog 2016-06-29 00:18:34 UTC (rev 202596)
+++ trunk/LayoutTests/ChangeLog 2016-06-29 00:38:58 UTC (rev 202597)
@@ -1,3 +1,15 @@
+2016-06-28 Michael Saboff <[email protected]>
+
+ REGRESSION (r200946): Improper backtracking from last alternative in sticky patterns
+ https://bugs.webkit.org/show_bug.cgi?id=159233
+
+ Reviewed by Mark Lam.
+
+ Updated tests.
+
+ * js/regexp-sticky-expected.txt:
+ * js/script-tests/regexp-sticky.js:
+
2016-06-28 Ryan Haddad <[email protected]>
Marking fast/images/composited-animated-gif-outside-viewport.html as flaky on ios-simulator
Modified: trunk/LayoutTests/js/regexp-sticky-expected.txt (202596 => 202597)
--- trunk/LayoutTests/js/regexp-sticky-expected.txt 2016-06-29 00:18:34 UTC (rev 202596)
+++ trunk/LayoutTests/js/regexp-sticky-expected.txt 2016-06-29 00:38:58 UTC (rev 202597)
@@ -26,10 +26,12 @@
PASS Unmatched Greedy
PASS Global Flag - exec
PASS Global Flag - match
+PASS Global Flag - Alternates, long to short
PASS Unicode Flag - Any Character
PASS Unicode & Ignore Case Flags
PASS Multiline
PASS Multiline with BOL Anchor
+PASS Multiline with EOL Anchor at start of Alternative
PASS "123 1234 ".search(re) is 0
PASS "123 1234 ".search(re) is 0
PASS " 123 1234 ".search(re) is -1
Modified: trunk/LayoutTests/js/script-tests/regexp-sticky.js (202596 => 202597)
--- trunk/LayoutTests/js/script-tests/regexp-sticky.js 2016-06-29 00:18:34 UTC (rev 202596)
+++ trunk/LayoutTests/js/script-tests/regexp-sticky.js 2016-06-29 00:38:58 UTC (rev 202597)
@@ -92,10 +92,12 @@
testStickyExec("Unmatched Greedy", /^\s*|\s*$/y, "ab", 1, [null]);
testStickyExec("Global Flag - exec", /\s*(\+|[0-9]+)\s*/gy, "3 + 4", 0, ["3 ,3", "+ ,+", "4,4", null]);
testStickyMatch("Global Flag - match", /\s*(\+|[0-9]+)\s*/gy, "3 + 4", 0, [["3 ", "+ ", "4"], ["3 ", "+ ", "4"]]);
+testStickyMatch("Global Flag - Alternates, long to short", /x.|[\d]/gy, ".a", 0, [null]);
testStickyExec("Unicode Flag - Any Character", /./uy, "a@\u{10402}1\u202a\u{12345}", 0, ["a", "@", "\u{10402}", "1", "\u202a", "\u{12345}", null]);
testStickyMatch("Unicode & Ignore Case Flags", /(?:\u{118c0}|\u{10cb0}|\w):/iuy, "a:\u{118a0}:x:\u{10cb0}", 0, [["a:"], ["\u{118a0}:"], ["x:"], null]);
testStickyExec("Multiline", /(?:\w+ *)+(?:\n|$)/my, "Line One\nLine Two", 0, ["Line One\n", "Line Two", null]);
testStickyMatch("Multiline with BOL Anchor", /^\d*\s?/my, "13574\n295\n99", 0, [["13574\n"], ["295\n"], ["99"], null]);
+testStickyExec("Multiline with EOL Anchor at start of Alternative", /.{2}|(?=$)./my, "\n", 0, [null]);
// Verify that String.search starts at 0 even with the sticky flag.
var re = new RegExp("\\d+\\s", "y");
Modified: trunk/Source/_javascript_Core/ChangeLog (202596 => 202597)
--- trunk/Source/_javascript_Core/ChangeLog 2016-06-29 00:18:34 UTC (rev 202596)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-06-29 00:38:58 UTC (rev 202597)
@@ -1,3 +1,15 @@
+2016-06-28 Michael Saboff <[email protected]>
+
+ REGRESSION (r200946): Improper backtracking from last alternative in sticky patterns
+ https://bugs.webkit.org/show_bug.cgi?id=159233
+
+ Reviewed by Mark Lam.
+
+ Jump to fail exit code when the last alternative of a sticky pattern fails.
+
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::backtrack):
+
2016-06-28 Saam Barati <[email protected]>
some Watchpoints' ::fireInternal method will call operations that might GC where the GC will cause the watchpoint itself to destruct
Modified: trunk/Source/_javascript_Core/yarr/YarrJIT.cpp (202596 => 202597)
--- trunk/Source/_javascript_Core/yarr/YarrJIT.cpp 2016-06-29 00:18:34 UTC (rev 202596)
+++ trunk/Source/_javascript_Core/yarr/YarrJIT.cpp 2016-06-29 00:38:58 UTC (rev 202597)
@@ -1828,6 +1828,8 @@
}
bool _onceThrough_ = endOp.m_nextOp == notFound;
+
+ JumpList lastStickyAlternativeFailures;
// First, generate code to handle cases where we backtrack out of an attempted match
// of the last alternative. If this is a 'once through' set of alternatives then we
@@ -1843,12 +1845,15 @@
&& (alternative->m_minimumSize > beginOp->m_alternative->m_minimumSize)
&& (alternative->m_minimumSize - beginOp->m_alternative->m_minimumSize == 1))
m_backtrackingState.linkTo(beginOp->m_reentry, this);
- else {
+ else if (m_pattern.sticky() && m_ops[op.m_nextOp].m_op == OpBodyAlternativeEnd) {
+ // It is a sticky pattern and the last alternative failed, jump to the end.
+ m_backtrackingState.takeBacktracksToJumpList(lastStickyAlternativeFailures, this);
+ } else {
// We need to generate a trampoline of code to execute before looping back
// around to the first alternative.
m_backtrackingState.link(this);
- // No need to advance and retry for a stick pattern.
+ // No need to advance and retry for a sticky pattern.
if (!m_pattern.sticky()) {
// If the pattern size is not fixed, then store the start index for use if we match.
if (!m_pattern.m_body->m_hasFixedSize) {
@@ -1998,6 +2003,8 @@
// run any matches, and need to return a failure state from JIT code.
matchFailed.link(this);
}
+
+ lastStickyAlternativeFailures.link(this);
removeCallFrame();
generateFailReturn();
break;
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
