[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

msaboff at apple.com msaboff at apple.com
Wed Dec 22 13:40:18 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a5b5b1813e369033ff9bbf12a471166ad6f8a152
Author: msaboff at apple.com <msaboff at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 23 00:06:19 2010 +0000

    2010-09-22  Michael Saboff  <msaboff at apple.com>
    
            Reviewed by Gavin Barraclough.
    
            Fixed the cross over from alternatives executed once and
            those that loop.  This fixed the problem where the index
            was getting messed up for looping alternatives causing an
            infinite loop.
            https://bugs.webkit.org/show_bug.cgi?id=46189
    
            * yarr/RegexJIT.cpp:
            (JSC::Yarr::RegexGenerator::generateDisjunction):
    2010-09-22  Michael Saboff  <msaboff at apple.com>
    
            Reviewed by Gavin Barraclough.
    
            Updated tests to include patterns similar to what caused the problems
            in https://bugs.webkit.org/show_bug.cgi?id=46189.
    
            * fast/js/regexp-bol-expected.txt:
            * fast/js/script-tests/regexp-bol.js:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68100 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index d36b416..3e4523a 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-09-22  Michael Saboff  <msaboff at apple.com>
+
+        Reviewed by Gavin Barraclough.
+
+        Fixed the cross over from alternatives executed once and
+        those that loop.  This fixed the problem where the index
+        was getting messed up for looping alternatives causing an
+        infinite loop.
+        https://bugs.webkit.org/show_bug.cgi?id=46189
+
+        * yarr/RegexJIT.cpp:
+        (JSC::Yarr::RegexGenerator::generateDisjunction):
+
 2010-09-22  Steve Falkenburg  <sfalken at apple.com>
 
         Rubber stamped by Jon Honeycutt.
diff --git a/JavaScriptCore/yarr/RegexJIT.cpp b/JavaScriptCore/yarr/RegexJIT.cpp
index 8740130..0ca6281 100644
--- a/JavaScriptCore/yarr/RegexJIT.cpp
+++ b/JavaScriptCore/yarr/RegexJIT.cpp
@@ -1271,64 +1271,75 @@ class RegexGenerator : private MacroAssembler {
             // if there are any more alternatives, plant the check for input before looping.
             if (state.alternativeValid()) {
                 PatternAlternative* nextAlternative = state.alternative();
-                bool setAlternativeLoopLabel = false;
                 if (!setRepeatAlternativeLabels && !nextAlternative->onceThrough()) {
                     // We have handled non-repeating alternatives, jump to next iteration 
                     // and loop over repeating alternatives.
                     state.jumpToBacktrack(jump(), this);
-
-                    firstAlternative = Label(this);
-                    setRepeatAlternativeLabels = true;
-                    setAlternativeLoopLabel = true;
-                }
-                
-                int countToCheckForNextAlternative = nextAlternative->m_minimumSize;
-
-                if (countCheckedForCurrentAlternative > countToCheckForNextAlternative) { // CASE 1: current alternative was longer than the next one.
-                    // If we get here, there the last input checked failed.
-                    notEnoughInputForPreviousAlternative.link(this);
-
-                    // Check if sufficent input available to run the next alternative 
-                    notEnoughInputForPreviousAlternative.append(jumpIfNoAvailableInput(countToCheckForNextAlternative - countCheckedForCurrentAlternative));
-                    // We are now in the correct state to enter the next alternative; this add is only required
-                    // to mirror and revert operation of the sub32, just below.
-                    add32(Imm32(countCheckedForCurrentAlternative - countToCheckForNextAlternative), index);
-
-                    // If we get here, there the last input checked passed.
-                    state.linkAlternativeBacktracks(this);
-                    // No need to check if we can run the next alternative, since it is shorter -
-                    // just update index.
-                    sub32(Imm32(countCheckedForCurrentAlternative - countToCheckForNextAlternative), index);
-                } else if (countCheckedForCurrentAlternative < countToCheckForNextAlternative) { // CASE 2: next alternative is longer than the current one.
+                    
+                    countToCheckForFirstAlternative = nextAlternative->m_minimumSize;
+                    
                     // If we get here, there the last input checked failed.
-                    // If there is insufficient input to run the current alternative, and the next alternative is longer,
-                    // then there is definitely not enough input to run it - don't even check. Just adjust index, as if
-                    // we had checked.
                     notEnoughInputForPreviousAlternative.link(this);
-                    add32(Imm32(countToCheckForNextAlternative - countCheckedForCurrentAlternative), index);
-                    notEnoughInputForPreviousAlternative.append(jump());
-
-                    // The next alternative is longer than the current one; check the difference.
-                    state.linkAlternativeBacktracks(this);
-                    notEnoughInputForPreviousAlternative.append(jumpIfNoAvailableInput(countToCheckForNextAlternative - countCheckedForCurrentAlternative));
-                } else { // CASE 3: Both alternatives are the same length.
-                    ASSERT(countCheckedForCurrentAlternative == countToCheckForNextAlternative);
-
-                    // If the next alterative is the same length as this one, then no need to check the input -
-                    // if there was sufficent input to run the current alternative then there is sufficient
-                    // input to run the next one; if not, there isn't.
+                    
                     state.linkAlternativeBacktracks(this);
-                }
 
-                if (setAlternativeLoopLabel) {
+                    // Back up to start the looping alternatives.
+                    if (countCheckedForCurrentAlternative)
+                        sub32(Imm32(countCheckedForCurrentAlternative), index);
+                    
+                    firstAlternative = Label(this);
+                    
+                    state.checkedTotal = countToCheckForFirstAlternative;
+                    if (countToCheckForFirstAlternative)
+                        notEnoughInputForPreviousAlternative.append(jumpIfNoAvailableInput(countToCheckForFirstAlternative));
+                    
+                    countCheckedForCurrentAlternative = countToCheckForFirstAlternative;
+                    
                     firstAlternativeInputChecked = Label(this);
-                    countToCheckForFirstAlternative = countToCheckForNextAlternative;
-                    setAlternativeLoopLabel = true;
+
+                    setRepeatAlternativeLabels = true;
+                } else {
+                    int countToCheckForNextAlternative = nextAlternative->m_minimumSize;
+                    
+                    if (countCheckedForCurrentAlternative > countToCheckForNextAlternative) { // CASE 1: current alternative was longer than the next one.
+                        // If we get here, then the last input checked failed.
+                        notEnoughInputForPreviousAlternative.link(this);
+                        
+                        // Check if sufficent input available to run the next alternative 
+                        notEnoughInputForPreviousAlternative.append(jumpIfNoAvailableInput(countToCheckForNextAlternative - countCheckedForCurrentAlternative));
+                        // We are now in the correct state to enter the next alternative; this add is only required
+                        // to mirror and revert operation of the sub32, just below.
+                        add32(Imm32(countCheckedForCurrentAlternative - countToCheckForNextAlternative), index);
+                        
+                        // If we get here, then the last input checked passed.
+                        state.linkAlternativeBacktracks(this);
+                        // No need to check if we can run the next alternative, since it is shorter -
+                        // just update index.
+                        sub32(Imm32(countCheckedForCurrentAlternative - countToCheckForNextAlternative), index);
+                    } else if (countCheckedForCurrentAlternative < countToCheckForNextAlternative) { // CASE 2: next alternative is longer than the current one.
+                        // If we get here, then the last input checked failed.
+                        // If there is insufficient input to run the current alternative, and the next alternative is longer,
+                        // then there is definitely not enough input to run it - don't even check. Just adjust index, as if
+                        // we had checked.
+                        notEnoughInputForPreviousAlternative.link(this);
+                        add32(Imm32(countToCheckForNextAlternative - countCheckedForCurrentAlternative), index);
+                        notEnoughInputForPreviousAlternative.append(jump());
+                        
+                        // The next alternative is longer than the current one; check the difference.
+                        state.linkAlternativeBacktracks(this);
+                        notEnoughInputForPreviousAlternative.append(jumpIfNoAvailableInput(countToCheckForNextAlternative - countCheckedForCurrentAlternative));
+                    } else { // CASE 3: Both alternatives are the same length.
+                        ASSERT(countCheckedForCurrentAlternative == countToCheckForNextAlternative);
+                        
+                        // If the next alterative is the same length as this one, then no need to check the input -
+                        // if there was sufficent input to run the current alternative then there is sufficient
+                        // input to run the next one; if not, there isn't.
+                        state.linkAlternativeBacktracks(this);
+                    }
+                    state.checkedTotal -= countCheckedForCurrentAlternative;
+                    countCheckedForCurrentAlternative = countToCheckForNextAlternative;
+                    state.checkedTotal += countCheckedForCurrentAlternative;
                 }
-                
-                state.checkedTotal -= countCheckedForCurrentAlternative;
-                countCheckedForCurrentAlternative = countToCheckForNextAlternative;
-                state.checkedTotal += countCheckedForCurrentAlternative;
             }
         }
         
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 382348a..ef9ad59 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-09-22  Michael Saboff  <msaboff at apple.com>
+
+        Reviewed by Gavin Barraclough.
+
+        Updated tests to include patterns similar to what caused the problems
+        in https://bugs.webkit.org/show_bug.cgi?id=46189.
+
+        * fast/js/regexp-bol-expected.txt:
+        * fast/js/script-tests/regexp-bol.js:
+
 2010-09-22  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Adam Barth.
diff --git a/LayoutTests/fast/js/regexp-bol-expected.txt b/LayoutTests/fast/js/regexp-bol-expected.txt
index 33fa68e..cbd5de7 100644
--- a/LayoutTests/fast/js/regexp-bol-expected.txt
+++ b/LayoutTests/fast/js/regexp-bol-expected.txt
@@ -11,6 +11,19 @@ PASS s.match(/(^abc|c)123/) is ["abc123","abc"]
 PASS s.match(/(c|^abc)123/) is ["abc123","abc"]
 PASS s.match(/(^ab|abc)123/) is ["abc123","abc"]
 PASS s.match(/(bc|^abc)([0-9]*)a/) is ["bc789a","bc","789"]
+PASS /(?:(Y)X)|(X)/.exec("abc") is null
+PASS /(?:(?:^|Y)X)|(X)/.exec("abc") is null
+PASS /(?:(?:^|Y)X)|(X)/.exec("abcd") is null
+PASS /(?:(?:^|Y)X)|(X)/.exec("Xabcd") is ["X",undefined]
+PASS /(?:(?:^|Y)X)|(X)/.exec("aXbcd") is ["X","X"]
+PASS /(?:(?:^|Y)X)|(X)/.exec("abXcd") is ["X","X"]
+PASS /(?:(?:^|Y)X)|(X)/.exec("abcXd") is ["X","X"]
+PASS /(?:(?:^|Y)X)|(X)/.exec("abcdX") is ["X","X"]
+PASS /(?:(?:^|Y)X)|(X)/.exec("YXabcd") is ["YX",undefined]
+PASS /(?:(?:^|Y)X)|(X)/.exec("aYXbcd") is ["YX",undefined]
+PASS /(?:(?:^|Y)X)|(X)/.exec("abYXcd") is ["YX",undefined]
+PASS /(?:(?:^|Y)X)|(X)/.exec("abcYXd") is ["YX",undefined]
+PASS /(?:(?:^|Y)X)|(X)/.exec("abcdYX") is ["YX",undefined]
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/fast/js/script-tests/regexp-bol.js b/LayoutTests/fast/js/script-tests/regexp-bol.js
index 29762b7..f81cb88 100644
--- a/LayoutTests/fast/js/script-tests/regexp-bol.js
+++ b/LayoutTests/fast/js/script-tests/regexp-bol.js
@@ -11,5 +11,18 @@ shouldBe('s.match(/(^abc|c)123/)', '["abc123","abc"]');
 shouldBe('s.match(/(c|^abc)123/)', '["abc123","abc"]');
 shouldBe('s.match(/(^ab|abc)123/)', '["abc123","abc"]');
 shouldBe('s.match(/(bc|^abc)([0-9]*)a/)', '["bc789a","bc","789"]');
+shouldBeNull('/(?:(Y)X)|(X)/.exec("abc")');
+shouldBeNull('/(?:(?:^|Y)X)|(X)/.exec("abc")');
+shouldBeNull('/(?:(?:^|Y)X)|(X)/.exec("abcd")');
+shouldBe('/(?:(?:^|Y)X)|(X)/.exec("Xabcd")', '["X",undefined]');
+shouldBe('/(?:(?:^|Y)X)|(X)/.exec("aXbcd")', '["X","X"]');
+shouldBe('/(?:(?:^|Y)X)|(X)/.exec("abXcd")', '["X","X"]');
+shouldBe('/(?:(?:^|Y)X)|(X)/.exec("abcXd")', '["X","X"]');
+shouldBe('/(?:(?:^|Y)X)|(X)/.exec("abcdX")', '["X","X"]');
+shouldBe('/(?:(?:^|Y)X)|(X)/.exec("YXabcd")', '["YX",undefined]');
+shouldBe('/(?:(?:^|Y)X)|(X)/.exec("aYXbcd")', '["YX",undefined]');
+shouldBe('/(?:(?:^|Y)X)|(X)/.exec("abYXcd")', '["YX",undefined]');
+shouldBe('/(?:(?:^|Y)X)|(X)/.exec("abcYXd")', '["YX",undefined]');
+shouldBe('/(?:(?:^|Y)X)|(X)/.exec("abcdYX")', '["YX",undefined]');
 
 var successfullyParsed = true;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list