Title: [181635] releases/WebKitGTK/webkit-2.8/Source
Revision
181635
Author
[email protected]
Date
2015-03-17 04:44:32 -0700 (Tue, 17 Mar 2015)

Log Message

Merge r181570 - [ARM] Enable generating idiv instructions if it is supported
https://bugs.webkit.org/show_bug.cgi?id=142725

Reviewed by Michael Saboff.

Source/_javascript_Core:

* assembler/ARMAssembler.h: Added sdiv and udiv implementation for ARM Traditional instruction set.
(JSC::ARMAssembler::sdiv):
(JSC::ARMAssembler::udiv):
* assembler/ARMv7Assembler.h: Use HAVE(ARM_IDIV_INSTRUCTIONS) instead of CPU(APPLE_ARMV7S).
* assembler/AbstractMacroAssembler.h:
(JSC::isARMv7IDIVSupported):
(JSC::optimizeForARMv7IDIVSupported):
(JSC::isARMv7s): Renamed to isARMv7IDIVSupported().
(JSC::optimizeForARMv7s): Renamed to optimizeForARMv7IDIVSupported().
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileArithDiv):
(JSC::DFG::SpeculativeJIT::compileArithMod):

Source/WTF:

* wtf/Platform.h: Set HAVE_ARM_IDIV_INSTRUCTIONS based on GCC macro too.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/ChangeLog (181634 => 181635)


--- releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/ChangeLog	2015-03-17 11:43:12 UTC (rev 181634)
+++ releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/ChangeLog	2015-03-17 11:44:32 UTC (rev 181635)
@@ -1,3 +1,25 @@
+2015-03-16  Csaba Osztrogonác  <[email protected]>
+
+        [ARM] Enable generating idiv instructions if it is supported
+        https://bugs.webkit.org/show_bug.cgi?id=142725
+
+        Reviewed by Michael Saboff.
+
+        * assembler/ARMAssembler.h: Added sdiv and udiv implementation for ARM Traditional instruction set.
+        (JSC::ARMAssembler::sdiv):
+        (JSC::ARMAssembler::udiv):
+        * assembler/ARMv7Assembler.h: Use HAVE(ARM_IDIV_INSTRUCTIONS) instead of CPU(APPLE_ARMV7S).
+        * assembler/AbstractMacroAssembler.h:
+        (JSC::isARMv7IDIVSupported):
+        (JSC::optimizeForARMv7IDIVSupported):
+        (JSC::isARMv7s): Renamed to isARMv7IDIVSupported().
+        (JSC::optimizeForARMv7s): Renamed to optimizeForARMv7IDIVSupported().
+        * dfg/DFGFixupPhase.cpp:
+        (JSC::DFG::FixupPhase::fixupNode):
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compileArithDiv):
+        (JSC::DFG::SpeculativeJIT::compileArithMod):
+
 2015-03-13  Filip Pizlo  <[email protected]>
 
         Object allocation sinking phase shouldn't re-decorate previously sunken allocations on each fixpoint operation

Modified: releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/assembler/ARMAssembler.h (181634 => 181635)


--- releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/assembler/ARMAssembler.h	2015-03-17 11:43:12 UTC (rev 181634)
+++ releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/assembler/ARMAssembler.h	2015-03-17 11:44:32 UTC (rev 181635)
@@ -216,6 +216,10 @@
 #endif
             NOP = 0xe1a00000,
             DMB_SY = 0xf57ff05f,
+#if HAVE(ARM_IDIV_INSTRUCTIONS)
+            SDIV = 0x0710f010,
+            UDIV = 0x0730f010,
+#endif
         };
 
         enum {
@@ -477,6 +481,26 @@
             m_buffer.putInt(toARMWord(cc) | MULL | RN(rdhi) | RD(rdlo) | RS(rn) | RM(rm));
         }
 
