Bug 998158 - SpiderMonkey: When available, use SSE feature macros instead of runtime tests. r=sstangl
authorDan Gohman <sunfish@mozilla.com>
Mon, 21 Apr 2014 17:35:00 -0700
changeset 179888 c1c947d321b932e7b46c87dbd7d11a91f93481f7
parent 179887 6c0b4353730f7b1d9b01026ba2a0a526d4a2d7ce
child 179889 b9b4ff616b32af49791c397ed2585c18fba294be
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewerssstangl
bugs998158
milestone31.0a1
Bug 998158 - SpiderMonkey: When available, use SSE feature macros instead of runtime tests. r=sstangl
js/src/assembler/assembler/MacroAssemblerX86Common.h
--- a/js/src/assembler/assembler/MacroAssemblerX86Common.h
+++ b/js/src/assembler/assembler/MacroAssemblerX86Common.h
@@ -1292,110 +1292,114 @@ private:
     friend class MacroAssemblerX86;
 
     static SSECheckState s_sseCheckState;
 
     static void setSSECheckState();
 
   public:
 #if WTF_CPU_X86
-#if WTF_OS_MAC_OS_X
-
-    // All X86 Macs are guaranteed to support at least SSE2
     static bool isSSEPresent()
     {
+#if defined(__SSE__) && !defined(DEBUG)
         return true;
-    }
-
-    static bool isSSE2Present()
-    {
-#ifdef DEBUG
-        if (s_floatingPointDisabled)
-            return false;
-#endif
-        return true;
-    }
-
-#else // OS(MAC_OS_X)
-
-    static bool isSSEPresent()
-    {
+#else
         if (s_sseCheckState == NotCheckedSSE) {
             setSSECheckState();
         }
         // Only check once.
         ASSERT(s_sseCheckState != NotCheckedSSE);
 
         return s_sseCheckState >= HasSSE;
+#endif
     }
 
     static bool isSSE2Present()
     {
+#if defined(__SSE2__) && !defined(DEBUG)
+        return true;
+#else
         if (s_sseCheckState == NotCheckedSSE) {
             setSSECheckState();
         }
         // Only check once.
         ASSERT(s_sseCheckState != NotCheckedSSE);
 
         return s_sseCheckState >= HasSSE2;
+#endif
     }
 
-#endif // PLATFORM(MAC)
 #elif !defined(NDEBUG) // CPU(X86)
 
     // On x86-64 we should never be checking for SSE2 in a non-debug build,
     // but non debug add this method to keep the asserts above happy.
     static bool isSSE2Present()
     {
         return true;
     }
 
 #endif
     static bool isSSE3Present()
     {
+#if defined(__SSE3__) && !defined(DEBUG)
+        return true;
+#else
         if (s_sseCheckState == NotCheckedSSE) {
             setSSECheckState();
         }
         // Only check once.
         ASSERT(s_sseCheckState != NotCheckedSSE);
 
         return s_sseCheckState >= HasSSE3;
+#endif
     }
 
     static bool isSSSE3Present()
     {
+#if defined(__SSSE3__) && !defined(DEBUG)
+        return true;
+#else
         if (s_sseCheckState == NotCheckedSSE) {
             setSSECheckState();
         }
         // Only check once.
         ASSERT(s_sseCheckState != NotCheckedSSE);
 
         return s_sseCheckState >= HasSSSE3;
+#endif
     }
 
     static bool isSSE41Present()
     {
+#if defined(__SSE4_1__) && !defined(DEBUG)
+        return true;
+#else
         if (s_sseCheckState == NotCheckedSSE) {
             setSSECheckState();
         }
         // Only check once.
         ASSERT(s_sseCheckState != NotCheckedSSE);
 
         return s_sseCheckState >= HasSSE4_1;
+#endif
     }
 
     static bool isSSE42Present()
     {
+#if defined(__SSE4_2__) && !defined(DEBUG)
+        return true;
+#else
         if (s_sseCheckState == NotCheckedSSE) {
             setSSECheckState();
         }
         // Only check once.
         ASSERT(s_sseCheckState != NotCheckedSSE);
 
         return s_sseCheckState >= HasSSE4_2;
+#endif
     }
 
   private:
 #ifdef DEBUG
     static bool s_floatingPointDisabled;
     static bool s_SSE3Disabled;
     static bool s_SSE4Disabled;