Title: [108753] trunk/Source/_javascript_Core
Revision
108753
Author
[email protected]
Date
2012-02-24 01:49:38 -0800 (Fri, 24 Feb 2012)

Log Message

Remove useless jump instructions for short circuit
https://bugs.webkit.org/show_bug.cgi?id=75602

Patch by Han Hojong <[email protected]> on 2012-02-24
Reviewed by Michael Saboff.

Jump instruction is inserted to make short circuit,
however it does nothing but moving to the next instruction.
Therefore useless jump instructions are removed,
and jump list is moved into the case not for a short circuit,
so that only necessary instructions are added to JIT code
unless it has a 16 bit pattern character and an 8 bit string.

* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::generatePatternCharacterGreedy):
(JSC::Yarr::YarrGenerator::backtrackPatternCharacterNonGreedy):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (108752 => 108753)


--- trunk/Source/_javascript_Core/ChangeLog	2012-02-24 09:47:47 UTC (rev 108752)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-02-24 09:49:38 UTC (rev 108753)
@@ -1,3 +1,21 @@
+2012-02-24  Han Hojong  <[email protected]>
+
+        Remove useless jump instructions for short circuit
+        https://bugs.webkit.org/show_bug.cgi?id=75602
+
+        Reviewed by Michael Saboff.
+
+        Jump instruction is inserted to make short circuit, 
+        however it does nothing but moving to the next instruction.
+        Therefore useless jump instructions are removed, 
+        and jump list is moved into the case not for a short circuit,
+        so that only necessary instructions are added to JIT code
+        unless it has a 16 bit pattern character and an 8 bit string.
+
+        * yarr/YarrJIT.cpp:
+        (JSC::Yarr::YarrGenerator::generatePatternCharacterGreedy):
+        (JSC::Yarr::YarrGenerator::backtrackPatternCharacterNonGreedy):
+
 2012-02-24  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r108731.

Modified: trunk/Source/_javascript_Core/yarr/YarrJIT.cpp (108752 => 108753)


--- trunk/Source/_javascript_Core/yarr/YarrJIT.cpp	2012-02-24 09:47:47 UTC (rev 108752)
+++ trunk/Source/_javascript_Core/yarr/YarrJIT.cpp	2012-02-24 09:49:38 UTC (rev 108753)
@@ -816,10 +816,8 @@
 
         move(TrustedImm32(0), countRegister);
 
-        if ((ch > 0xff) && (m_charSize == Char8)) {
-            // Have a 16 bit pattern character and an 8 bit string - short circuit
-            op.m_jumps.append(jump());
-        } else {
+        // Unless have a 16 bit pattern character and an 8 bit string - short circuit
+        if (!((ch > 0xff) && (m_charSize == Char8))) {
             JumpList failures;
             Label loop(this);
             failures.append(atEndOfInput());
@@ -837,7 +835,6 @@
         op.m_reentry = label();
 
         storeToFrame(countRegister, term->frameLocation);
-
     }
     void backtrackPatternCharacterGreedy(size_t opIndex)
     {
@@ -875,16 +872,13 @@
         const RegisterID character = regT0;
         const RegisterID countRegister = regT1;
 
-        JumpList nonGreedyFailures;
-
         m_backtrackingState.link(this);
 
         loadFromFrame(term->frameLocation, countRegister);
 
-        if ((ch > 0xff) && (m_charSize == Char8)) {
-            // Have a 16 bit pattern character and an 8 bit string - short circuit
-            nonGreedyFailures.append(jump());
-        } else {
+        // Unless have a 16 bit pattern character and an 8 bit string - short circuit
+        if (!((ch > 0xff) && (m_charSize == Char8))) {
+            JumpList nonGreedyFailures;
             nonGreedyFailures.append(atEndOfInput());
             if (term->quantityCount != quantifyInfinite)
                 nonGreedyFailures.append(branch32(Equal, countRegister, Imm32(term->quantityCount.unsafeGet())));
@@ -894,8 +888,8 @@
             add32(TrustedImm32(1), index);
 
             jump(op.m_reentry);
+            nonGreedyFailures.link(this);
         }
-        nonGreedyFailures.link(this);
 
         sub32(countRegister, index);
         m_backtrackingState.fallthrough();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to