Commit cf4899dc authored by barraclough@apple.com's avatar barraclough@apple.com

2009-06-19 Gabor Loki <loki@inf.u-szeged.hu>

        Reviewed by Gavin Barraclough.

        Reorganize ARM architecture specific macros.
        Use PLATFORM_ARM_ARCH(7) instead of PLATFORM(ARM_V7).

        Bug 24986: ARM JIT port
        <https://bugs.webkit.org/show_bug.cgi?id=24986>

        * assembler/ARMv7Assembler.h:
        * assembler/AbstractMacroAssembler.h:
        (JSC::AbstractMacroAssembler::Imm32::Imm32):
        * assembler/MacroAssembler.h:
        * assembler/MacroAssemblerCodeRef.h:
        (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr):
        * jit/ExecutableAllocator.h:
        (JSC::ExecutableAllocator::cacheFlush):
        * jit/JIT.h:
        * jit/JITInlineMethods.h:
        (JSC::JIT::restoreArgumentReferenceForTrampoline):
        * jit/JITStubs.cpp:
        * jit/JITStubs.h:
        * wtf/Platform.h:
        * yarr/RegexJIT.cpp:
        (JSC::Yarr::RegexGenerator::generateEnter):
        (JSC::Yarr::RegexGenerator::generateReturn):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e30b7e26
