Title: [153194] trunk/Source/_javascript_Core
Revision
153194
Author
[email protected]
Date
2013-07-24 21:01:30 -0700 (Wed, 24 Jul 2013)

Log Message

fourthTier: FTL should support ArithMin/ArithMax
https://bugs.webkit.org/show_bug.cgi?id=116885

Reviewed by Oliver Hunt.

* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileNode):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (153193 => 153194)


--- trunk/Source/_javascript_Core/ChangeLog	2013-07-25 04:01:28 UTC (rev 153193)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-07-25 04:01:30 UTC (rev 153194)
@@ -1,5 +1,19 @@
 2013-05-28  Filip Pizlo  <[email protected]>
 
+        fourthTier: FTL should support ArithMin/ArithMax
+        https://bugs.webkit.org/show_bug.cgi?id=116885
+
+        Reviewed by Oliver Hunt.
+
+        * ftl/FTLCapabilities.cpp:
+        (JSC::FTL::canCompile):
+        * ftl/FTLLowerDFGToLLVM.cpp:
+        (JSC::FTL::LowerDFGToLLVM::compileNode):
+        (LowerDFGToLLVM):
+        (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax):
+
+2013-05-28  Filip Pizlo  <[email protected]>
+
         testRunner should have a way of disabling inlining of functions
         https://bugs.webkit.org/show_bug.cgi?id=116875
 

Modified: trunk/Source/_javascript_Core/ftl/FTLCapabilities.cpp (153193 => 153194)


--- trunk/Source/_javascript_Core/ftl/FTLCapabilities.cpp	2013-07-25 04:01:28 UTC (rev 153193)
+++ trunk/Source/_javascript_Core/ftl/FTLCapabilities.cpp	2013-07-25 04:01:30 UTC (rev 153194)
@@ -68,6 +68,8 @@
     case ArithMul:
     case ArithDiv:
     case ArithMod:
+    case ArithMin:
+    case ArithMax:
     case ArithNegate:
     case UInt32ToNumber:
     case Int32ToDouble:

Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp (153193 => 153194)


--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2013-07-25 04:01:28 UTC (rev 153193)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2013-07-25 04:01:30 UTC (rev 153194)
@@ -314,6 +314,10 @@
         case ArithMod:
             compileArithMod();
             break;
+        case ArithMin:
+        case ArithMax:
+            compileArithMinOrMax();
+            break;
         case ArithNegate:
             compileArithNegate();
             break;
@@ -878,6 +882,58 @@
             break;
         }
     }
+
+    void compileArithMinOrMax()
+    {
+        switch (m_node->binaryUseKind()) {
+        case Int32Use: {
+            LValue left = lowInt32(m_node->child1());
+            LValue right = lowInt32(m_node->child2());
+            
+            m_int32Values.add(
+                m_node,
+                m_out.select(
+                    m_node->op() == ArithMin
+                        ? m_out.lessThan(left, right)
+                        : m_out.lessThan(right, left),
+                    left, right));
+            break;
+        }
+            
+        case NumberUse: {
+            LValue left = lowDouble(m_node->child1());
+            LValue right = lowDouble(m_node->child2());
+            
+            LBasicBlock notLessThan = FTL_NEW_BLOCK(m_out, ("ArithMin/ArithMax not less than"));
+            LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("ArithMin/ArithMax continuation"));
+            
+            Vector<ValueFromBlock, 2> results;
+            
+            results.append(m_out.anchor(left));
+            m_out.branch(
+                m_node->op() == ArithMin
+                    ? m_out.doubleLessThan(left, right)
+                    : m_out.doubleGreaterThan(left, right),
+                continuation, notLessThan);
+            
+            LBasicBlock lastNext = m_out.appendTo(notLessThan, continuation);
+            results.append(m_out.anchor(m_out.select(
+                m_node->op() == ArithMin
+                    ? m_out.doubleGreaterThanOrEqual(left, right)
+                    : m_out.doubleLessThanOrEqual(left, right),
+                right, m_out.constDouble(0.0 / 0.0))));
+            m_out.jump(continuation);
+            
+            m_out.appendTo(continuation, lastNext);
+            m_doubleValues.add(m_node, m_out.phi(m_out.doubleType, results));
+            break;
+        }
+            
+        default:
+            RELEASE_ASSERT_NOT_REACHED();
+            break;
+        }
+    }
     
     void compileArithNegate()
     {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to