Changeset 73962 in webkit
- Timestamp:
- Dec 13, 2010 2:19:48 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r73903 r73962 1 2010-12-13 Michael Saboff <msaboff@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 REGRESSION: mobileme mail viewing is broken 6 https://bugs.webkit.org/show_bug.cgi?id=50884 7 8 Fixed problem where simple parenthesis (those without capture and 9 with a fixed count) where not propagating backtrack to labels for 10 nested parentheses. Also added the nesting level for the parentheses 11 state created in that case as well. 12 13 * yarr/RegexJIT.cpp: 14 (JSC::Yarr::RegexGenerator::BacktrackDestination::copyBacktrackToLabel): 15 (JSC::Yarr::RegexGenerator::TermGenerationState::isLastTerm): 16 (JSC::Yarr::RegexGenerator::ParenthesesTail::generateCode): 17 (JSC::Yarr::RegexGenerator::generateParenthesesSingle): 18 1 19 2010-12-13 Peter Varga <pvarga@inf.u-szeged.hu> 2 20 -
trunk/JavaScriptCore/yarr/RegexJIT.cpp
r73866 r73962 573 573 } 574 574 575 void copyBacktrackToLabel(BacktrackDestination& rhs) 576 { 577 if (rhs.m_backtrackToLabel) 578 m_backtrackToLabel = rhs.m_backtrackToLabel; 579 } 580 575 581 void setBacktrackToLabel(Label* backtrackToLabel) 576 582 { … … 820 826 ASSERT(alternativeValid()); 821 827 return (t + 1) == alternative()->m_terms.size(); 822 } 828 } 823 829 unsigned getSubParenNum() 824 830 { … … 829 835 return !disjunction->m_parent; 830 836 } 831 837 832 838 void setParenthesesTail(ParenthesesTail* parenthesesTail) 833 839 { … … 839 845 return m_parenthesesTail; 840 846 } 841 847 842 848 PatternTerm& lookaheadTerm() 843 849 { … … 1083 1089 fromPriorBacktrack.link(generator); 1084 1090 m_parenBacktrack.linkAlternativeBacktracks(generator); 1085 m_withinBacktrackJumps.link(generator); 1091 m_withinBacktrackJumps.link(generator); 1086 1092 1087 1093 if (m_term.capture()) … … 1603 1609 // optimized case - no capture & no quantifier can be handled in a light-weight manner. 1604 1610 if (!term.capture() && (term.quantityType == QuantifierFixedCount)) { 1611 m_expressionState.incrementParenNestingLevel(); 1612 1605 1613 TermGenerationState parenthesesState(disjunction, state.checkedTotal); 1606 1614 generateParenthesesDisjunction(state.term(), parenthesesState, alternativeFrameLocation); … … 1608 1616 // parenthesesState's m_backTrackJumps vector, and that if they need backtracking 1609 1617 // they will have set an entry point on the parenthesesState's m_backtrackLabel. 1610 state.propagateBacktrackingFrom(this, parenthesesState.getBacktrackDestination()); 1618 BacktrackDestination& parenthesesBacktrack = parenthesesState.getBacktrackDestination(); 1619 state.propagateBacktrackingFrom(this, parenthesesBacktrack); 1620 state.getBacktrackDestination().copyBacktrackToLabel(parenthesesBacktrack); 1621 1622 m_expressionState.decrementParenNestingLevel(); 1611 1623 } else { 1612 1624 Jump nonGreedySkipParentheses; … … 1637 1649 1638 1650 TermGenerationState parenthesesState(disjunction, state.checkedTotal); 1639 1651 1640 1652 // Save the parenthesesTail for backtracking from nested parens to this one. 1641 1653 parenthesesState.setParenthesesTail(parenthesesTail); -
trunk/LayoutTests/ChangeLog
r73961 r73962 1 2010-12-13 Michael Saboff <msaboff@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 REGRESSION: mobileme mail viewing is broken 6 https://bugs.webkit.org/show_bug.cgi?id=50884 7 8 Added a test to check parentheses nesting within parentheses that 9 don't capture and that are fixed count. There is special handling 10 for this case in the RegExp JIT code. 11 12 * fast/regex/parentheses-expected.txt: 13 * fast/regex/script-tests/parentheses.js: 14 1 15 2010-12-13 Chris Fleizach <cfleizach@apple.com> 2 16 -
trunk/LayoutTests/fast/regex/parentheses-expected.txt
r73866 r73962 38 38 PASS regexp31.exec('Committer:') is null 39 39 PASS regexp32.exec('Committer:') is null 40 PASS regexp33.exec('> <head>') is ['>',undefined,undefined,'>'] 40 41 PASS 'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/) is ['Bob',undefined,'Bob',undefined,undefined] 41 42 PASS successfullyParsed is true -
trunk/LayoutTests/fast/regex/script-tests/parentheses.js
r73866 r73962 138 138 shouldBeNull("regexp32.exec('Committer:')"); 139 139 140 var regexp33 = RegExp('^(?:(?:(a)(xyz|[^>"\'\s]*)?)|(/?>)|.[^\w\s>]*)'); 141 shouldBe("regexp33.exec('> <head>')","['>',undefined,undefined,'>']"); 142 140 143 shouldBe("'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)", "['Bob',undefined,'Bob',undefined,undefined]"); 141 144
Note: See TracChangeset
for help on using the changeset viewer.