Fix build on ARM in ARM mode (instead of thumb2)
authorSimon Hausmann <simon.hausmann@digia.com>
Wed, 16 Oct 2013 15:18:29 +0000 (17:18 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 17 Oct 2013 09:36:32 +0000 (11:36 +0200)
We don't support the traditional ARM assembler (yet), only JIT on thumb2.  In
order for us to reliably check that, we have to wait until the pre-processor
runs, which this patch achieves by moving all JIT enable/disable decisions into
qv4global_p.h

Change-Id: I7eff5b4fbf1cd26297a08dee16984ad867358113
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/3rdparty/masm/masm-defs.pri
src/3rdparty/masm/masm.pri
src/3rdparty/masm/wtf/Platform.h
src/qml/compiler/compiler.pri
src/qml/compiler/qv4isel_masm.cpp
src/qml/compiler/qv4isel_masm_p.h
src/qml/jsruntime/qv4global_p.h

index aa6acc9..cc97440 100644 (file)
@@ -1,19 +1,5 @@
 
 
-wince*: CONFIG += disable_jit
-ios: CONFIG += disable_jit
-if(win*:isEqual(QT_ARCH, "x86_64")): CONFIG += disable_jit
-equals(ANDROID_TARGET_ARCH, armeabi): CONFIG += disable_jit
-
-disable_jit: DEFINES += ENABLE_YARR_JIT=0
-else: DEFINES += V4_ENABLE_JIT ENABLE_YARR_JIT=1
-
-# On Qt/Android/ARM release builds are thumb and debug builds arm,
-# but we'll force the JIT to always generate thumb2
-contains(DEFINES, V4_ENABLE_JIT):android:isEqual(QT_ARCH, "arm") {
-    DEFINES += WTF_CPU_ARM_THUMB2
-}
-
 DEFINES += WTF_EXPORT_PRIVATE="" JS_EXPORT_PRIVATE=""
 
 win*: DEFINES += NOMINMAX
@@ -22,11 +8,8 @@ DEFINES += ENABLE_LLINT=0
 DEFINES += ENABLE_DFG_JIT=0
 DEFINES += ENABLE_DFG_JIT_UTILITY_METHODS=1
 DEFINES += ENABLE_JIT_CONSTANT_BLINDING=0
-DEFINES += ENABLE_ASSEMBLER=1
 DEFINES += BUILDING_QT__
 
-DEFINES += ENABLE_JIT=1
-
 INCLUDEPATH += $$PWD/jit
 INCLUDEPATH += $$PWD/assembler
 INCLUDEPATH += $$PWD/runtime
index 63537f2..d7b3156 100644 (file)
@@ -1,11 +1,6 @@
-contains(DEFINES, V4_ENABLE_JIT) {
-    HEADERS += $$PWD/assembler/*.h
-    SOURCES += $$PWD/assembler/ARMAssembler.cpp
-    SOURCES += $$PWD/assembler/ARMv7Assembler.cpp
-    SOURCES += $$PWD/assembler/MacroAssemblerARM.cpp
-    SOURCES += $$PWD/assembler/MacroAssemblerSH4.cpp
-    SOURCES += $$PWD/assembler/LinkBuffer.cpp
-}
+HEADERS += $$PWD/assembler/*.h
+SOURCES += $$PWD/assembler/ARMv7Assembler.cpp
+SOURCES += $$PWD/assembler/LinkBuffer.cpp
 
 HEADERS += $$PWD/wtf/*.h
 SOURCES += $$PWD/wtf/PrintStream.cpp
index b8402a9..c81a9fe 100644 (file)
 #ifndef WTF_Platform_h
 #define WTF_Platform_h
 
+#if defined(__cplusplus)
+#include <private/qv4global_p.h>
+#endif
+
 /* Include compiler specific macros */
 #include <wtf/Compiler.h>
 
 #endif
 
 /* If the jit is not available, enable the LLInt C Loop: */
-#if !ENABLE(JIT)
+/* Not for Qml. We have our own interpreter. */
+#if 0 /* !ENABLE(JIT) */
 #undef ENABLE_LLINT        /* Undef so that we can redefine it. */
 #undef ENABLE_LLINT_C_LOOP /* Undef so that we can redefine it. */
 #undef ENABLE_DFG_JIT      /* Undef so that we can redefine it. */
 
 /* Do a sanity check to make sure that we at least have one execution engine in
    use: */
-#if !(ENABLE(JIT) || ENABLE(LLINT))
+#if 0 /* !(ENABLE(JIT) || ENABLE(LLINT)) */
 #error You have to have at least one execution model enabled to build JSC
 #endif
 
index 3a1af30..df4f5e8 100644 (file)
@@ -14,7 +14,8 @@ HEADERS += \
     $$PWD/qv4isel_util_p.h \
     $$PWD/qv4ssa_p.h \
     $$PWD/qv4regalloc_p.h \
-    $$PWD/qqmlcodegenerator_p.h
+    $$PWD/qqmlcodegenerator_p.h \
+    $$PWD/qv4isel_masm_p.h
 
 SOURCES += \
     $$PWD/qv4compileddata.cpp \
@@ -26,11 +27,7 @@ SOURCES += \
     $$PWD/qv4jsir.cpp \
     $$PWD/qv4ssa.cpp \
     $$PWD/qv4regalloc.cpp \
-    $$PWD/qqmlcodegenerator.cpp
-
-contains(DEFINES, V4_ENABLE_JIT) {
-    HEADERS += $$PWD/qv4isel_masm_p.h
-    SOURCES += $$PWD/qv4isel_masm.cpp
-}
+    $$PWD/qqmlcodegenerator.cpp \
+    $$PWD/qv4isel_masm.cpp
 
 include(../../3rdparty/masm/masm.pri)
index 1155322..888d11a 100644 (file)
@@ -56,6 +56,8 @@
 #include <iostream>
 #include <cassert>
 
+#if ENABLE(ASSEMBLER)
+
 #if USE(UDIS86)
 #  include <udis86.h>
 #endif
@@ -2566,3 +2568,5 @@ bool InstructionSelection::int32Binop(V4IR::AluOp oper, V4IR::Expr *leftSource,
         return false;
     }
 }
+
+#endif // ENABLE(ASSEMBLER)
index 02ddd15..bd4c564 100644 (file)
@@ -51,6 +51,9 @@
 #include <QtCore/QHash>
 #include <config.h>
 #include <wtf/Vector.h>
+
+#if ENABLE(ASSEMBLER)
+
 #include <assembler/MacroAssembler.h>
 #include <assembler/MacroAssemblerCodeRef.h>
 
@@ -1606,4 +1609,6 @@ public:
 
 QT_END_NAMESPACE
 
+#endif // ENABLE(ASSEMBLER)
+
 #endif // QV4ISEL_MASM_P_H
index 3569247..2050ccd 100644 (file)
@@ -64,6 +64,37 @@ inline double trunc(double d) { return d > 0 ? floor(d) : ceil(d); }
 
 #define qOffsetOf(s, m) ((size_t)((((char *)&(((s *)64)->m)) - 64)))
 
+// Decide whether to enable or disable the JIT
+
+// White list architectures
+
+#if defined(Q_PROCESSOR_X86)
+#define V4_ENABLE_JIT
+#elif defined(Q_PROCESSOR_X86_64)
+#define V4_ENABLE_JIT
+#elif defined(Q_PROCESSOR_ARM_32) && __TARGET_ARCH_THUMB-0 == 4
+#define V4_ENABLE_JIT
+#endif
+
+// Black list some platforms
+#if defined(V4_ENABLE_JIT)
+#if defined(Q_OS_WINCE) || defined(Q_OS_IOS) || defined(Q_OS_WIN64)
+    #undef V4_ENABLE_JIT
+#endif
+#endif
+
+// Do certain things depending on whether the JIT is enabled or disabled
+
+#ifdef V4_ENABLE_JIT
+#define ENABLE_YARR_JIT 1
+#define ENABLE_JIT 1
+#define ENABLE_ASSEMBLER 1
+#else
+#define ENABLE_YARR_JIT 0
+#define ENABLE_ASSEMBLER 0
+#define ENABLE_JIT 0
+#endif
+
 #if defined(Q_OS_QNX)
 #include <math.h>
 #undef isnan