Commit 32aaad09 authored by barraclough@apple.com's avatar barraclough@apple.com

2009-09-18 Gabor Loki <loki@inf.u-szeged.hu>

        Reviewed by Gavin Barraclough.

        Defines two pseudo-platforms for ARM and Thumb-2 instruction set.
        https://bugs.webkit.org/show_bug.cgi?id=29122

        Introduces WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2
        macros on ARM platforms. The PLATFORM(ARM_THUMB2) should be used
        when Thumb-2 instruction set is the required target. The
        PLATFORM(ARM_TRADITIONAL) is for generic ARM instruction set. In
        case where the code is common the PLATFORM(ARM) have to be used.

        * assembler/ARMAssembler.cpp:
        * assembler/ARMAssembler.h:
        * assembler/ARMv7Assembler.h:
        * assembler/MacroAssembler.h:
        * assembler/MacroAssemblerARM.cpp:
        * assembler/MacroAssemblerARM.h:
        * assembler/MacroAssemblerCodeRef.h:
        (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr):
        * jit/ExecutableAllocator.h:
        * jit/JIT.h:
        * jit/JITInlineMethods.h:
        (JSC::JIT::beginUninterruptedSequence):
        (JSC::JIT::preserveReturnAddressAfterCall):
        (JSC::JIT::restoreReturnAddressBeforeReturn):
        (JSC::JIT::restoreArgumentReference):
        (JSC::JIT::restoreArgumentReferenceForTrampoline):
        * jit/JITOpcodes.cpp:
        * jit/JITStubs.cpp:
        (JSC::JITThunks::JITThunks):
        * jit/JITStubs.h:
        * wtf/Platform.h:
        * yarr/RegexJIT.cpp:
        (JSC::Yarr::RegexGenerator::generateEnter):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48525 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3c99a321
