JavaScriptCore: Disable 32-bit JIT on Windows
https://bugs.webkit.org/show_bug.cgi?id=185989

Reviewed by Mark Lam.

.:

* Source/cmake/OptionsWin.cmake:

Source/JavaScriptCore:

Fixed the CLOOP so it can work when COMPUTED_GOTOs are not supported.

* llint/LLIntData.h:
(JSC::LLInt::getCodePtr): Used a reinterpret_cast since Opcode could be an int.
* llint/LowLevelInterpreter.cpp: Changed the definition of OFFLINE_ASM_GLOBAL_LABEL to not
have a case label because these aren't opcodes.
* runtime/Options.cpp: Made assembler related Windows conditional code also conditional
on the JIT being enabled.
(JSC::recomputeDependentOptions):

Source/WTF:

Fixed the CLOOP so it can work when COMPUTED_GOTOs are not supported.

* wtf/Platform.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@232719 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/ChangeLog b/ChangeLog
index f4a6e7d..4f5dd5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2018-06-11  Michael Saboff  <msaboff@apple.com>
+
+        JavaScriptCore: Disable 32-bit JIT on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=185989
+
+        Reviewed by Mark Lam.
+
+        * Source/cmake/OptionsWin.cmake:
+
 2018-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [WPE] Add a MiniBrowser and use it to run WebDriver tests
diff --git a/LayoutTests/js/script-tests/regexp-zero-length-alternatives.js b/LayoutTests/js/script-tests/regexp-zero-length-alternatives.js
index ea86cbe..ed03ce1 100644
--- a/LayoutTests/js/script-tests/regexp-zero-length-alternatives.js
+++ b/LayoutTests/js/script-tests/regexp-zero-length-alternatives.js
@@ -229,6 +229,7 @@
 shouldBe('s4.match(re31)', '["abab"]');
 
 // Non-capturing two possibly empty non-greedy alternatives non-greedy '*'
+//var re32 = new RegExp(/(?:a*?|b*?)*/);
 var re32 = new RegExp(/(?:a*?|b*?)*/);
 shouldBe('emptyStr.match(re32)', '[""]');
 shouldBe('s1.match(re32)', '[""]');
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 72c2d9a..f155176 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,5 +1,22 @@
 2018-06-11  Michael Saboff  <msaboff@apple.com>
 
+        JavaScriptCore: Disable 32-bit JIT on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=185989
+
+        Reviewed by Mark Lam.
+
+        Fixed the CLOOP so it can work when COMPUTED_GOTOs are not supported.
+
+        * llint/LLIntData.h:
+        (JSC::LLInt::getCodePtr): Used a reinterpret_cast since Opcode could be an int.
+        * llint/LowLevelInterpreter.cpp: Changed the definition of OFFLINE_ASM_GLOBAL_LABEL to not
+        have a case label because these aren't opcodes.
+        * runtime/Options.cpp: Made assembler related Windows conditional code also conditional
+        on the JIT being enabled.
+        (JSC::recomputeDependentOptions):
+
+2018-06-11  Michael Saboff  <msaboff@apple.com>
+
         Test js/regexp-zero-length-alternatives.html fails when RegExpJIT is disabled
         https://bugs.webkit.org/show_bug.cgi?id=186477
 
diff --git a/Source/JavaScriptCore/llint/LLIntData.h b/Source/JavaScriptCore/llint/LLIntData.h
index e2db45d..be58c00 100644
--- a/Source/JavaScriptCore/llint/LLIntData.h
+++ b/Source/JavaScriptCore/llint/LLIntData.h
@@ -83,7 +83,7 @@
 template<PtrTag tag>
 ALWAYS_INLINE MacroAssemblerCodePtr<tag> getCodePtr(OpcodeID opcodeID)
 {
-    void* address = getOpcode(opcodeID);
+    void* address = reinterpret_cast<void*>(getOpcode(opcodeID));
     address = retagCodePtr<BytecodePtrTag, tag>(address);
     return MacroAssemblerCodePtr<tag>::createFromExecutableAddress(address);
 }
diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp b/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp
index 51c84e8..78bff08 100644
--- a/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp
+++ b/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp
@@ -106,7 +106,7 @@
 
 #define OFFLINE_ASM_OPCODE_LABEL(opcode) DEFINE_OPCODE(opcode) USE_LABEL(opcode); TRACE_OPCODE(opcode);
 
-#define OFFLINE_ASM_GLOBAL_LABEL(label)  OFFLINE_ASM_GLUE_LABEL(label)
+#define OFFLINE_ASM_GLOBAL_LABEL(label)  label: USE_LABEL(label);
 
 #if ENABLE(COMPUTED_GOTO_OPCODES)
 #define OFFLINE_ASM_GLUE_LABEL(label)  label: USE_LABEL(label);
diff --git a/Source/JavaScriptCore/runtime/Options.cpp b/Source/JavaScriptCore/runtime/Options.cpp
index 8628e80..ad234df 100644
--- a/Source/JavaScriptCore/runtime/Options.cpp
+++ b/Source/JavaScriptCore/runtime/Options.cpp
@@ -48,7 +48,7 @@
 #include <crt_externs.h>
 #endif
 
-#if OS(WINDOWS)
+#if OS(WINDOWS) && ENABLE(JIT)
 #include "MacroAssembler.h"
 #endif
 
@@ -392,7 +392,7 @@
     Options::useConcurrentGC() = false;
 #endif
     
-#if OS(WINDOWS) && CPU(X86) 
+#if OS(WINDOWS) && ENABLE(JIT) && CPU(X86) 
     // Disable JIT on Windows if SSE2 is not present 
     if (!MacroAssemblerX86::supportsFloatingPoint())
         Options::useJIT() = false;
diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog
index b92d071..43a7f59 100644
--- a/Source/WTF/ChangeLog
+++ b/Source/WTF/ChangeLog
@@ -1,3 +1,14 @@
+2018-06-11  Michael Saboff  <msaboff@apple.com>
+
+        JavaScriptCore: Disable 32-bit JIT on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=185989
+
+        Reviewed by Mark Lam.
+
+        Fixed the CLOOP so it can work when COMPUTED_GOTOs are not supported.
+
+        * wtf/Platform.h:
+
 2018-06-09  Dan Bernstein  <mitz@apple.com>
 
         [Xcode] Clean up and modernize some build setting definitions
diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
index 82db784..0281771 100644
--- a/Source/WTF/wtf/Platform.h
+++ b/Source/WTF/wtf/Platform.h
@@ -732,6 +732,12 @@
 #define ENABLE_JIT 0
 #endif
 
+/* Disable the JIT for 32-bit Windows builds. */
+#if USE(JSVALUE32_64) && OS(WINDOWS)
+#undef ENABLE_JIT
+#define ENABLE_JIT 0
+#endif
+
 /* The FTL *does not* work on 32-bit platforms. Disable it even if someone asked us to enable it. */
 #if USE(JSVALUE32_64)
 #undef ENABLE_FTL_JIT
diff --git a/Source/cmake/OptionsWin.cmake b/Source/cmake/OptionsWin.cmake
index 88f2f4f..a604d98 100644
--- a/Source/cmake/OptionsWin.cmake
+++ b/Source/cmake/OptionsWin.cmake
@@ -45,6 +45,9 @@
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_MONTH PUBLIC OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_TIME PUBLIC OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_WEEK PUBLIC OFF)
+if (${WTF_CPU_X86})
+    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_JIT PUBLIC OFF)
+endif ()
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_CSS_VENDOR_PREFIXES PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MATHML PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_CONTROLS_SCRIPT PUBLIC ON)