+#if HAVE(ARM_IDIV_INSTRUCTIONS)
+        template<int datasize>
+        void sdiv(int rd, int rn, int rm, Condition cc = AL)
+        {
+            static_assert(datasize == 32, "sdiv datasize must be 32 for armv7s");
+            ASSERT(rd != ARMRegisters::pc);
+            ASSERT(rn != ARMRegisters::pc);
+            ASSERT(rm != ARMRegisters::pc);
+            m_buffer.putInt(toARMWord(cc) | SDIV | RN(rd) | RM(rn) | RS(rm));
+        }
+
+        void udiv(int rd, int rn, int rm, Condition cc = AL)
+        {
+            ASSERT(rd != ARMRegisters::pc);
+            ASSERT(rn != ARMRegisters::pc);
+            ASSERT(rm != ARMRegisters::pc);
+            m_buffer.putInt(toARMWord(cc) | UDIV | RN(rd) | RM(rn) | RS(rm));
+        }
+#endif
+
         void vmov_f64(int dd, int dm, Condition cc = AL)
         {
             emitDoublePrecisionInstruction(toARMWord(cc) | VMOV_F64, dd, 0, dm);

Modified: releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/assembler/ARMv7Assembler.h (181634 => 181635)


--- releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/assembler/ARMv7Assembler.h	2015-03-17 11:43:12 UTC (rev 181634)
+++ releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/assembler/ARMv7Assembler.h	2015-03-17 11:44:32 UTC (rev 181635)
@@ -708,7 +708,7 @@
         OP_ROR_reg_T2   = 0xFA60,
         OP_CLZ          = 0xFAB0,
         OP_SMULL_T1     = 0xFB80,
-#if CPU(APPLE_ARMV7S)
+#if HAVE(ARM_IDIV_INSTRUCTIONS)
         OP_SDIV_T1      = 0xFB90,
         OP_UDIV_T1      = 0xFBB0,
 #endif
@@ -1499,7 +1499,7 @@
         m_formatter.twoWordOp16Imm16(OP_PUSH_T2, registerList);
     }
 
-#if CPU(APPLE_ARMV7S)
+#if HAVE(ARM_IDIV_INSTRUCTIONS)
     template<int datasize>
     ALWAYS_INLINE void sdiv(RegisterID rd, RegisterID rn, RegisterID rm)
     {
@@ -1847,7 +1847,7 @@
         m_formatter.twoWordOp12Reg40Imm3Reg4Imm20Imm5(OP_UBFX_T1, rd, rn, (lsb & 0x1c) << 10, (lsb & 0x3) << 6, (width - 1) & 0x1f);
     }
 