2009-09-18 Gabor Loki <loki@inf.u-szeged.hu>
Reviewed by Gavin Barraclough.
Defines two pseudo-platforms for ARM and Thumb-2 instruction set.
https://bugs.webkit.org/show_bug.cgi?id=29122
Introduces WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2
macros on ARM platforms. The PLATFORM(ARM_THUMB2) should be used
when Thumb-2 instruction set is the required target. The
PLATFORM(ARM_TRADITIONAL) is for generic ARM instruction set. In
case where the code is common the PLATFORM(ARM) have to be used.
* assembler/ARMAssembler.cpp:
* assembler/ARMAssembler.h:
* assembler/ARMv7Assembler.h:
* assembler/MacroAssembler.h:
* assembler/MacroAssemblerARM.cpp:
* assembler/MacroAssemblerARM.h:
* assembler/MacroAssemblerCodeRef.h:
(JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr):
* jit/ExecutableAllocator.h:
* jit/JIT.h:
* jit/JITInlineMethods.h:
(JSC::JIT::beginUninterruptedSequence):
(JSC::JIT::preserveReturnAddressAfterCall):
(JSC::JIT::restoreReturnAddressBeforeReturn):
(JSC::JIT::restoreArgumentReference):
(JSC::JIT::restoreArgumentReferenceForTrampoline):
* jit/JITOpcodes.cpp:
* jit/JITStubs.cpp:
(JSC::JITThunks::JITThunks):
* jit/JITStubs.h:
* wtf/Platform.h:
* yarr/RegexJIT.cpp:
(JSC::Yarr::RegexGenerator::generateEnter):
2009-09-18 Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed by Simon Hausmann.
......
......@@ -26,7 +26,7 @@
#include "config.h"
#if ENABLE(ASSEMBLER) && PLATFORM(ARM)
#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
#include "ARMAssembler.h"
......@@ -390,4 +390,4 @@ void* ARMAssembler::executableCopy(ExecutablePool* allocator)
} // namespace JSC
#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM)
#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
......@@ -29,7 +29,7 @@
#include <wtf/Platform.h>
#if ENABLE(ASSEMBLER) && PLATFORM(ARM)
#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
#include "AssemblerBufferWithConstantPool.h"
#include <wtf/Assertions.h>
......@@ -764,6 +764,6 @@ namespace JSC {
} // namespace JSC
#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM)
#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
#endif // ARMAssembler_h
......@@ -28,7 +28,7 @@
#include <wtf/Platform.h>
#if ENABLE(ASSEMBLER) && PLATFORM_ARM_ARCH(7)
#if ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2)
#include "AssemblerBuffer.h"
#include <wtf/Assertions.h>
......@@ -1753,6 +1753,6 @@ private:
} // namespace JSC
#endif // ENABLE(ASSEMBLER) && PLATFORM_ARM_ARCH(7)
#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2)
#endif // ARMAssembler_h
......@@ -30,11 +30,11 @@
#if ENABLE(ASSEMBLER)
#if PLATFORM_ARM_ARCH(7)
#if PLATFORM(ARM_THUMB2)
#include "MacroAssemblerARMv7.h"
namespace JSC { typedef MacroAssemblerARMv7 MacroAssemblerBase; };
#elif PLATFORM(ARM)
#elif PLATFORM(ARM_TRADITIONAL)
#include "MacroAssemblerARM.h"
namespace JSC { typedef MacroAssemblerARM MacroAssemblerBase; };
......
......@@ -26,7 +26,7 @@
#include "config.h"
#if ENABLE(ASSEMBLER) && PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)
#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
#include "MacroAssemblerARM.h"
......@@ -64,4 +64,4 @@ const bool MacroAssemblerARM::s_isVFPPresent = isVFPPresent();
}
#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)
#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
......@@ -30,7 +30,7 @@
#include <wtf/Platform.h>
#if ENABLE(ASSEMBLER) && PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)
#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
#include "ARMAssembler.h"
#include "AbstractMacroAssembler.h"
......@@ -797,6 +797,6 @@ private:
}
#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)
#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
#endif // MacroAssemblerARM_h
......@@ -37,7 +37,7 @@
// ASSERT_VALID_CODE_POINTER checks that ptr is a non-null pointer, and that it is a valid
// instruction address on the platform (for example, check any alignment requirements).
#if PLATFORM_ARM_ARCH(7)
#if PLATFORM(ARM_THUMB2)
// ARM/thumb instructions must be 16-bit aligned, but all code pointers to be loaded
// into the processor are decorated with the bottom bit set, indicating that this is
// thumb code (as oposed to 32-bit traditional ARM). The first test checks for both
......@@ -124,7 +124,7 @@ public:
}
explicit MacroAssemblerCodePtr(void* value)
#if PLATFORM_ARM_ARCH(7)
#if PLATFORM(ARM_THUMB2)
// Decorate the pointer as a thumb code pointer.
: m_value(reinterpret_cast<char*>(value) + 1)
#else
......@@ -141,7 +141,7 @@ public:
}
void* executableAddress() const { return m_value; }
#if PLATFORM_ARM_ARCH(7)
#if PLATFORM(ARM_THUMB2)
// To use this pointer as a data address remove the decoration.
void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return reinterpret_cast<char*>(m_value) - 1; }
#else
......
......@@ -180,7 +180,7 @@ public:
static void cacheFlush(void*, size_t)
{
}
#elif PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE)
#elif PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE)
static void cacheFlush(void* code, size_t size)
{
sys_dcache_flush(code, size);
......@@ -191,7 +191,7 @@ public:
{
User::IMB_Range(code, static_cast<char*>(code) + size);
}
#elif PLATFORM(ARM)
#elif PLATFORM(ARM_TRADITIONAL)
static void cacheFlush(void* code, size_t size)
{
#if COMPILER(GCC) && (GCC_VERSION >= 30406)
......
......@@ -226,7 +226,7 @@ namespace JSC {
static const FPRegisterID fpRegT0 = X86Registers::xmm0;
static const FPRegisterID fpRegT1 = X86Registers::xmm1;
static const FPRegisterID fpRegT2 = X86Registers::xmm2;
#elif PLATFORM_ARM_ARCH(7)
#elif PLATFORM(ARM_THUMB2)
static const RegisterID returnValueRegister = ARMRegisters::r0;
static const RegisterID cachedResultRegister = ARMRegisters::r0;
static const RegisterID firstArgumentRegister = ARMRegisters::r0;
......@@ -242,7 +242,7 @@ namespace JSC {
static const FPRegisterID fpRegT0 = ARMRegisters::d0;
static const FPRegisterID fpRegT1 = ARMRegisters::d1;
static const FPRegisterID fpRegT2 = ARMRegisters::d2;
#elif PLATFORM(ARM)
#elif PLATFORM(ARM_TRADITIONAL)
static const RegisterID returnValueRegister = ARMRegisters::r0;
static const RegisterID cachedResultRegister = ARMRegisters::r0;
static const RegisterID firstArgumentRegister = ARMRegisters::r0;
......@@ -571,7 +571,7 @@ namespace JSC {
static const int patchOffsetMethodCheckProtoObj = 11;
static const int patchOffsetMethodCheckProtoStruct = 18;
static const int patchOffsetMethodCheckPutFunction = 29;
#elif PLATFORM_ARM_ARCH(7)
#elif PLATFORM(ARM_THUMB2)
// These architecture specific value are used to enable patching - see comment on op_put_by_id.
static const int patchOffsetPutByIdStructure = 10;
static const int patchOffsetPutByIdExternalLoad = 20;
......@@ -594,7 +594,7 @@ namespace JSC {
static const int patchOffsetMethodCheckProtoObj = 18;
static const int patchOffsetMethodCheckProtoStruct = 28;
static const int patchOffsetMethodCheckPutFunction = 46;
#elif PLATFORM(ARM)
#elif PLATFORM(ARM_TRADITIONAL)
// These architecture specific value are used to enable patching - see comment on op_put_by_id.
static const int patchOffsetPutByIdStructure = 4;
static const int patchOffsetPutByIdExternalLoad = 16;
......@@ -620,7 +620,7 @@ namespace JSC {
#endif
#endif // USE(JSVALUE32_64)
#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)
#if PLATFORM(ARM_TRADITIONAL)
// sequenceOpCall
static const int sequenceOpCallInstructionSpace = 12;
static const int sequenceOpCallConstantSpace = 2;
......
......@@ -110,7 +110,7 @@ ALWAYS_INLINE JIT::Call JIT::emitNakedCall(CodePtr function)
ALWAYS_INLINE void JIT::beginUninterruptedSequence(int insnSpace, int constSpace)
{
#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)
#if PLATFORM(ARM_TRADITIONAL)
#ifndef NDEBUG
// Ensure the label after the sequence can also fit
insnSpace += sizeof(ARMWord);
......@@ -139,38 +139,38 @@ ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace)
#endif
#if PLATFORM(X86) || PLATFORM(X86_64) || (PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7))
#if PLATFORM(ARM_THUMB2)
ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg)
{
pop(reg);
move(linkRegister, reg);
}
ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg)
{
push(reg);
move(reg, linkRegister);
}
ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address)
{
push(address);
loadPtr(address, linkRegister);
}
#elif PLATFORM_ARM_ARCH(7)
#else // PLATFORM(X86) || PLATFORM(X86_64) || PLATFORM(ARM_TRADITIONAL)
ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg)
{
move(linkRegister, reg);
pop(reg);
}
ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg)
{
move(reg, linkRegister);
push(reg);
}
ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address)
{
loadPtr(address, linkRegister);
push(address);
}
#endif
......@@ -186,7 +186,7 @@ ALWAYS_INLINE void JIT::restoreArgumentReference()
{
move(stackPointerRegister, firstArgumentRegister);
poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*));
#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)
#if PLATFORM(ARM_TRADITIONAL)
move(ctiReturnRegister, ARMRegisters::lr);
#endif
}
......@@ -195,7 +195,7 @@ ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline()
#if PLATFORM(X86)
// Within a trampoline the return address will be on the stack at this point.
addPtr(Imm32(sizeof(void*)), stackPointerRegister, firstArgumentRegister);
#elif PLATFORM_ARM_ARCH(7)
#elif PLATFORM(ARM_THUMB2)
move(stackPointerRegister, firstArgumentRegister);
#endif
// In the trampoline on x86-64, the first argument register is not overwritten.
......
......@@ -1681,7 +1681,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// so pull them off now
addPtr(Imm32(NativeCallFrameSize - sizeof(NativeFunctionCalleeSignature)), stackPointerRegister);
#elif PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)
#elif PLATFORM(ARM_TRADITIONAL)
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
// Allocate stack space for our arglist
......
......@@ -193,7 +193,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"ret" "\n"
);
#elif COMPILER(GCC) && PLATFORM_ARM_ARCH(7)
#elif COMPILER(GCC) && PLATFORM(ARM_THUMB2)
#if USE(JIT_STUB_ARGUMENT_VA_LIST)
#error "JIT_STUB_ARGUMENT_VA_LIST not supported on ARMv7."
......@@ -452,7 +452,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"ret" "\n"
);
#elif COMPILER(GCC) && PLATFORM_ARM_ARCH(7)
#elif COMPILER(GCC) && PLATFORM(ARM_THUMB2)
#if USE(JIT_STUB_ARGUMENT_VA_LIST)
#error "JIT_STUB_ARGUMENT_VA_LIST not supported on ARMv7."
......@@ -516,7 +516,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"bx lr" "\n"
);
#elif COMPILER(GCC) && PLATFORM(ARM)
#elif COMPILER(GCC) && PLATFORM(ARM_TRADITIONAL)
asm volatile (
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
......@@ -636,7 +636,7 @@ JITThunks::JITThunks(JSGlobalData* globalData)
{
JIT::compileCTIMachineTrampolines(globalData, &m_executablePool, &m_ctiStringLengthTrampoline, &m_ctiVirtualCallLink, &m_ctiVirtualCall, &m_ctiNativeCallThunk);
#if PLATFORM_ARM_ARCH(7)
#if PLATFORM(ARM_THUMB2)
// Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it contains non POD types),
// and the OBJECT_OFFSETOF macro does not appear constantish enough for it to be happy with its use in COMPILE_ASSERT
// macros.
......@@ -876,7 +876,7 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD
} \
} while (0)
#if PLATFORM_ARM_ARCH(7)
#if PLATFORM(ARM_THUMB2)
#define DEFINE_STUB_FUNCTION(rtype, op) \
extern "C" { \
......
......@@ -129,7 +129,7 @@ namespace JSC {
#if COMPILER(MSVC)
#pragma pack(pop)
#endif // COMPILER(MSVC)
#elif PLATFORM_ARM_ARCH(7)
#elif PLATFORM(ARM_THUMB2)
struct JITStackFrame {
void* reserved; // Unused
JITStubArg args[6];
......@@ -155,7 +155,7 @@ namespace JSC {
ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; }
};
#elif PLATFORM(ARM)
#elif PLATFORM(ARM_TRADITIONAL)
struct JITStackFrame {
JITStubArg padding; // Unused
JITStubArg args[7];
......
......@@ -226,6 +226,8 @@
#endif
/* PLATFORM(ARM) */
#define PLATFORM_ARM_ARCH(N) (PLATFORM(ARM) && ARM_ARCH_VERSION >= N)
#if defined(arm) \
|| defined(__arm__)
#define WTF_PLATFORM_ARM 1
......@@ -255,8 +257,21 @@
#undef ARM_ARCH_VERSION
#define ARM_ARCH_VERSION 7
#endif
/* Defines two pseudo-platforms for ARM and Thumb-2 instruction set. */
#if !defined(WTF_PLATFORM_ARM_TRADITIONAL) && !defined(WTF_PLATFORM_ARM_THUMB2)
# if defined(thumb2) || defined(__thumb2__)
# define WTF_PLATFORM_ARM_TRADITIONAL 0
# define WTF_PLATFORM_ARM_THUMB2 1
# elif PLATFORM_ARM_ARCH(4)
# define WTF_PLATFORM_ARM_TRADITIONAL 1
# define WTF_PLATFORM_ARM_THUMB2 0
# else
# error "Not supported ARM architecture"
# endif
#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(ARM_THUMB2) /* Sanity Check */
# error "Cannot use both of WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2 platforms"
#endif // !defined(ARM_TRADITIONAL) && !defined(ARM_THUMB2)
#endif /* ARM */
#define PLATFORM_ARM_ARCH(N) (PLATFORM(ARM) && ARM_ARCH_VERSION >= N)
/* PLATFORM(X86) */
#if defined(__i386__) \
......@@ -637,7 +652,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#elif PLATFORM(X86) && PLATFORM(MAC)
#define ENABLE_JIT 1
#define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
#elif PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE)
#elif PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE)
/* Under development, temporarily disabled until 16Mb link range limit in assembler is fixed. */
#define ENABLE_JIT 0
#define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0
......@@ -656,7 +671,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#elif PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100
#define ENABLE_JIT 1
#define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
#elif PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) && PLATFORM(LINUX)
#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX)
#define ENABLE_JIT 1
#endif
#endif /* PLATFORM(QT) */
......@@ -703,7 +718,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#if (PLATFORM(X86) && PLATFORM(MAC)) \
|| (PLATFORM(X86_64) && PLATFORM(MAC)) \
/* Under development, temporarily disabled until 16Mb link range limit in assembler is fixed. */ \
|| (PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE) && 0) \
|| (PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE) && 0) \
|| (PLATFORM(X86) && PLATFORM(WIN))
#define ENABLE_YARR 1
#define ENABLE_YARR_JIT 1
......@@ -713,7 +728,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#if (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \
|| (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MSVC)) \
|| (PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100) \
|| (PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) && PLATFORM(LINUX))
|| (PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX))
#define ENABLE_YARR 1
#define ENABLE_YARR_JIT 1
#endif
......
......@@ -1309,7 +1309,7 @@ class RegexGenerator : private MacroAssembler {
loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), output);
#endif
#elif PLATFORM(ARM)
#if !PLATFORM_ARM_ARCH(7)
#if PLATFORM(ARM_TRADITIONAL)
push(ARMRegisters::lr);
#endif
push(ARMRegisters::r4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment