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

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 13:40:54 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b30daac12cdbfe7365af8496f3df48fd2ecd89cb
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 23 08:40:10 2010 +0000

    2010-09-23  Peter Varga  <pvarga at inf.u-szeged.hu>
    
            Reviewed by Gavin Barraclough.
    
            Reduce the number of BOL checks in YARR Interpreter
            https://bugs.webkit.org/show_bug.cgi?id=46260
    
            Extend the YARR Interpreter with an optimization which reduces the number of
            BOL assertion checks. If a "TypeBodyAlternative" byteTerm is followed by a
            "TypeAssertionBOL" byteTerm it will be checked just one time.
    
            * yarr/RegexInterpreter.cpp:
            (JSC::Yarr::Interpreter::matchDisjunction):
            (JSC::Yarr::ByteCompiler::compile):
            (JSC::Yarr::ByteCompiler::regexBegin):
            (JSC::Yarr::ByteCompiler::alternativeBodyDisjunction):
            (JSC::Yarr::ByteCompiler::emitDisjunction):
            * yarr/RegexInterpreter.h:
            (JSC::Yarr::ByteTerm::BodyAlternativeBegin):
            (JSC::Yarr::ByteTerm::BodyAlternativeDisjunction):
            (JSC::Yarr::ByteTerm::BodyAlternativeEnd):
            (JSC::Yarr::ByteTerm::AlternativeBegin):
            (JSC::Yarr::ByteTerm::AlternativeDisjunction):
            (JSC::Yarr::ByteTerm::AlternativeEnd):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68127 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 3e4523a..5c4acaf 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-09-23  Peter Varga  <pvarga at inf.u-szeged.hu>
+
+        Reviewed by Gavin Barraclough.
+
+        Reduce the number of BOL checks in YARR Interpreter
+        https://bugs.webkit.org/show_bug.cgi?id=46260
+
+        Extend the YARR Interpreter with an optimization which reduces the number of
+        BOL assertion checks. If a "TypeBodyAlternative" byteTerm is followed by a
+        "TypeAssertionBOL" byteTerm it will be checked just one time.
+
+        * yarr/RegexInterpreter.cpp:
+        (JSC::Yarr::Interpreter::matchDisjunction):
+        (JSC::Yarr::ByteCompiler::compile):
+        (JSC::Yarr::ByteCompiler::regexBegin):
+        (JSC::Yarr::ByteCompiler::alternativeBodyDisjunction):
+        (JSC::Yarr::ByteCompiler::emitDisjunction):
+        * yarr/RegexInterpreter.h:
+        (JSC::Yarr::ByteTerm::BodyAlternativeBegin):
+        (JSC::Yarr::ByteTerm::BodyAlternativeDisjunction):
+        (JSC::Yarr::ByteTerm::BodyAlternativeEnd):
+        (JSC::Yarr::ByteTerm::AlternativeBegin):
+        (JSC::Yarr::ByteTerm::AlternativeDisjunction):
+        (JSC::Yarr::ByteTerm::AlternativeEnd):
+
 2010-09-22  Michael Saboff  <msaboff at apple.com>
 
         Reviewed by Gavin Barraclough.
diff --git a/JavaScriptCore/yarr/RegexInterpreter.cpp b/JavaScriptCore/yarr/RegexInterpreter.cpp
index d50c6c8..17ffd8f 100644
--- a/JavaScriptCore/yarr/RegexInterpreter.cpp
+++ b/JavaScriptCore/yarr/RegexInterpreter.cpp
@@ -1106,6 +1106,10 @@ public:
 
             input.next();
             context->matchBegin = input.getPos();
+
+            if (currentTerm().alternative.onceThrough)
+                context->term += currentTerm().alternative.next;
+
             MATCH_NEXT();
         }
         case ByteTerm::TypeBodyAlternativeEnd:
@@ -1257,7 +1261,7 @@ public:
 
     PassOwnPtr<BytecodePattern> compile(BumpPointerAllocator* allocator)
     {
-        regexBegin(m_pattern.m_numSubpatterns, m_pattern.m_body->m_callFrameSize);
+        regexBegin(m_pattern.m_numSubpatterns, m_pattern.m_body->m_callFrameSize, m_pattern.m_body->m_alternatives[0]->onceThrough());
         emitDisjunction(m_pattern.m_body);
         regexEnd();
 
@@ -1462,10 +1466,10 @@ public:
         }
     }
 
