[Win] [64-bit] Remove MSVC 2013 FMA3 Bug Workaround
https://bugs.webkit.org/show_bug.cgi?id=141499

Reviewed by Brent Fulgham.

As we have moved on to VS2015, this workaround is no longer needed.

Source/JavaScriptCore:

* API/tests/testapi.c:
(main):
* JavaScriptCore.vcxproj/jsc/DLLLauncherMain.cpp:
(wWinMain):
* jsc.cpp:
(main):
* testRegExp.cpp:
(main):

Source/WebKit/win:

* WebKitDLL.cpp:
(DllMain):

Source/WTF:

* wtf/PlatformWin.cmake:
* wtf/win/WTFDLL.cpp: Removed.

Tools:

* DumpRenderTree/cg/ImageDiffCG.cpp:
(main):
* DumpRenderTree/win/DumpRenderTree.cpp:
(main):
* DumpRenderTree/win/ImageDiffCairo.cpp:
(main):
* MiniBrowser/win/Common.cpp:
(DllMain):
* TestWebKitAPI/win/main.cpp:
(main):
* win/DLLLauncher/DLLLauncherMain.cpp:
(wWinMain):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@198559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/API/tests/testapi.c b/Source/JavaScriptCore/API/tests/testapi.c
index 2b47472..67fbaa3 100644
--- a/Source/JavaScriptCore/API/tests/testapi.c
+++ b/Source/JavaScriptCore/API/tests/testapi.c
@@ -1116,15 +1116,6 @@
 int main(int argc, char* argv[])
 {
 #if OS(WINDOWS)
-#if defined(_M_X64) || defined(__x86_64__)
-    // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
-    // if the feature has been disabled in firmware. This causes us to crash
-    // in some of the math functions. For now, we disable those optimizations
-    // because Microsoft is not going to fix the problem in VS2013.
-    // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
-    _set_FMA3_enable(0);
-#endif
-
     // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for
     // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the
     // error mode here to work around Cygwin's behavior. See <http://webkit.org/b/55222>.
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 4cd8947..8b99f44 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,21 @@
+2016-03-22  Per Arne Vollan  <peavo@outlook.com>
+
+        [Win] [64-bit] Remove MSVC 2013 FMA3 Bug Workaround
+        https://bugs.webkit.org/show_bug.cgi?id=141499
+
+        Reviewed by Brent Fulgham.
+
+        As we have moved on to VS2015, this workaround is no longer needed.
+
+        * API/tests/testapi.c:
+        (main):
+        * JavaScriptCore.vcxproj/jsc/DLLLauncherMain.cpp:
+        (wWinMain):
+        * jsc.cpp:
+        (main):
+        * testRegExp.cpp:
+        (main):
+
 2016-03-22  Michael Saboff  <msaboff@apple.com>
 
         [ES6] Implement RegExp.prototype[@@match]
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcxproj/jsc/DLLLauncherMain.cpp b/Source/JavaScriptCore/JavaScriptCore.vcxproj/jsc/DLLLauncherMain.cpp
index 66c1739..0ff5b61 100644
--- a/Source/JavaScriptCore/JavaScriptCore.vcxproj/jsc/DLLLauncherMain.cpp
+++ b/Source/JavaScriptCore/JavaScriptCore.vcxproj/jsc/DLLLauncherMain.cpp
@@ -183,15 +183,6 @@
 int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpstrCmdLine, int nCmdShow)
 #endif
 {
-#if defined(_M_X64) || defined(__x86_64__)
-    // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
-    // if the feature has been disabled in firmware. This causes us to crash
-    // in some of the math functions. For now, we disable those optimizations
-    // because Microsoft is not going to fix the problem in VS2013.
-    // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
-    _set_FMA3_enable(0);
-#endif
-
     enableTerminationOnHeapCorruption();
 
     // Get the path of our executable.
diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp
index 33c4901..7f0a19e 100644
--- a/Source/JavaScriptCore/jsc.cpp
+++ b/Source/JavaScriptCore/jsc.cpp
@@ -1803,14 +1803,7 @@
     fesetenv( &env );
 #endif
 
-#if OS(WINDOWS) && (defined(_M_X64) || defined(__x86_64__))
-    // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
-    // if the feature has been disabled in firmware. This causes us to crash
-    // in some of the math functions. For now, we disable those optimizations
-    // because Microsoft is not going to fix the problem in VS2013.
-    // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
-    _set_FMA3_enable(0);
-
+#if OS(WINDOWS)
     // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for
     // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the
     // error mode here to work around Cygwin's behavior. See <http://webkit.org/b/55222>.
diff --git a/Source/JavaScriptCore/testRegExp.cpp b/Source/JavaScriptCore/testRegExp.cpp
index 87adad1..7f29aea 100644
--- a/Source/JavaScriptCore/testRegExp.cpp
+++ b/Source/JavaScriptCore/testRegExp.cpp
@@ -159,15 +159,6 @@
 int main(int argc, char** argv)
 {
 #if OS(WINDOWS)
-#if defined(_M_X64) || defined(__x86_64__)
-    // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
-    // if the feature has been disabled in firmware. This causes us to crash
-    // in some of the math functions. For now, we disable those optimizations
-    // because Microsoft is not going to fix the problem in VS2013.
-    // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
-    _set_FMA3_enable(0);
-#endif
-
     // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for
     // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the
     // error mode here to work around Cygwin's behavior. See <http://webkit.org/b/55222>.
diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog
index 1031e4e..944d5fa 100644
--- a/Source/WTF/ChangeLog
+++ b/Source/WTF/ChangeLog
@@ -1,3 +1,15 @@
+2016-03-22  Per Arne Vollan  <peavo@outlook.com>
+
+        [Win] [64-bit] Remove MSVC 2013 FMA3 Bug Workaround
+        https://bugs.webkit.org/show_bug.cgi?id=141499
+
+        Reviewed by Brent Fulgham.
+
+        As we have moved on to VS2015, this workaround is no longer needed.
+
+        * wtf/PlatformWin.cmake:
+        * wtf/win/WTFDLL.cpp: Removed.
+
 2016-03-20  Dan Bernstein  <mitz@apple.com>
 
         [Mac] Determine TARGET_MAC_OS_X_VERSION_MAJOR from MACOSX_DEPLOYMENT_TARGET rather than from MAC_OS_X_VERSION_MAJOR
diff --git a/Source/WTF/wtf/PlatformWin.cmake b/Source/WTF/wtf/PlatformWin.cmake
index ea1426a..15b39cb 100644
--- a/Source/WTF/wtf/PlatformWin.cmake
+++ b/Source/WTF/wtf/PlatformWin.cmake
@@ -6,7 +6,6 @@
 
     win/MainThreadWin.cpp
     win/RunLoopWin.cpp
-    win/WTFDLL.cpp
     win/WorkItemWin.cpp
     win/WorkQueueWin.cpp
 )
diff --git a/Source/WTF/wtf/win/WTFDLL.cpp b/Source/WTF/wtf/win/WTFDLL.cpp
deleted file mode 100644
index 779e1b8..0000000
--- a/Source/WTF/wtf/win/WTFDLL.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-* Copyright (C) 2015 Apple Inc.  All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-* 1. Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-*    notice, this list of conditions and the following disclaimer in the
-*    documentation and/or other materials provided with the distribution.
-*
-* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
-* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <Windows.h>
-#include <math.h>
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
-    switch (fdwReason) {
-    case DLL_PROCESS_ATTACH:
-#if defined(_M_X64) || defined(__x86_64__)
-        // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
-        // if the feature has been disabled in firmware. This causes us to crash
-        // in some of the math functions. For now, we disable those optimizations
-        // because Microsoft is not going to fix the problem in VS2013.
-        // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
-        _set_FMA3_enable(0);
-#endif
-        break;
-
-    case DLL_PROCESS_DETACH:
-    case DLL_THREAD_ATTACH:
-    case DLL_THREAD_DETACH:
-        break;
-    }
-
-    return TRUE;
-}
diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog
index 061f20f..de15551 100644
--- a/Source/WebKit/win/ChangeLog
+++ b/Source/WebKit/win/ChangeLog
@@ -1,3 +1,15 @@
+2016-03-22  Per Arne Vollan  <peavo@outlook.com>
+
+        [Win] [64-bit] Remove MSVC 2013 FMA3 Bug Workaround
+        https://bugs.webkit.org/show_bug.cgi?id=141499
+
+        Reviewed by Brent Fulgham.
+
+        As we have moved on to VS2015, this workaround is no longer needed.
+
+        * WebKitDLL.cpp:
+        (DllMain):
+
 2016-03-21  Hyungwook Lee  <hyungwook.lee@navercorp.com> 
 
         [Win] Connect layoutTestController.findString() to support testing 
