- Revision
- 225040
- Author
- [email protected]
- Date
- 2017-11-19 17:41:20 -0800 (Sun, 19 Nov 2017)
Log Message
Add CPU(UNKNOWN) to cover all the unknown CPU types
https://bugs.webkit.org/show_bug.cgi?id=179243
Reviewed by JF Bastien.
.:
Drop SH4, S390, and S390X explicit support. They are handled as CPU(UNKNOWN).
* CMakeLists.txt:
Source/_javascript_Core:
* CMakeLists.txt:
Source/WTF:
This patch adds a new CPU type, `CPU(UNKNOWN)` to cover all the unknown CPUs.
This CPU architecture tells conservative assumption to make JSC work on all
the unknown generic CPUs. And we make several CPUs (ALPHA, SH4, S390, S390X, IA64, IA64_32)
UNKNOWN.
We also make InlineASM available only for !CPU(UNKNOWN). In an unknown CPU, inline asm is not useful.
And we also introduce a generic way to detect 64bit pointer environment by using
__SIZEOF_POINTER__ predefined macro, or `UINTPTR_MAX > UINT32_MAX`.
* wtf/InlineASM.h:
* wtf/Platform.h:
* wtf/dtoa/utils.h:
Modified Paths
Diff
Modified: trunk/CMakeLists.txt (225039 => 225040)
--- trunk/CMakeLists.txt 2017-11-20 01:31:57 UTC (rev 225039)
+++ trunk/CMakeLists.txt 2017-11-20 01:41:20 UTC (rev 225040)
@@ -80,12 +80,8 @@
set(WTF_CPU_ARM 1)
elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
set(WTF_CPU_ARM64 1)
-elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "alpha*")
- set(WTF_CPU_ALPHA 1)
elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
set(WTF_CPU_MIPS 1)
-elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "sh4")
- set(WTF_CPU_SH4 1)
elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
set(WTF_CPU_X86_64 1)
elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
@@ -96,14 +92,8 @@
set(WTF_CPU_PPC64 1)
elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
set(WTF_CPU_PPC64LE 1)
-elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "parisc*")
- set(WTF_CPU_HPPA 1)
-elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390")
- set(WTF_CPU_S390 1)
-elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
- set(WTF_CPU_S390X 1)
else ()
- message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'")
+ set(WTF_CPU_UNKNOWN 1)
endif ()
# -----------------------------------------------------------------------------
Modified: trunk/ChangeLog (225039 => 225040)
--- trunk/ChangeLog 2017-11-20 01:31:57 UTC (rev 225039)
+++ trunk/ChangeLog 2017-11-20 01:41:20 UTC (rev 225040)
@@ -1,3 +1,14 @@
+2017-11-19 Yusuke Suzuki <[email protected]>
+
+ Add CPU(UNKNOWN) to cover all the unknown CPU types
+ https://bugs.webkit.org/show_bug.cgi?id=179243
+
+ Reviewed by JF Bastien.
+
+ Drop SH4, S390, and S390X explicit support. They are handled as CPU(UNKNOWN).
+
+ * CMakeLists.txt:
+
2017-11-19 Tim Horton <[email protected]>
Remove unused LEGACY_VENDOR_PREFIXES feature flag
Modified: trunk/Source/_javascript_Core/CMakeLists.txt (225039 => 225040)
--- trunk/Source/_javascript_Core/CMakeLists.txt 2017-11-20 01:31:57 UTC (rev 225039)
+++ trunk/Source/_javascript_Core/CMakeLists.txt 2017-11-20 01:41:20 UTC (rev 225040)
@@ -576,19 +576,7 @@
list(APPEND _javascript_Core_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InjectedScriptSource.h)
-if (WTF_CPU_ARM)
-elseif (WTF_CPU_ARM64)
-elseif (WTF_CPU_ALPHA)
-elseif (WTF_CPU_HPPA)
-elseif (WTF_CPU_PPC)
-elseif (WTF_CPU_PPC64)
-elseif (WTF_CPU_PPC64LE)
-elseif (WTF_CPU_S390)
-elseif (WTF_CPU_S390X)
-elseif (WTF_CPU_MIPS)
-elseif (WTF_CPU_SH4)
-elseif (WTF_CPU_X86)
-elseif (WTF_CPU_X86_64)
+if (WTF_CPU_X86_64)
if (MSVC AND ENABLE_JIT)
add_custom_command(
OUTPUT ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj
@@ -598,8 +586,6 @@
list(APPEND _javascript_Core_SOURCES ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj)
endif ()
-else ()
- message(FATAL_ERROR "Unknown CPU")
endif ()
WEBKIT_FRAMEWORK_DECLARE(_javascript_Core)
Modified: trunk/Source/_javascript_Core/ChangeLog (225039 => 225040)
--- trunk/Source/_javascript_Core/ChangeLog 2017-11-20 01:31:57 UTC (rev 225039)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-11-20 01:41:20 UTC (rev 225040)
@@ -1,3 +1,12 @@
+2017-11-19 Yusuke Suzuki <[email protected]>
+
+ Add CPU(UNKNOWN) to cover all the unknown CPU types
+ https://bugs.webkit.org/show_bug.cgi?id=179243
+
+ Reviewed by JF Bastien.
+
+ * CMakeLists.txt:
+
2017-11-19 Tim Horton <[email protected]>
Remove unused LEGACY_VENDOR_PREFIXES feature flag
Modified: trunk/Source/WTF/ChangeLog (225039 => 225040)
--- trunk/Source/WTF/ChangeLog 2017-11-20 01:31:57 UTC (rev 225039)
+++ trunk/Source/WTF/ChangeLog 2017-11-20 01:41:20 UTC (rev 225040)
@@ -1,3 +1,24 @@
+2017-11-19 Yusuke Suzuki <[email protected]>
+
+ Add CPU(UNKNOWN) to cover all the unknown CPU types
+ https://bugs.webkit.org/show_bug.cgi?id=179243
+
+ Reviewed by JF Bastien.
+
+ This patch adds a new CPU type, `CPU(UNKNOWN)` to cover all the unknown CPUs.
+ This CPU architecture tells conservative assumption to make JSC work on all
+ the unknown generic CPUs. And we make several CPUs (ALPHA, SH4, S390, S390X, IA64, IA64_32)
+ UNKNOWN.
+
+ We also make InlineASM available only for !CPU(UNKNOWN). In an unknown CPU, inline asm is not useful.
+
+ And we also introduce a generic way to detect 64bit pointer environment by using
+ __SIZEOF_POINTER__ predefined macro, or `UINTPTR_MAX > UINT32_MAX`.
+
+ * wtf/InlineASM.h:
+ * wtf/Platform.h:
+ * wtf/dtoa/utils.h:
+
2017-11-19 Tim Horton <[email protected]>
Remove unused LEGACY_VENDOR_PREFIXES feature flag
Modified: trunk/Source/WTF/wtf/InlineASM.h (225039 => 225040)
--- trunk/Source/WTF/wtf/InlineASM.h 2017-11-20 01:31:57 UTC (rev 225039)
+++ trunk/Source/WTF/wtf/InlineASM.h 2017-11-20 01:41:20 UTC (rev 225040)
@@ -25,6 +25,8 @@
#ifndef InlineASM_h
#define InlineASM_h
+#include <wtf/Platform.h>
+#if !CPU(UNKNOWN)
/* asm directive helpers */
@@ -65,7 +67,7 @@
#elif OS(LINUX) \
|| OS(FREEBSD) \
|| OS(OPENBSD) \
- || (OS(HPUX) && CPU(IA64)) \
+ || OS(HPUX) \
|| OS(NETBSD)
// ELF platform
#define HIDE_SYMBOL(name) ".hidden " #name
@@ -94,4 +96,5 @@
#define INLINE_ARM_FUNCTION(name)
#endif
+#endif // !CPU(UNKNOWN)
#endif // InlineASM_h
Modified: trunk/Source/WTF/wtf/Platform.h (225039 => 225040)
--- trunk/Source/WTF/wtf/Platform.h 2017-11-20 01:31:57 UTC (rev 225039)
+++ trunk/Source/WTF/wtf/Platform.h 2017-11-20 01:41:20 UTC (rev 225040)
@@ -57,26 +57,8 @@
/* ==== CPU() - the target CPU architecture ==== */
+/* CPU(KNOWN) becomes true if we explicitly support a target CPU. */
-/* CPU(ALPHA) - DEC Alpha */
-#if defined(__alpha__)
-#define WTF_CPU_ALPHA 1
-#endif
-
-/* CPU(HPPA) - HP PA-RISC */
-#if defined(__hppa__) || defined(__hppa64__)
-#define WTF_CPU_HPPA 1
-#endif
-
-/* CPU(IA64) - Itanium / IA-64 */
-#if defined(__ia64__)
-#define WTF_CPU_IA64 1
-/* 32-bit mode on Itanium */
-#if !defined(__LP64__)
-#define WTF_CPU_IA64_32 1
-#endif
-#endif
-
/* CPU(MIPS) - MIPS 32-bit and 64-bit */
#if (defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_) || defined(__mips64))
#if defined(_ABI64) && (_MIPS_SIM == _ABI64)
@@ -86,6 +68,7 @@
#define WTF_CPU_MIPS 1
#define WTF_MIPS_ARCH __mips
#endif
+#define WTF_CPU_KNOWN 1
#define WTF_MIPS_PIC (defined __PIC__)
#define WTF_MIPS_ISA(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH == v)
#define WTF_MIPS_ISA_AT_LEAST(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH >= v)
@@ -103,6 +86,7 @@
&& defined(__BYTE_ORDER__) \
&& (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#define WTF_CPU_PPC64 1
+#define WTF_CPU_KNOWN 1
#endif
/* CPU(PPC64) - PowerPC 64-bit Little Endian */
@@ -113,6 +97,7 @@
&& defined(__BYTE_ORDER__) \
&& (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define WTF_CPU_PPC64LE 1
+#define WTF_CPU_KNOWN 1
#endif
/* CPU(PPC) - PowerPC 32-bit */
@@ -126,24 +111,9 @@
&& !CPU(PPC64) \
&& CPU(BIG_ENDIAN)
#define WTF_CPU_PPC 1
+#define WTF_CPU_KNOWN 1
#endif
-/* CPU(SH4) - SuperH SH-4 */
-#if defined(__SH4__)
-#define WTF_CPU_SH4 1
-#endif
-
-/* CPU(S390X) - S390 64-bit */
-#if defined(__s390x__)
-#define WTF_CPU_S390X 1
-#endif
-
-/* CPU(S390) - S390 32-bit */
-#if ( defined(__s390__) \
- && !CPU(S390X))
-#define WTF_CPU_S390 1
-#endif
-
/* CPU(X86) - i386 / x86 32-bit */
#if defined(__i386__) \
|| defined(i386) \
@@ -151,6 +121,7 @@
|| defined(_X86_) \
|| defined(__THW_INTEL)
#define WTF_CPU_X86 1
+#define WTF_CPU_KNOWN 1
#if defined(__SSE2__) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
#define WTF_CPU_X86_SSE2 1
@@ -163,11 +134,13 @@
|| defined(_M_X64)
#define WTF_CPU_X86_64 1
#define WTF_CPU_X86_SSE2 1
+#define WTF_CPU_KNOWN 1
#endif
/* CPU(ARM64) - Apple */
#if (defined(__arm64__) && defined(__APPLE__)) || defined(__aarch64__)
#define WTF_CPU_ARM64 1
+#define WTF_CPU_KNOWN 1
#if defined(__arm64e__)
#define WTF_CPU_ARM64E 1
@@ -182,6 +155,7 @@
|| defined(ARM) \
|| defined(_ARM_)
#define WTF_CPU_ARM 1
+#define WTF_CPU_KNOWN 1
#if defined(__ARM_PCS_VFP)
#define WTF_CPU_ARM_HARDFP 1
@@ -344,7 +318,11 @@
#endif /* ARM */
-#if CPU(ARM) || CPU(MIPS) || CPU(SH4) || CPU(ALPHA) || CPU(HPPA)
+#if !CPU(KNOWN)
+#define WTF_CPU_UNKNOWN 1
+#endif
+
+#if CPU(ARM) || CPU(MIPS) || CPU(UNKNOWN)
#define WTF_CPU_NEEDS_ALIGNED_ACCESS 1
#endif
@@ -737,18 +715,31 @@
#endif
#if !defined(USE_JSVALUE64) && !defined(USE_JSVALUE32_64)
-#if (CPU(X86_64) && !defined(__ILP32__) && (OS(UNIX) || OS(WINDOWS))) \
- || (CPU(IA64) && !CPU(IA64_32)) \
- || CPU(ALPHA) \
- || (CPU(ARM64) && !defined(__ILP32__)) \
- || CPU(S390X) \
- || CPU(MIPS64) \
- || CPU(PPC64) \
- || CPU(PPC64LE)
+#if COMPILER(GCC_OR_CLANG)
+/* __LP64__ is not defined on 64bit Windows since it uses LLP64. Using __SIZEOF_POINTER__ is simpler. */
+#if __SIZEOF_POINTER__ == 8
#define USE_JSVALUE64 1
+#elif __SIZEOF_POINTER__ == 4
+#define USE_JSVALUE32_64 1
#else
+#error "Unsupported pointer width"
+#endif
+#elif COMPILER(MSVC)
+#if defined(_WIN64)
+#define USE_JSVALUE64 1
+#else
#define USE_JSVALUE32_64 1
#endif
+#else
+/* This is the most generic way. But in OS(DARWIN), Platform.h can be included by sandbox definition file (.sb).
+ * At that time, we cannot include "stdint.h" header. So in the case of known compilers, we use predefined constants instead. */
+#include <stdint.h>
+#if UINTPTR_MAX > UINT32_MAX
+#define USE_JSVALUE64 1
+#else
+#define USE_JSVALUE32_64 1
+#endif
+#endif
#endif /* !defined(USE_JSVALUE64) && !defined(USE_JSVALUE32_64) */
/* The JIT is enabled by default on all x86, x86-64, ARM & MIPS platforms except ARMv7k. */
Modified: trunk/Source/WTF/wtf/dtoa/utils.h (225039 => 225040)
--- trunk/Source/WTF/wtf/dtoa/utils.h 2017-11-20 01:31:57 UTC (rev 225039)
+++ trunk/Source/WTF/wtf/dtoa/utils.h 2017-11-20 01:41:20 UTC (rev 225040)
@@ -49,7 +49,7 @@
defined(__ARMEL__) || \
defined(_MIPS_ARCH_MIPS32R2)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
-#elif CPU(MIPS) || CPU(MIPS64) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(SH4) || CPU(S390) || CPU(S390X) || CPU(IA64) || CPU(ALPHA) || CPU(ARM64) || CPU(HPPA)
+#elif CPU(MIPS) || CPU(MIPS64) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(ARM64)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(_M_IX86) || defined(__i386__)
#if defined(_WIN32)
@@ -59,7 +59,8 @@
#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
#endif // _WIN32
#else
-#error Target architecture was not detected as supported by Double-Conversion.
+// Conservatively disable double conversion for unknown architectures.
+#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
#endif