Reviewed by Oliver Hunt.
<rdar://problem/8875432> Regression: Some text-only e-mails cause hang beneath RegExp::match (52540)
https://bugs.webkit.org/show_bug.cgi?id=52540
https://bugs.webkit.org/show_bug.cgi?id=52662
Directly use backtrack label with parentheses nested under a
non-capturing parentheses. Also linked current parentheses
tail code object for possible parens nested within a non-capturing
parentheses.
* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::BacktrackDestination::linkBacktrackToLabel):
(JSC::Yarr::YarrGenerator::generateParenthesesSingle):
2011-01-18 Michael Saboff <msaboff@apple.com>
Reviewed by Oliver Hunt.
<rdar://problem/8875432> Regression: Some text-only e-mails cause hang beneath RegExp::match (52540)
https://bugs.webkit.org/show_bug.cgi?id=52540
https://bugs.webkit.org/show_bug.cgi?id=52662
New tests to check for proper linking of parentheses nested under
a non-capturing parentheses.
* fast/regex/parentheses-expected.txt:
* fast/regex/script-tests/parentheses.js:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76076
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-01-18 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/8875432> Regression: Some text-only e-mails cause hang beneath RegExp::match (52540)
+ https://bugs.webkit.org/show_bug.cgi?id=52540
+ https://bugs.webkit.org/show_bug.cgi?id=52662
+
+ New tests to check for proper linking of parentheses nested under
+ a non-capturing parentheses.
+
+ * fast/regex/parentheses-expected.txt:
+ * fast/regex/script-tests/parentheses.js:
+
2011-01-18 David Hyatt <hyatt@apple.com>
Reviewed by Dan Bernstein.
PASS regexp40.exec('zPPz') is ['',undefined,undefined,undefined,'']
PASS regexp40.exec('zPPPz') is ['',undefined,undefined,undefined,'']
PASS regexp40.exec('zPPPPz') is ['',undefined,undefined,undefined,'']
+PASS regexp41.exec('Here is a link: http://www.acme.com/our_products/index.html. That is all we want!') is ['http://www.acme.com/our_products/index.html','http://www.acme.com/our_products/index.html','http://','l',undefined]
+PASS regexp42.exec('') is ['',undefined,undefined]
+PASS regexp42.exec('4') is ['4','4','4']
+PASS regexp42.exec('4321') is ['4','4','4']
PASS /(?!(?=r{0}){2,})|((z)?)?/gi.test('') is true
PASS 'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/) is ['Bob',undefined,'Bob',undefined,undefined]
PASS successfullyParsed is true
shouldBe("regexp40.exec('zPPPz')", "['',undefined,undefined,undefined,'']");
shouldBe("regexp40.exec('zPPPPz')", "['',undefined,undefined,undefined,'']");
+var regexp41 = /(([\w\-]+:\/\/?|www[.])[^\s()<>]+(?:([\w\d]+)|([^\[:punct:\]\s()<>\W]|\/)))/;
+shouldBe("regexp41.exec('Here is a link: http://www.acme.com/our_products/index.html. That is all we want!')", "['http://www.acme.com/our_products/index.html','http://www.acme.com/our_products/index.html','http://','l',undefined]");
+
+var regexp42 = /((?:(4)?))?/;
+shouldBe("regexp42.exec('')", "['',undefined,undefined]");
+shouldBe("regexp42.exec('4')", "['4','4','4']");
+shouldBe("regexp42.exec('4321')", "['4','4','4']");
+
shouldBeTrue("/(?!(?=r{0}){2,})|((z)?)?/gi.test('')");
shouldBe("'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)", "['Bob',undefined,'Bob',undefined,undefined]");
+2011-01-18 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/8875432> Regression: Some text-only e-mails cause hang beneath RegExp::match (52540)
+ https://bugs.webkit.org/show_bug.cgi?id=52540
+ https://bugs.webkit.org/show_bug.cgi?id=52662
+
+ Directly use backtrack label with parentheses nested under a
+ non-capturing parentheses. Also linked current parentheses
+ tail code object for possible parens nested within a non-capturing
+ parentheses.
+
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::linkBacktrackToLabel):
+ (JSC::Yarr::YarrGenerator::generateParenthesesSingle):
+
2011-01-18 Daniel Bates <dbates@rim.com>
Reviewed by Gavin Barraclough.
return false;
}
+ void linkBacktrackToLabel(Label backtrackLabel)
+ {
+ if (m_backtrackToLabel)
+ *m_backtrackToLabel = backtrackLabel;
+ }
+
void linkAlternativeBacktracks(YarrGenerator* generator, bool nextIteration = false)
{
Label hereLabel = generator->label();
BacktrackDestination m_backtrack;
BacktrackDestination* m_linkedBacktrack;
ParenthesesTail* m_parenthesesTail;
-
};
struct ParenthesesTail {
m_expressionState.incrementParenNestingLevel();
TermGenerationState parenthesesState(disjunction, state.checkedTotal);
+
+ // Use the current paren Tail to connect the nested parentheses.
+ parenthesesState.setParenthesesTail(state.getParenthesesTail());
+
generateParenthesesDisjunction(state.term(), parenthesesState, alternativeFrameLocation);
// this expects that any backtracks back out of the parentheses will be in the
// parenthesesState's m_backTrackJumps vector, and that if they need backtracking
// they will have set an entry point on the parenthesesState's m_backtrackLabel.
BacktrackDestination& parenthesesBacktrack = parenthesesState.getBacktrackDestination();
- state.propagateBacktrackingFrom(this, parenthesesBacktrack);
- state.getBacktrackDestination().copyBacktrackToLabel(parenthesesBacktrack);
+ BacktrackDestination& stateBacktrack = state.getBacktrackDestination();
+
+ // If we have a backtrack label, use it for the parenthesis
+ if (stateBacktrack.isLabel())
+ parenthesesBacktrack.linkBacktrackToLabel(stateBacktrack.getLabel());
+ else {
+ state.propagateBacktrackingFrom(this, parenthesesBacktrack);
+ stateBacktrack.copyBacktrackToLabel(parenthesesBacktrack);
+ }
m_expressionState.decrementParenNestingLevel();
} else {