2009-06-19 Gabor Loki <loki@inf.u-szeged.hu>
Reviewed by Gavin Barraclough.
Reorganize ARM architecture specific macros.
Use PLATFORM_ARM_ARCH(7) instead of PLATFORM(ARM_V7).
Bug 24986: ARM JIT port
<https://bugs.webkit.org/show_bug.cgi?id=24986>
* assembler/ARMv7Assembler.h:
* assembler/AbstractMacroAssembler.h:
(JSC::AbstractMacroAssembler::Imm32::Imm32):
* assembler/MacroAssembler.h:
* assembler/MacroAssemblerCodeRef.h:
(JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr):
* jit/ExecutableAllocator.h:
(JSC::ExecutableAllocator::cacheFlush):
* jit/JIT.h:
* jit/JITInlineMethods.h:
(JSC::JIT::restoreArgumentReferenceForTrampoline):
* jit/JITStubs.cpp:
* jit/JITStubs.h:
* wtf/Platform.h:
* yarr/RegexJIT.cpp:
(JSC::Yarr::RegexGenerator::generateEnter):
(JSC::Yarr::RegexGenerator::generateReturn):
2009-06-19 Gavin Barraclough <barraclough@apple.com>
Reviewed by Oliver Hunt.
......
......@@ -28,7 +28,7 @@
#include <wtf/Platform.h>
#if ENABLE(ASSEMBLER) && PLATFORM(ARM_V7)
#if ENABLE(ASSEMBLER) && PLATFORM_ARM_ARCH(7)
#include "AssemblerBuffer.h"
#include <wtf/Assertions.h>
......@@ -1753,6 +1753,6 @@ private:
} // namespace JSC
#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_V7)
#endif // ENABLE(ASSEMBLER) && PLATFORM_ARM_ARCH(7)
#endif // ARMAssembler_h
......@@ -175,7 +175,7 @@ public:
struct Imm32 {
explicit Imm32(int32_t value)
: m_value(value)
#if PLATFORM(ARM_V7)
#if PLATFORM_ARM_ARCH(7)
, m_isPointer(false)
#endif
{
......@@ -184,7 +184,7 @@ public:
#if !PLATFORM(X86_64)
explicit Imm32(ImmPtr ptr)
: m_value(ptr.asIntptr())
#if PLATFORM(ARM_V7)
#if PLATFORM_ARM_ARCH(7)
, m_isPointer(true)
#endif
{
......@@ -192,7 +192,7 @@ public:
#endif
int32_t m_value;
#if PLATFORM(ARM_V7)
#if PLATFORM_ARM_ARCH(7)
// We rely on being able to regenerate code to recover exception handling
// information. Since ARMv7 supports 16-bit immediates there is a danger
// that if pointer values change the layout of the generated code will change.
......
......@@ -30,7 +30,7 @@
#if ENABLE(ASSEMBLER)
#if PLATFORM(ARM_V7)
#if PLATFORM_ARM_ARCH(7)
#include "MacroAssemblerARMv7.h"
namespace JSC { typedef MacroAssemblerARMv7 MacroAssemblerBase; };
......
......@@ -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_V7)
#if PLATFORM_ARM_ARCH(7)
// 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_V7)
#if PLATFORM_ARM_ARCH(7)
// 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_V7)
#if PLATFORM_ARM_ARCH(7)
// 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
......
......@@ -210,7 +210,7 @@ private:
#if PLATFORM(X86) || PLATFORM(X86_64)
UNUSED_PARAM(code);
UNUSED_PARAM(size);
#elif PLATFORM(ARM_V7) && PLATFORM(IPHONE)
#elif PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE)
sys_dcache_flush(code, size);
sys_icache_invalidate(code, size);
#else
......
......@@ -232,7 +232,7 @@ namespace JSC {
static const FPRegisterID fpRegT0 = X86::xmm0;
static const FPRegisterID fpRegT1 = X86::xmm1;
static const FPRegisterID fpRegT2 = X86::xmm2;
#elif PLATFORM(ARM_V7)
#elif PLATFORM_ARM_ARCH(7)
static const RegisterID returnValueRegister = ARM::r0;
static const RegisterID cachedResultRegister = ARM::r0;
static const RegisterID firstArgumentRegister = ARM::r0;
......@@ -307,7 +307,7 @@ namespace JSC {
static const int patchOffsetMethodCheckProtoObj = 11;
static const int patchOffsetMethodCheckProtoStruct = 18;
static const int patchOffsetMethodCheckPutFunction = 29;
#elif PLATFORM(ARM_V7)
#elif PLATFORM_ARM_ARCH(7)
// 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;
......
......@@ -198,7 +198,7 @@ ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address)
push(address);
}
#elif PLATFORM(ARM_V7)
#elif PLATFORM_ARM_ARCH(7)
ALWAYS_INLINE void JIT::preverveReturnAddressAfterCall(RegisterID reg)
{
......@@ -234,7 +234,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_V7)
#elif PLATFORM_ARM_ARCH(7)
move(stackPointerRegister, firstArgumentRegister);
#endif
// In the trampoline on x86-64, the first argument register is not overwritten.
......
......@@ -189,7 +189,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"ret" "\n"
);
#elif COMPILER(GCC) && PLATFORM(ARM_V7)
#elif COMPILER(GCC) && PLATFORM_ARM_ARCH(7)
#if USE(JIT_STUB_ARGUMENT_VA_LIST)
#error "JIT_STUB_ARGUMENT_VA_LIST not supported on ARMv7."
......@@ -328,7 +328,7 @@ JITThunks::JITThunks(JSGlobalData* globalData)
{
JIT::compileCTIMachineTrampolines(globalData, &m_executablePool, &m_ctiArrayLengthTrampoline, &m_ctiStringLengthTrampoline, &m_ctiVirtualCallPreLink, &m_ctiVirtualCallLink, &m_ctiVirtualCall, &m_ctiNativeCallThunk);
#if PLATFORM(ARM_V7)
#if PLATFORM_ARM_ARCH(7)
// Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it contains non POD types),
// and the FIELD_OFFSET macro does not appear constantish enough for it to be happy with its use in COMPILE_ASSERT
// macros.
......@@ -569,7 +569,7 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD
namespace JITStubs {
#if PLATFORM(ARM_V7)
#if PLATFORM_ARM_ARCH(7)
#define DEFINE_STUB_FUNCTION(rtype, op) \
extern "C" { \
......
......@@ -115,7 +115,7 @@ namespace JSC {
// When JIT code makes a call, it pushes its return address just below the rest of the stack.
ReturnAddressPtr* returnAddressSlot() { return reinterpret_cast<ReturnAddressPtr*>(this) - 1; }
};
#elif PLATFORM(ARM_V7)
#elif PLATFORM_ARM_ARCH(7)
struct JITStackFrame {
JITStubArg padding; // Unused
JITStubArg args[6];
......
......@@ -227,10 +227,29 @@
#if !defined(__ARM_EABI__)
#define WTF_PLATFORM_FORCE_PACK 1
#endif
#define ARM_ARCH_VERSION 3
#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
#undef ARM_ARCH_VERSION
#define ARM_ARCH_VERSION 4
#endif
#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
|| defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
|| defined(__ARM_ARCH_5TEJ__)
#undef ARM_ARCH_VERSION
#define ARM_ARCH_VERSION 5
#endif
#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
|| defined(__ARM_ARCH_6ZK__)
#undef ARM_ARCH_VERSION
#define ARM_ARCH_VERSION 6
#endif
#if defined(__ARM_ARCH_7A__)
#define WTF_PLATFORM_ARM_V7 1
#undef ARM_ARCH_VERSION
#define ARM_ARCH_VERSION 7
#endif
#endif /* ARM */
#define PLATFORM_ARM_ARCH(N) (PLATFORM(ARM) && ARM_ARCH_VERSION >= N)
/* PLATFORM(X86) */
#if defined(__i386__) \
......@@ -519,7 +538,7 @@
#elif PLATFORM(X86) && PLATFORM(MAC)
#define ENABLE_JIT 1
#define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
#elif PLATFORM(ARM_V7) && PLATFORM(IPHONE)
#elif PLATFORM_ARM_ARCH(7) && 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
......@@ -568,7 +587,7 @@
#if (!defined(ENABLE_YARR_JIT) && PLATFORM(X86) && PLATFORM(MAC)) \
|| (!defined(ENABLE_YARR_JIT) && PLATFORM(X86_64) && PLATFORM(MAC)) \
/* Under development, temporarily disabled until 16Mb link range limit in assembler is fixed. */ \
|| (!defined(ENABLE_YARR_JIT) && PLATFORM(ARM_V7) && PLATFORM(IPHONE) && 0) \
|| (!defined(ENABLE_YARR_JIT) && PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE) && 0) \
|| (!defined(ENABLE_YARR_JIT) && PLATFORM(X86) && PLATFORM(WIN))
#define ENABLE_YARR 1
#define ENABLE_YARR_JIT 1
......@@ -583,7 +602,7 @@
#endif
/* Setting this flag prevents the assembler from using RWX memory; this may improve
security but currectly comes at a significant performance cost. */
#if PLATFORM(ARM_V7) && PLATFORM(IPHONE)
#if PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE)
#define ENABLE_ASSEMBLER_WX_EXCLUSIVE 1
#else
#define ENABLE_ASSEMBLER_WX_EXCLUSIVE 0
......
......@@ -43,7 +43,7 @@ namespace JSC { namespace Yarr {
class RegexGenerator : private MacroAssembler {
friend void jitCompileRegex(JSGlobalData* globalData, RegexCodeBlock& jitObject, const UString& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase, bool multiline);
#if PLATFORM(ARM_V7)
#if PLATFORM_ARM_ARCH(7)
static const RegisterID input = ARM::r0;
static const RegisterID index = ARM::r1;
static const RegisterID length = ARM::r2;
......@@ -1308,7 +1308,7 @@ class RegexGenerator : private MacroAssembler {
#else
loadPtr(Address(X86::ebp, 2 * sizeof(void*)), output);
#endif
#elif PLATFORM(ARM_V7)
#elif PLATFORM_ARM_ARCH(7)
push(ARM::r4);
push(ARM::r5);
push(ARM::r6);
......@@ -1325,7 +1325,7 @@ class RegexGenerator : private MacroAssembler {
pop(X86::edi);
pop(X86::ebx);
pop(X86::ebp);
#elif PLATFORM(ARM_V7)
#elif PLATFORM_ARM_ARCH(7)
pop(ARM::r6);
pop(ARM::r5);
pop(ARM::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