Ignore:
Timestamp:
Jun 8, 2009, 6:40:59 PM (16 years ago)
Author:
[email protected]
Message:

2009-06-08 Gavin Barraclough <[email protected]>

Reviewed by Geoff Garen.

Add (incomplete) support to YARR for running with the jit enabled
on Arm thumb2 platforms. Adds new Assembler/MacroAssembler classes,
along with cache flushing support, tweaks to MacroAssemblerCodePtr
to support decorated thumb code pointers, and new enter/exit code
to YARR jit for the platform.

Support for this platform is still under development - the assembler
currrently only supports planting and linking jumps with a 16Mb range.
As such, initially commiting in a disabled state.

Add new assembler files.

  • assembler/ARMv7Assembler.h: Added.

Add new Assembler.

  • assembler/AbstractMacroAssembler.h:

Tweaks to ensure sizes of pointer values planted in JIT code do not change.

  • assembler/MacroAssembler.h:

On ARMv7 platforms use MacroAssemblerARMv7.

  • assembler/MacroAssemblerARMv7.h: Added.

Add new MacroAssembler.

  • assembler/MacroAssemblerCodeRef.h: (JSC::FunctionPtr::FunctionPtr):

Add better ASSERT.

(JSC::ReturnAddressPtr::ReturnAddressPtr):

Add better ASSERT.

(JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr):

On ARMv7, MacroAssemblerCodePtr's mush be 'decorated' with a low bit set,
to indicate to the processor that the code is thumb code, not traditional
32-bit ARM.

(JSC::MacroAssemblerCodePtr::dataLocation):

On ARMv7, decoration must be removed.

  • jit/ExecutableAllocator.h: (JSC::ExecutableAllocator::makeWritable):

Reformatted, no change.

(JSC::ExecutableAllocator::makeExecutable):

When marking code executable also cache flush it, where necessary.

(JSC::ExecutableAllocator::MakeWritable::MakeWritable):

Only use the null implementation of this class if both !ASSEMBLER_WX_EXCLUSIVE
and running on x86(_64) - on other platforms we may also need ensure that
makeExecutable is called at the end to flush caches.

(JSC::ExecutableAllocator::reprotectRegion):

Reformatted, no change.

(JSC::ExecutableAllocator::cacheFlush):

Cache flush a region of memory, or platforms where this is necessary.

  • wtf/Platform.h:

Add changes necessary to allow YARR jit to build on this platform, disabled.

  • yarr/RegexJIT.cpp: (JSC::Yarr::RegexGenerator::generateEnter): (JSC::Yarr::RegexGenerator::generateReturn):

Add support to these methods for ARMv7.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/yarr/RegexJIT.cpp

    r44477 r44514  
    4444    friend void jitCompileRegex(JSGlobalData* globalData, RegexCodeBlock& jitObject, const UString& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase, bool multiline);
    4545
     46#if PLATFORM(ARM_V7)
     47    static const RegisterID input = ARM::r0;
     48    static const RegisterID index = ARM::r1;
     49    static const RegisterID length = ARM::r2;
     50
     51    static const RegisterID output = ARM::r4;
     52    static const RegisterID regT0 = ARM::r5;
     53    static const RegisterID regT1 = ARM::r6;
     54
     55    static const RegisterID returnRegister = ARM::r0;
     56#endif
    4657#if PLATFORM(X86)
    4758    static const RegisterID input = X86::eax;
     
    12791290    void generateEnter()
    12801291    {
    1281         // On x86 edi & esi are callee preserved registers.
     1292#if PLATFORM(X86_64)
    12821293        push(X86::ebp);
    12831294        move(stackPointerRegister, X86::ebp);
    1284 #if PLATFORM(X86)
     1295#elif PLATFORM(X86)
     1296        push(X86::ebp);
     1297        move(stackPointerRegister, X86::ebp);
    12851298        // TODO: do we need spill registers to fill the output pointer if there are no sub captures?
    12861299        push(X86::ebx);
     
    12881301        push(X86::esi);
    12891302        // load output into edi (2 = saved ebp + return address).
    1290 #if COMPILER(MSVC)
     1303    #if COMPILER(MSVC)
    12911304        loadPtr(Address(X86::ebp, 2 * sizeof(void*)), input);
    12921305        loadPtr(Address(X86::ebp, 3 * sizeof(void*)), index);
    12931306        loadPtr(Address(X86::ebp, 4 * sizeof(void*)), length);
    12941307        loadPtr(Address(X86::ebp, 5 * sizeof(void*)), output);
    1295 #else
     1308    #else
    12961309        loadPtr(Address(X86::ebp, 2 * sizeof(void*)), output);
     1310    #endif
     1311#elif PLATFORM(ARM_V7)
     1312        push(ARM::r4);
     1313        push(ARM::r5);
     1314        push(ARM::r6);
     1315        move(ARM::r3, output);
    12971316#endif
    1298 #endif
    12991317    }
    13001318
    13011319    void generateReturn()
    13021320    {
    1303 #if PLATFORM(X86)
     1321#if PLATFORM(X86_64)
     1322        pop(X86::ebp);
     1323#elif PLATFORM(X86)
    13041324        pop(X86::esi);
    13051325        pop(X86::edi);
    13061326        pop(X86::ebx);
     1327        pop(X86::ebp);
     1328#elif PLATFORM(ARM_V7)
     1329        pop(ARM::r6);
     1330        pop(ARM::r5);
     1331        pop(ARM::r4);
    13071332#endif
    1308         pop(X86::ebp);
    13091333        ret();
    13101334    }
Note: See TracChangeset for help on using the changeset viewer.