diff --git a/Source/WebKit/win/WebKitDLL.cpp b/Source/WebKit/win/WebKitDLL.cpp
index 83a0abd..3f23df9 100644
--- a/Source/WebKit/win/WebKitDLL.cpp
+++ b/Source/WebKit/win/WebKitDLL.cpp
@@ -70,14 +70,6 @@
 {
     switch (ul_reason_for_call) {
         case DLL_PROCESS_ATTACH:
-#if defined(_M_X64) || defined(__x86_64__)
-            // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
-            // if the feature has been disabled in firmware. This causes us to crash
-            // in some of the math functions. For now, we disable those optimizations
-            // because Microsoft is not going to fix the problem in VS2013.
-            // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
-            _set_FMA3_enable(0);
-#endif
             gLockCount = gClassCount = 0;
             gInstance = hModule;
             WebCore::setInstanceHandle(hModule);
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 0f19c23..788b06e 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,25 @@
+2016-03-22  Per Arne Vollan  <peavo@outlook.com>
+
+        [Win] [64-bit] Remove MSVC 2013 FMA3 Bug Workaround
+        https://bugs.webkit.org/show_bug.cgi?id=141499
+
+        Reviewed by Brent Fulgham.
+
+        As we have moved on to VS2015, this workaround is no longer needed.
+
+        * DumpRenderTree/cg/ImageDiffCG.cpp:
+        (main):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (main):
+        * DumpRenderTree/win/ImageDiffCairo.cpp:
+        (main):
+        * MiniBrowser/win/Common.cpp:
+        (DllMain):
+        * TestWebKitAPI/win/main.cpp:
+        (main):
+        * win/DLLLauncher/DLLLauncherMain.cpp:
+        (wWinMain):
+
 2016-03-22  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         [JSC] ASMBench cannot be run without JSBENCH_PATH
diff --git a/Tools/DumpRenderTree/cg/ImageDiffCG.cpp b/Tools/DumpRenderTree/cg/ImageDiffCG.cpp
index cdedd6d..7dc05db 100644
--- a/Tools/DumpRenderTree/cg/ImageDiffCG.cpp
+++ b/Tools/DumpRenderTree/cg/ImageDiffCG.cpp
@@ -171,15 +171,6 @@
 int main(int argc, const char* argv[])
 {
 #if PLATFORM(WIN)
-#if defined(_M_X64) || defined(__x86_64__)
-    // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
-    // if the feature has been disabled in firmware. This causes us to crash
-    // in some of the math functions. For now, we disable those optimizations
-    // because Microsoft is not going to fix the problem in VS2013.
-    // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
-    _set_FMA3_enable(0);
-#endif
-
     _setmode(0, _O_BINARY);
     _setmode(1, _O_BINARY);
 #endif
diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp
index 6a9d25e..e0f0fd8 100644
--- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp
+++ b/Tools/DumpRenderTree/win/DumpRenderTree.cpp
@@ -1394,15 +1394,6 @@
 
 int main(int argc, const char* argv[])
 {
-#if defined(_M_X64) || defined(__x86_64__)
-    // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
-    // if the feature has been disabled in firmware. This causes us to crash
-    // in some of the math functions. For now, we disable those optimizations
-    // because Microsoft is not going to fix the problem in VS2013.
-    // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
-    _set_FMA3_enable(0);
-#endif
-
     // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for
     // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the
     // error mode here to work around Cygwin's behavior. See <http://webkit.org/b/55222>.
diff --git a/Tools/DumpRenderTree/win/ImageDiffCairo.cpp b/Tools/DumpRenderTree/win/ImageDiffCairo.cpp
index cf38fbd..3818b2f 100644
--- a/Tools/DumpRenderTree/win/ImageDiffCairo.cpp
+++ b/Tools/DumpRenderTree/win/ImageDiffCairo.cpp
@@ -169,15 +169,6 @@
 int main(int argc, const char* argv[])
 {
 #if PLATFORM(WIN)
-#if defined(_M_X64) || defined(__x86_64__)
-    // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
-    // if the feature has been disabled in firmware. This causes us to crash
-    // in some of the math functions. For now, we disable those optimizations
-    // because Microsoft is not going to fix the problem in VS2013.
-    // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
-    _set_FMA3_enable(0);
-#endif
-
     _setmode(0, _O_BINARY);
     _setmode(1, _O_BINARY);
 #endif
diff --git a/Tools/MiniBrowser/win/Common.cpp b/Tools/MiniBrowser/win/Common.cpp
index f48e458..e6f1413 100644
--- a/Tools/MiniBrowser/win/Common.cpp
+++ b/Tools/MiniBrowser/win/Common.cpp
@@ -159,17 +159,8 @@
 
 BOOL WINAPI DllMain(HINSTANCE dllInstance, DWORD reason, LPVOID)
 {
-    if (reason == DLL_PROCESS_ATTACH) {
-#if defined(_M_X64) || defined(__x86_64__)
-        // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
-        // if the feature has been disabled in firmware. This causes us to crash
-        // in some of the math functions. For now, we disable those optimizations
-        // because Microsoft is not going to fix the problem in VS2013.
-        // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
-        _set_FMA3_enable(0);
-#endif
+    if (reason == DLL_PROCESS_ATTACH)
         hInst = dllInstance;
-    }
 
     return TRUE;
 }
diff --git a/Tools/TestWebKitAPI/win/main.cpp b/Tools/TestWebKitAPI/win/main.cpp
index eaa5c16..ed6efb7 100644
--- a/Tools/TestWebKitAPI/win/main.cpp
+++ b/Tools/TestWebKitAPI/win/main.cpp
@@ -41,15 +41,6 @@
 
 int main(int argc, char** argv)
 {
-#if defined(_M_X64) || defined(__x86_64__)
-    // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
-    // if the feature has been disabled in firmware. This causes us to crash
-    // in some of the math functions. For now, we disable those optimizations
-    // because Microsoft is not going to fix the problem in VS2013.
-    // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
-    _set_FMA3_enable(0);
-#endif
-
     // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for
     // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the
     // error mode here to work around Cygwin's behavior. See <http://webkit.org/b/55222>.
diff --git a/Tools/win/DLLLauncher/DLLLauncherMain.cpp b/Tools/win/DLLLauncher/DLLLauncherMain.cpp
index 1d6d84f..ef158b3 100644
--- a/Tools/win/DLLLauncher/DLLLauncherMain.cpp
+++ b/Tools/win/DLLLauncher/DLLLauncherMain.cpp
@@ -200,15 +200,6 @@
 int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpstrCmdLine, _In_ int nCmdShow)
 #endif
 {
-#if defined(_M_X64) || defined(__x86_64__)
-    // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
-    // if the feature has been disabled in firmware. This causes us to crash
-    // in some of the math functions. For now, we disable those optimizations
-    // because Microsoft is not going to fix the problem in VS2013.
-    // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
-    _set_FMA3_enable(0);
-#endif
-
     if (shouldUseHighDPI()) {
         BOOL didIt = SetProcessDPIAware();
         _ASSERT(didIt);