-    void regexBegin(unsigned numSubpatterns, unsigned callFrameSize)
+    void regexBegin(unsigned numSubpatterns, unsigned callFrameSize, bool onceThrough)
     {
         m_bodyDisjunction = adoptPtr(new ByteDisjunction(numSubpatterns, callFrameSize));
-        m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin());
+        m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin(onceThrough));
         m_bodyDisjunction->terms[0].frameLocation = 0;
         m_currentAlternativeIndex = 0;
     }
@@ -1475,11 +1479,11 @@ public:
         closeBodyAlternative();
     }
 
-    void alternativeBodyDisjunction()
+    void alternativeBodyDisjunction(bool onceThrough)
     {
         int newAlternativeIndex = m_bodyDisjunction->terms.size();
         m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex;
-        m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeDisjunction());
+        m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeDisjunction(onceThrough));
 
         m_currentAlternativeIndex = newAlternativeIndex;
     }
@@ -1498,14 +1502,15 @@ public:
         for (unsigned alt = 0; alt < disjunction->m_alternatives.size(); ++alt) {
             unsigned currentCountAlreadyChecked = inputCountAlreadyChecked;
 
+            PatternAlternative* alternative = disjunction->m_alternatives[alt];
+
             if (alt) {
                 if (disjunction == m_pattern.m_body)
-                    alternativeBodyDisjunction();
+                    alternativeBodyDisjunction(alternative->onceThrough());
                 else
                     alternativeDisjunction();
             }
 
-            PatternAlternative* alternative = disjunction->m_alternatives[alt];
             unsigned minimumSize = alternative->m_minimumSize;
 
             ASSERT(minimumSize >= parenthesesInputCountAlreadyChecked);
diff --git a/JavaScriptCore/yarr/RegexInterpreter.h b/JavaScriptCore/yarr/RegexInterpreter.h
index 4da9cc5..37f17fe 100644
--- a/JavaScriptCore/yarr/RegexInterpreter.h
+++ b/JavaScriptCore/yarr/RegexInterpreter.h
@@ -94,6 +94,7 @@ struct ByteTerm {
         struct {
             int next;
             int end;
+            bool onceThrough;
         } alternative;
         unsigned checkInputCount;
     };
@@ -215,19 +216,21 @@ struct ByteTerm {
         return ByteTerm(TypeBackReference, subpatternId, false, inputPos);
     }
 
-    static ByteTerm BodyAlternativeBegin()
+    static ByteTerm BodyAlternativeBegin(bool onceThrough)
     {
         ByteTerm term(TypeBodyAlternativeBegin);
         term.alternative.next = 0;
         term.alternative.end = 0;
+        term.alternative.onceThrough = onceThrough;
         return term;
     }
 
-    static ByteTerm BodyAlternativeDisjunction()
+    static ByteTerm BodyAlternativeDisjunction(bool onceThrough)
     {
         ByteTerm term(TypeBodyAlternativeDisjunction);
         term.alternative.next = 0;
         term.alternative.end = 0;
+        term.alternative.onceThrough = onceThrough;
         return term;
     }
 
@@ -236,6 +239,7 @@ struct ByteTerm {
         ByteTerm term(TypeBodyAlternativeEnd);
         term.alternative.next = 0;
         term.alternative.end = 0;
+        term.alternative.onceThrough = false;
         return term;
     }
 
@@ -244,6 +248,7 @@ struct ByteTerm {
         ByteTerm term(TypeAlternativeBegin);
         term.alternative.next = 0;
         term.alternative.end = 0;
+        term.alternative.onceThrough = false;
         return term;
     }
 
@@ -252,6 +257,7 @@ struct ByteTerm {
         ByteTerm term(TypeAlternativeDisjunction);
         term.alternative.next = 0;
         term.alternative.end = 0;
+        term.alternative.onceThrough = false;
         return term;
     }
 
@@ -260,6 +266,7 @@ struct ByteTerm {
         ByteTerm term(TypeAlternativeEnd);
         term.alternative.next = 0;
         term.alternative.end = 0;
+        term.alternative.onceThrough = false;
         return term;
     }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list