Changeset 76076 in webkit


Ignore:
Timestamp:
Jan 18, 2011 3:31:30 PM (13 years ago)
Author:
msaboff@apple.com
Message:

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 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:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r76074 r76076  
     12011-01-18  Michael Saboff  <msaboff@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        <rdar://problem/8875432> Regression: Some text-only e-mails cause hang beneath RegExp::match (52540)
     6        https://bugs.webkit.org/show_bug.cgi?id=52540
     7        https://bugs.webkit.org/show_bug.cgi?id=52662
     8
     9        New tests to check for proper linking of parentheses nested under
     10        a non-capturing parentheses.
     11
     12        * fast/regex/parentheses-expected.txt:
     13        * fast/regex/script-tests/parentheses.js:
     14
    1152011-01-18  David Hyatt  <hyatt@apple.com>
    216
  • trunk/LayoutTests/fast/regex/parentheses-expected.txt

    r75991 r76076  
    6868PASS regexp40.exec('zPPPz') is ['',undefined,undefined,undefined,'']
    6969PASS regexp40.exec('zPPPPz') is ['',undefined,undefined,undefined,'']
     70PASS 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]
     71PASS regexp42.exec('') is ['',undefined,undefined]
     72PASS regexp42.exec('4') is ['4','4','4']
     73PASS regexp42.exec('4321') is ['4','4','4']
    7074PASS /(?!(?=r{0}){2,})|((z)?)?/gi.test('') is true
    7175PASS 'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/) is ['Bob',undefined,'Bob',undefined,undefined]
  • trunk/LayoutTests/fast/regex/script-tests/parentheses.js

    r75991 r76076  
    184184shouldBe("regexp40.exec('zPPPPz')", "['',undefined,undefined,undefined,'']");
    185185
     186var regexp41 = /(([\w\-]+:\/\/?|www[.])[^\s()<>]+(?:([\w\d]+)|([^\[:punct:\]\s()<>\W]|\/)))/;
     187shouldBe("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]");
     188
     189var regexp42 = /((?:(4)?))?/;
     190shouldBe("regexp42.exec('')", "['',undefined,undefined]");
     191shouldBe("regexp42.exec('4')", "['4','4','4']");
     192shouldBe("regexp42.exec('4321')", "['4','4','4']");
     193
    186194shouldBeTrue("/(?!(?=r{0}){2,})|((z)?)?/gi.test('')");
    187195
  • trunk/Source/JavaScriptCore/ChangeLog

    r76068 r76076  
     12011-01-18  Michael Saboff  <msaboff@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        <rdar://problem/8875432> Regression: Some text-only e-mails cause hang beneath RegExp::match (52540)
     6        https://bugs.webkit.org/show_bug.cgi?id=52540
     7        https://bugs.webkit.org/show_bug.cgi?id=52662
     8
     9        Directly use backtrack label with parentheses nested under a
     10        non-capturing parentheses.  Also linked current parentheses
     11        tail code object for possible parens nested within a non-capturing
     12        parentheses.
     13
     14        * yarr/YarrJIT.cpp:
     15        (JSC::Yarr::YarrGenerator::BacktrackDestination::linkBacktrackToLabel):
     16        (JSC::Yarr::YarrGenerator::generateParenthesesSingle):
     17
    1182011-01-18  Daniel Bates  <dbates@rim.com>
    219
  • trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp

    r75991 r76076  
    749749        }
    750750
     751        void linkBacktrackToLabel(Label backtrackLabel)
     752        {
     753            if (m_backtrackToLabel)
     754                *m_backtrackToLabel = backtrackLabel;
     755        }
     756
    751757        void linkAlternativeBacktracks(YarrGenerator* generator, bool nextIteration = false)
    752758        {
     
    10081014        BacktrackDestination* m_linkedBacktrack;
    10091015        ParenthesesTail* m_parenthesesTail;
    1010 
    10111016    };
    10121017
     
    16391644
    16401645            TermGenerationState parenthesesState(disjunction, state.checkedTotal);
     1646           
     1647            // Use the current paren Tail to connect the nested parentheses.
     1648            parenthesesState.setParenthesesTail(state.getParenthesesTail());
     1649
    16411650            generateParenthesesDisjunction(state.term(), parenthesesState, alternativeFrameLocation);
    16421651            // this expects that any backtracks back out of the parentheses will be in the
     
    16441653            // they will have set an entry point on the parenthesesState's m_backtrackLabel.
    16451654            BacktrackDestination& parenthesesBacktrack = parenthesesState.getBacktrackDestination();
    1646             state.propagateBacktrackingFrom(this, parenthesesBacktrack);
    1647             state.getBacktrackDestination().copyBacktrackToLabel(parenthesesBacktrack);
     1655            BacktrackDestination& stateBacktrack = state.getBacktrackDestination();
     1656
     1657            // If we have a backtrack label, use it for the parenthesis
     1658            if (stateBacktrack.isLabel())
     1659                parenthesesBacktrack.linkBacktrackToLabel(stateBacktrack.getLabel());
     1660            else {
     1661                state.propagateBacktrackingFrom(this, parenthesesBacktrack);
     1662                stateBacktrack.copyBacktrackToLabel(parenthesesBacktrack);
     1663            }
    16481664
    16491665            m_expressionState.decrementParenNestingLevel();
Note: See TracChangeset for help on using the changeset viewer.