Changeset 76133 in webkit


Ignore:
Timestamp:
Jan 19, 2011 9:58:15 AM (13 years ago)
Author:
msaboff@apple.com
Message:

2011-01-19 Michael Saboff <msaboff@apple.com>

Reviewed by Darin Adler.

<rdar://problem/8882994> Regression: Simple nested backtrack hangs
https://bugs.webkit.org/show_bug.cgi?id=52675

The changeset (r76076) for https://bugs.webkit.org/show_bug.cgi?id=52540
broke simple backtracking in some cases. Reworked that change to
link both jumps and labels.

  • yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::BacktrackDestination::hasBacktrackToLabel): (JSC::Yarr::YarrGenerator::TermGenerationState::propagateBacktrackingFrom): (JSC::Yarr::YarrGenerator::generateParenthesesSingle):

2011-01-19 Michael Saboff <msaboff@apple.com>

Reviewed by Darin Adler.

<rdar://problem/8882994> Regression: Simple nested backtrack hangs
https://bugs.webkit.org/show_bug.cgi?id=52675

New tests to support change.

  • fast/regex/parentheses-expected.txt:
  • fast/regex/script-tests/parentheses.js:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r76131 r76133  
     12011-01-19  Michael Saboff  <msaboff@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        <rdar://problem/8882994> Regression: Simple nested backtrack hangs
     6        https://bugs.webkit.org/show_bug.cgi?id=52675
     7
     8        New tests to support change.
     9
     10        * fast/regex/parentheses-expected.txt:
     11        * fast/regex/script-tests/parentheses.js:
     12
    1132011-01-19  Csaba Osztrogonác  <ossy@webkit.org>
    214
  • trunk/LayoutTests/fast/regex/parentheses-expected.txt

    r76076 r76133  
    7373PASS regexp42.exec('4321') is ['4','4','4']
    7474PASS /(?!(?=r{0}){2,})|((z)?)?/gi.test('') is true
     75PASS regexp43.exec('SSS') is ['']
     76PASS regexp44.exec('SSS') is ['',undefined]
    7577PASS 'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/) is ['Bob',undefined,'Bob',undefined,undefined]
    7678PASS successfullyParsed is true
  • trunk/LayoutTests/fast/regex/script-tests/parentheses.js

    r76076 r76133  
    194194shouldBeTrue("/(?!(?=r{0}){2,})|((z)?)?/gi.test('')");
    195195
     196var regexp43 = /(?!(?:\1+s))/;
     197shouldBe("regexp43.exec('SSS')", "['']");
     198
     199var regexp44 = /(?!(?:\3+(s+?)))/gy;
     200shouldBe("regexp44.exec('SSS')", "['',undefined]");
     201
    196202shouldBe("'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)", "['Bob',undefined,'Bob',undefined,undefined]");
    197203
  • trunk/Source/JavaScriptCore/ChangeLog

    r76129 r76133  
     12011-01-19  Michael Saboff  <msaboff@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        <rdar://problem/8882994> Regression: Simple nested backtrack hangs
     6        https://bugs.webkit.org/show_bug.cgi?id=52675
     7
     8        The changeset (r76076) for https://bugs.webkit.org/show_bug.cgi?id=52540
     9        broke simple backtracking in some cases.  Reworked that change to
     10        link both jumps and labels.
     11
     12        * yarr/YarrJIT.cpp:
     13        (JSC::Yarr::YarrGenerator::BacktrackDestination::hasBacktrackToLabel):
     14        (JSC::Yarr::YarrGenerator::TermGenerationState::propagateBacktrackingFrom):
     15        (JSC::Yarr::YarrGenerator::generateParenthesesSingle):
     16
    1172011-01-19  Pavel Podivilov  <podivilov@chromium.org>
    218
  • trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp

    r76076 r76133  
    619619        }
    620620
     621        bool hasBacktrackToLabel()
     622        {
     623            return m_backtrackToLabel;
     624        }
     625
    621626        void setBacktrackJumpList(JumpList* jumpList)
    622627        {
     
    9971002            if (doJump)
    9981003                m_backtrack.jumpToBacktrack(generator, backtrack.getBacktrackJumps());
     1004
     1005            if (m_backtrack.isLabel() && backtrack.hasBacktrackToLabel())
     1006                backtrack.linkBacktrackToLabel(m_backtrack.getLabel());
     1007
    9991008            if (backtrack.hasDestination()) {
    10001009                if (m_backtrack.hasDataLabel())
     
    16551664            BacktrackDestination& stateBacktrack = state.getBacktrackDestination();
    16561665
    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             }
     1666            state.propagateBacktrackingFrom(this, parenthesesBacktrack);
     1667            stateBacktrack.copyBacktrackToLabel(parenthesesBacktrack);
    16641668
    16651669            m_expressionState.decrementParenNestingLevel();
Note: See TracChangeset for help on using the changeset viewer.