Short circuit fixed for a 16 bt pattern character and an 8 bit string.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Feb 2012 08:43:52 +0000 (08:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Feb 2012 08:43:52 +0000 (08:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75602

Patch by Hojong Han <hojong.han@samsung.com> on 2012-02-22
Reviewed by Gavin Barraclough.

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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108456 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/yarr/YarrJIT.cpp

index c10e073..d62e95c 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-22  Hojong Han  <hojong.han@samsung.com>
+
+        Short circuit fixed for a 16 bt pattern character and an 8 bit string.
+        https://bugs.webkit.org/show_bug.cgi?id=75602
+
+        Reviewed by Gavin Barraclough.
+
+        * yarr/YarrJIT.cpp:
+        (JSC::Yarr::YarrGenerator::backtrackPatternCharacterGreedy):
+
 2012-02-21  Filip Pizlo  <fpizlo@apple.com>
 
         Build fix for systems with case sensitive disks.
index fe8e258..a81d89d 100644 (file)
@@ -843,16 +843,22 @@ class YarrGenerator : private MacroAssembler {
     {
         YarrOp& op = m_ops[opIndex];
         PatternTerm* term = op.m_term;
+        UChar ch = term->patternCharacter;
 
         const RegisterID countRegister = regT1;
 
         m_backtrackingState.link(this);
 
-        loadFromFrame(term->frameLocation, countRegister);
-        m_backtrackingState.append(branchTest32(Zero, countRegister));
-        sub32(TrustedImm32(1), countRegister);
-        sub32(TrustedImm32(1), index);
-        jump(op.m_reentry);
+        if ((ch > 0xff) && (m_charSize == Char8)) {
+            // Have a 16 bit pattern character and an 8 bit string - short circuit
+            m_backtrackingState.append(op.m_jumps);
+        } else {
+            loadFromFrame(term->frameLocation, countRegister);
+            m_backtrackingState.append(branchTest32(Zero, countRegister));
+            sub32(TrustedImm32(1), countRegister);
+            sub32(TrustedImm32(1), index);
+            jump(op.m_reentry);
+        }
     }
 
     void generatePatternCharacterNonGreedy(size_t opIndex)