Ignore:
Timestamp:
Jan 8, 2010, 12:01:40 AM (15 years ago)
Author:
[email protected]
Message:

Remove an unnecessary cacheFlush from ARM_TRADITIONAL JIT
https://bugs.webkit.org/show_bug.cgi?id=33203

Reviewed by Gavin Barraclough.

  • assembler/ARMAssembler.cpp: Remove obsolete linkBranch function.

(JSC::ARMAssembler::executableCopy): Inline a clean linkBranch code.

  • assembler/ARMAssembler.h:

(JSC::ARMAssembler::getLdrImmAddress): Use inline function.
(JSC::ARMAssembler::getLdrImmAddressOnPool): Ditto.
(JSC::ARMAssembler::patchPointerInternal): Remove an unnecessary cacheFlush.
(JSC::ARMAssembler::linkJump): Use patchPointerInternal instead of linkBranch.
(JSC::ARMAssembler::linkCall): Ditto.
(JSC::ARMAssembler::relinkCall): Ditto.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/assembler/ARMAssembler.h

    r52797 r52977  
    184184
    185185        static const ARMWord INVALID_IMM = 0xf0000000;
     186        static const int DefaultPrefetching = 2;
    186187
    187188        class JmpSrc {
     
    633634        // Patching helpers
    634635
    635         static ARMWord* getLdrImmAddress(ARMWord* insn, uint32_t* constPool = 0);
    636         static void linkBranch(void* code, JmpSrc from, void* to, int useConstantPool = 0);
     636        static ARMWord* getLdrImmAddress(ARMWord* insn)
     637        {
     638            // Must be an ldr ..., [pc +/- imm]
     639            ASSERT((*insn & 0x0f7f0000) == 0x051f0000);
     640
     641            ARMWord addr = reinterpret_cast<ARMWord>(insn) + DefaultPrefetching * sizeof(ARMWord);
     642            if (*insn & DT_UP)
     643                return reinterpret_cast<ARMWord*>(addr + (*insn & SDT_OFFSET_MASK));
     644            return reinterpret_cast<ARMWord*>(addr - (*insn & SDT_OFFSET_MASK));
     645        }
     646
     647        static ARMWord* getLdrImmAddressOnPool(ARMWord* insn, uint32_t* constPool)
     648        {
     649            // Must be an ldr ..., [pc +/- imm]
     650            ASSERT((*insn & 0x0f7f0000) == 0x051f0000);
     651
     652            if (*insn & 0x1)
     653                return reinterpret_cast<ARMWord*>(constPool + ((*insn & SDT_OFFSET_MASK) >> 1));
     654            return getLdrImmAddress(insn);
     655        }
    637656
    638657        static void patchPointerInternal(intptr_t from, void* to)
     
    641660            ARMWord* addr = getLdrImmAddress(insn);
    642661            *addr = reinterpret_cast<ARMWord>(to);
    643             ExecutableAllocator::cacheFlush(addr, sizeof(ARMWord));
    644662        }
    645663
     
    686704        {
    687705            ARMWord* insn = reinterpret_cast<ARMWord*>(m_buffer.data()) + (from.m_offset / sizeof(ARMWord));
    688             *getLdrImmAddress(insn, m_buffer.poolAddress()) = static_cast<ARMWord>(to.m_offset);
     706            ARMWord* addr = getLdrImmAddressOnPool(insn, m_buffer.poolAddress());
     707            *addr = static_cast<ARMWord>(to.m_offset);
    689708        }
    690709
    691710        static void linkJump(void* code, JmpSrc from, void* to)
    692711        {
    693             linkBranch(code, from, to);
     712            patchPointerInternal(reinterpret_cast<intptr_t>(code) + from.m_offset, to);
    694713        }
    695714
     
    701720        static void linkCall(void* code, JmpSrc from, void* to)
    702721        {
    703             linkBranch(code, from, to, true);
     722            patchPointerInternal(reinterpret_cast<intptr_t>(code) + from.m_offset, to);
    704723        }
    705724
    706725        static void relinkCall(void* from, void* to)
    707726        {
    708             relinkJump(from, to);
     727            patchPointerInternal(reinterpret_cast<intptr_t>(from) - sizeof(ARMWord), to);
    709728        }
    710729
Note: See TracChangeset for help on using the changeset viewer.