Title: [192984] trunk/Source/_javascript_Core
Revision
192984
Author
benja...@webkit.org
Date
2015-12-02 16:21:20 -0800 (Wed, 02 Dec 2015)

Log Message

[JSC] Add sin(), cos(), pow() and log() to B3
https://bugs.webkit.org/show_bug.cgi?id=151778

Reviewed by Geoffrey Garen.

* ftl/FTLB3Output.h:
(JSC::FTL::Output::doubleSin):
(JSC::FTL::Output::doubleCos):
(JSC::FTL::Output::doublePow):
(JSC::FTL::Output::doubleLog):
(JSC::FTL::Output::callWithoutSideEffects):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (192983 => 192984)


--- trunk/Source/_javascript_Core/ChangeLog	2015-12-02 23:55:50 UTC (rev 192983)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-12-03 00:21:20 UTC (rev 192984)
@@ -1,3 +1,17 @@
+2015-12-02  Benjamin Poulain  <benja...@webkit.org>
+
+        [JSC] Add sin(), cos(), pow() and log() to B3
+        https://bugs.webkit.org/show_bug.cgi?id=151778
+
+        Reviewed by Geoffrey Garen.
+
+        * ftl/FTLB3Output.h:
+        (JSC::FTL::Output::doubleSin):
+        (JSC::FTL::Output::doubleCos):
+        (JSC::FTL::Output::doublePow):
+        (JSC::FTL::Output::doubleLog):
+        (JSC::FTL::Output::callWithoutSideEffects):
+
 2015-12-02  Filip Pizlo  <fpi...@apple.com>
 
         Add a few obvious strength-reductions to Air

Modified: trunk/Source/_javascript_Core/ftl/FTLB3Output.h (192983 => 192984)


--- trunk/Source/_javascript_Core/ftl/FTLB3Output.h	2015-12-02 23:55:50 UTC (rev 192983)
+++ trunk/Source/_javascript_Core/ftl/FTLB3Output.h	2015-12-03 00:21:20 UTC (rev 192984)
@@ -159,16 +159,16 @@
     LValue mulWithOverflow64(LValue left, LValue right) { CRASH(); }
     LValue doubleAbs(LValue value) { CRASH(); }
 
-    LValue doubleSin(LValue value) { CRASH(); }
-    LValue doubleCos(LValue value) { CRASH(); }
+    LValue doubleSin(LValue value) { return callWithoutSideEffects(B3::Double, sin, value); }
+    LValue doubleCos(LValue value) { return callWithoutSideEffects(B3::Double, cos, value); }
 
-    LValue doublePow(LValue xOperand, LValue yOperand) { CRASH(); }
+    LValue doublePow(LValue xOperand, LValue yOperand) { return callWithoutSideEffects(B3::Double, pow, xOperand, yOperand); }
 
     LValue doublePowi(LValue xOperand, LValue yOperand) { CRASH(); }
 
     LValue doubleSqrt(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::Sqrt, origin(), value); }
 
-    LValue doubleLog(LValue value) { CRASH(); }
+    LValue doubleLog(LValue value) { return callWithoutSideEffects(B3::Double, log, value); }
 
     static bool hasSensibleDoubleToInt() { CRASH(); }
     LValue sensibleDoubleToInt(LValue) { CRASH(); }
@@ -448,6 +448,16 @@
     LBasicBlock m_nextBlock { nullptr };
 
     AbstractHeapRepository* m_heaps;
+
+private:
+    template<typename Function, typename... Args>
+    LValue callWithoutSideEffects(B3::Type type, Function function, LValue arg1, Args... args)
+    {
+        return m_block->appendNew<B3::CCallValue>(m_proc, type, origin(), B3::Effects::none(),
+            m_block->appendNew<B3::ConstPtrValue>(m_proc, origin(), bitwise_cast<void*>(function)),
+            arg1, args...);
+    }
+
 };
 
 template<typename... Params>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to