-#if CPU(APPLE_ARMV7S)
+#if HAVE(ARM_IDIV_INSTRUCTIONS)
     ALWAYS_INLINE void udiv(RegisterID rd, RegisterID rn, RegisterID rm)
     {
         ASSERT(!BadReg(rd));

Modified: releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/assembler/AbstractMacroAssembler.h (181634 => 181635)


--- releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/assembler/AbstractMacroAssembler.h	2015-03-17 11:43:12 UTC (rev 181634)
+++ releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/assembler/AbstractMacroAssembler.h	2015-03-17 11:44:32 UTC (rev 181635)
@@ -39,9 +39,9 @@
 
 namespace JSC {
 
-inline bool isARMv7s()
+inline bool isARMv7IDIVSupported()
 {
-#if CPU(APPLE_ARMV7S)
+#if HAVE(ARM_IDIV_INSTRUCTIONS)
     return true;
 #else
     return false;
@@ -66,9 +66,9 @@
 #endif
 }
 
-inline bool optimizeForARMv7s()
+inline bool optimizeForARMv7IDIVSupported()
 {
-    return isARMv7s() && Options::enableArchitectureSpecificOptimizations();
+    return isARMv7IDIVSupported() && Options::enableArchitectureSpecificOptimizations();
 }
 
 inline bool optimizeForARM64()

Modified: releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/dfg/DFGFixupPhase.cpp (181634 => 181635)


--- releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/dfg/DFGFixupPhase.cpp	2015-03-17 11:43:12 UTC (rev 181634)
+++ releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/dfg/DFGFixupPhase.cpp	2015-03-17 11:44:32 UTC (rev 181635)
@@ -271,7 +271,7 @@
         case ArithMod: {
             if (Node::shouldSpeculateInt32OrBooleanForArithmetic(node->child1().node(), node->child2().node())
                 && node->canSpeculateInt32(FixupPass)) {
-                if (optimizeForX86() || optimizeForARM64() || optimizeForARMv7s()) {
+                if (optimizeForX86() || optimizeForARM64() || optimizeForARMv7IDIVSupported()) {
                     fixIntOrBooleanEdge(node->child1());
                     fixIntOrBooleanEdge(node->child2());
                     if (bytecodeCanTruncateInteger(node->arithNodeFlags()))

Modified: releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (181634 => 181635)


--- releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2015-03-17 11:43:12 UTC (rev 181634)
+++ releases/WebKitGTK/webkit-2.8/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2015-03-17 11:44:32 UTC (rev 181635)
@@ -3218,7 +3218,7 @@
         
         done.link(&m_jit);
         int32Result(eax.gpr(), node);
-#elif CPU(APPLE_ARMV7S) || CPU(ARM64)
+#elif HAVE(ARM_IDIV_INSTRUCTIONS) || CPU(ARM64)
         SpeculateInt32Operand op1(this, node->child1());
         SpeculateInt32Operand op2(this, node->child2());
         GPRReg op1GPR = op1.gpr();
@@ -3471,7 +3471,7 @@
         done.link(&m_jit);
         int32Result(edx.gpr(), node);
 
-#elif CPU(ARM64) || CPU(APPLE_ARMV7S)
+#elif HAVE(ARM_IDIV_INSTRUCTIONS) || CPU(ARM64)
         GPRTemporary temp(this);
         GPRTemporary quotientThenRemainder(this);
         GPRTemporary multiplyAnswer(this);
@@ -3496,7 +3496,7 @@
         // arithMode() == Arith::Unchecked?
         // https://bugs.webkit.org/show_bug.cgi?id=126444
         speculationCheck(Overflow, JSValueRegs(), 0, m_jit.branchMul32(JITCompiler::Overflow, quotientThenRemainderGPR, divisorGPR, multiplyAnswerGPR));
-#if CPU(APPLE_ARMV7S)
+#if HAVE(ARM_IDIV_INSTRUCTIONS)
         m_jit.assembler().sub(quotientThenRemainderGPR, dividendGPR, multiplyAnswerGPR);
 #else
         m_jit.assembler().sub<32>(quotientThenRemainderGPR, dividendGPR, multiplyAnswerGPR);

Modified: releases/WebKitGTK/webkit-2.8/Source/WTF/ChangeLog (181634 => 181635)


--- releases/WebKitGTK/webkit-2.8/Source/WTF/ChangeLog	2015-03-17 11:43:12 UTC (rev 181634)
+++ releases/WebKitGTK/webkit-2.8/Source/WTF/ChangeLog	2015-03-17 11:44:32 UTC (rev 181635)
@@ -1,3 +1,12 @@
+2015-03-16  Csaba Osztrogonác  <[email protected]>
+
+        [ARM] Enable generating idiv instructions if it is supported
+        https://bugs.webkit.org/show_bug.cgi?id=142725
+
+        Reviewed by Michael Saboff.
+
+        * wtf/Platform.h: Set HAVE_ARM_IDIV_INSTRUCTIONS based on GCC macro too.
+
 2015-03-16  Max Stepin  <[email protected]>
 
         Add APNG support

Modified: releases/WebKitGTK/webkit-2.8/Source/WTF/wtf/Platform.h (181634 => 181635)


--- releases/WebKitGTK/webkit-2.8/Source/WTF/wtf/Platform.h	2015-03-17 11:43:12 UTC (rev 181634)
+++ releases/WebKitGTK/webkit-2.8/Source/WTF/wtf/Platform.h	2015-03-17 11:44:32 UTC (rev 181635)
@@ -334,6 +334,10 @@
 #define WTF_CPU_APPLE_ARMV7S 1
 #endif
 
+#if defined(__ARM_ARCH_EXT_IDIV__) || CPU(APPLE_ARMV7S)
+#define HAVE_ARM_IDIV_INSTRUCTIONS 1
+#endif
+
 #endif /* ARM */
 
 #if CPU(ARM) || CPU(MIPS) || CPU(SH4)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to