File webkit2gtk3-fix-i586-build.patch of Package webkit2gtk3.10996

Index: /trunk/CMakeLists.txt
===================================================================
--- /trunk/CMakeLists.txt	(revision 244137)
+++ /trunk/CMakeLists.txt	(revision 244138)
@@ -115,14 +115,4 @@
 endif ()
 
-#---------------------------
-# Make sure SSE2 is present.
-#---------------------------
-if (WTF_CPU_X86)
-    include(FindSSE2)
-    if (NOT SSE2_SUPPORT_FOUND)
-        message(FATAL_ERROR "SSE2 support is required to compile WebKit")
-    endif ()
-endif ()
-
 # -----------------------------------------------------------------------------
 # Determine the operating system
Index: /trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp
===================================================================
--- /trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp	(revision 244137)
+++ /trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp	(revision 244138)
@@ -168,4 +168,9 @@
 static_assert(sizeof(Probe::State) == PROBE_SIZE, "Probe::State::size's matches ctiMasmProbeTrampoline");
 static_assert((PROBE_EXECUTOR_OFFSET + PTR_SIZE) <= (PROBE_SIZE + OUT_SIZE), "Must have room after ProbeContext to stash the probe handler");
+
+#if CPU(X86)
+// SSE2 is a hard requirement on x86.
+static_assert(isSSE2Present(), "SSE2 support is required in JavaScriptCore");
+#endif
 
 #undef PROBE_OFFSETOF
@@ -788,4 +793,5 @@
         {
             CPUID cpuid = getCPUID(0x1);
+            s_sse2CheckState = (cpuid[3] & (1 << 26)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear;
             s_sse4_1CheckState = (cpuid[2] & (1 << 19)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear;
             s_sse4_2CheckState = (cpuid[2] & (1 << 20)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear;
@@ -804,4 +810,5 @@
 }
 
+MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_sse2CheckState = CPUIDCheckState::NotChecked;
 MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_sse4_1CheckState = CPUIDCheckState::NotChecked;
 MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_sse4_2CheckState = CPUIDCheckState::NotChecked;
Index: /trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
===================================================================
--- /trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h	(revision 244137)
+++ /trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h	(revision 244138)
@@ -4198,4 +4198,33 @@
 #endif
 
+#if CPU(X86)
+#if OS(MAC_OS_X)
+
+    // All X86 Macs are guaranteed to support at least SSE2,
+    static bool isSSE2Present()
+    {
+        return true;
+    }
+
+#else // OS(MAC_OS_X)
+    static bool isSSE2Present()
+    {
+        if (s_sse2CheckState == CPUIDCheckState::NotChecked)
+            collectCPUFeatures();
+        return s_sse2CheckState == CPUIDCheckState::Set;
+    }
+
+#endif // OS(MAC_OS_X)
+#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
+
     using CPUID = std::array<unsigned, 4>;
     static CPUID getCPUID(unsigned level);
@@ -4203,4 +4232,5 @@
     JS_EXPORT_PRIVATE static void collectCPUFeatures();
 
+    JS_EXPORT_PRIVATE static CPUIDCheckState s_sse2CheckState;
     JS_EXPORT_PRIVATE static CPUIDCheckState s_sse4_1CheckState;
     JS_EXPORT_PRIVATE static CPUIDCheckState s_sse4_2CheckState;
openSUSE Build Service is sponsored by