Changeset 236864 in webkit


Ignore:
Timestamp:
Oct 4, 2018, 5:35:25 PM (7 years ago)
Author:
mark.lam@apple.com
Message:

Move start/EndOfFixedExecutableMemoryPool pointers into the FixedVMPoolExecutableAllocator object.
https://bugs.webkit.org/show_bug.cgi?id=190295
<rdar://problem/19197193>

Reviewed by Saam Barati.

This allows us to use the tagging logic already baked into MacroAssemblerCodePtr
instead of needing to use our own custom version here.

  • jit/ExecutableAllocator.cpp:

(JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator):
(JSC::FixedVMPoolExecutableAllocator::memoryStart):
(JSC::FixedVMPoolExecutableAllocator::memoryEnd):
(JSC::FixedVMPoolExecutableAllocator::isJITPC):
(JSC::ExecutableAllocator::allocate):
(JSC::startOfFixedExecutableMemoryPoolImpl):
(JSC::endOfFixedExecutableMemoryPoolImpl):
(JSC::isJITPC):

  • jit/ExecutableAllocator.h:
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r236839 r236864  
     12018-10-04  Mark Lam  <mark.lam@apple.com>
     2
     3        Move start/EndOfFixedExecutableMemoryPool pointers into the FixedVMPoolExecutableAllocator object.
     4        https://bugs.webkit.org/show_bug.cgi?id=190295
     5        <rdar://problem/19197193>
     6
     7        Reviewed by Saam Barati.
     8
     9        This allows us to use the tagging logic already baked into MacroAssemblerCodePtr
     10        instead of needing to use our own custom version here.
     11
     12        * jit/ExecutableAllocator.cpp:
     13        (JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator):
     14        (JSC::FixedVMPoolExecutableAllocator::memoryStart):
     15        (JSC::FixedVMPoolExecutableAllocator::memoryEnd):
     16        (JSC::FixedVMPoolExecutableAllocator::isJITPC):
     17        (JSC::ExecutableAllocator::allocate):
     18        (JSC::startOfFixedExecutableMemoryPoolImpl):
     19        (JSC::endOfFixedExecutableMemoryPoolImpl):
     20        (JSC::isJITPC):
     21        * jit/ExecutableAllocator.h:
     22
    1232018-10-04  Mark Lam  <mark.lam@apple.com>
    224
  • trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp

    r236758 r236864  
    105105#endif
    106106
    107 JS_EXPORT_PRIVATE void* taggedStartOfFixedExecutableMemoryPool;
    108 JS_EXPORT_PRIVATE void* taggedEndOfFixedExecutableMemoryPool;
    109 
    110107#if !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
    111108JS_EXPORT_PRIVATE bool useFastPermisionsJITCopy { false };
     
    169166
    170167            void* reservationEnd = reinterpret_cast<uint8_t*>(reservationBase) + reservationSize;
    171             taggedStartOfFixedExecutableMemoryPool = tagCodePtr<ExecutableMemoryPtrTag>(reservationBase);
    172             taggedEndOfFixedExecutableMemoryPool = tagCodePtr<ExecutableMemoryPtrTag>(reservationEnd);
     168
     169            m_memoryStart = MacroAssemblerCodePtr<ExecutableMemoryPtrTag>(tagCodePtr<ExecutableMemoryPtrTag>(reservationBase));
     170            m_memoryEnd = MacroAssemblerCodePtr<ExecutableMemoryPtrTag>(tagCodePtr<ExecutableMemoryPtrTag>(reservationEnd));
    173171        }
    174172    }
    175173
    176174    virtual ~FixedVMPoolExecutableAllocator();
     175
     176    void* memoryStart() { return m_memoryStart.untaggedExecutableAddress(); }
     177    void* memoryEnd() { return m_memoryEnd.untaggedExecutableAddress(); }
     178    bool isJITPC(void* pc) { return memoryStart() <= pc && pc < memoryEnd(); }
    177179
    178180protected:
     
    359361private:
    360362    PageReservation m_reservation;
     363    MacroAssemblerCodePtr<ExecutableMemoryPtrTag> m_memoryStart;
     364    MacroAssemblerCodePtr<ExecutableMemoryPtrTag> m_memoryEnd;
    361365};
    362366
     
    462466
    463467#if USE(POINTER_PROFILING)
    464     void* start = startOfFixedExecutableMemoryPool();
    465     void* end = endOfFixedExecutableMemoryPool();
     468    void* start = allocator->memoryStart();
     469    void* end = allocator->memoryEnd();
    466470    void* resultStart = result->start().untaggedPtr();
    467471    void* resultEnd = result->end().untaggedPtr();
    468     RELEASE_ASSERT(start == removeCodePtrTag(taggedStartOfFixedExecutableMemoryPool));
    469     RELEASE_ASSERT(end == removeCodePtrTag(taggedEndOfFixedExecutableMemoryPool));
    470472    RELEASE_ASSERT(start <= resultStart && resultStart < end);
    471473    RELEASE_ASSERT(start < resultEnd && resultEnd <= end);
     
    496498#endif
    497499
    498 }
     500void* startOfFixedExecutableMemoryPoolImpl()
     501{
     502    return allocator->memoryStart();
     503}
     504
     505void* endOfFixedExecutableMemoryPoolImpl()
     506{
     507    return allocator->memoryEnd();
     508}
     509
     510bool isJITPC(void* pc)
     511{
     512    return allocator->isJITPC(pc);
     513}
     514
     515} // namespace JSC
    499516
    500517#else // !ENABLE(JIT)
  • trunk/Source/JavaScriptCore/jit/ExecutableAllocator.h

    r236758 r236864  
    6262#if ENABLE(JIT)
    6363
    64 extern JS_EXPORT_PRIVATE void* taggedStartOfFixedExecutableMemoryPool;
    65 extern JS_EXPORT_PRIVATE void* taggedEndOfFixedExecutableMemoryPool;
     64JS_EXPORT_PRIVATE void* startOfFixedExecutableMemoryPoolImpl();
     65JS_EXPORT_PRIVATE void* endOfFixedExecutableMemoryPoolImpl();
    6666
    6767template<typename T = void*>
    6868T startOfFixedExecutableMemoryPool()
    6969{
    70     return untagCodePtr<T, ExecutableMemoryPtrTag>(taggedStartOfFixedExecutableMemoryPool);
     70    return bitwise_cast<T>(startOfFixedExecutableMemoryPoolImpl());
    7171}
    7272
     
    7474T endOfFixedExecutableMemoryPool()
    7575{
    76     return untagCodePtr<T, ExecutableMemoryPtrTag>(taggedEndOfFixedExecutableMemoryPool);
     76    return bitwise_cast<T>(endOfFixedExecutableMemoryPoolImpl());
    7777}
    7878
    79 inline bool isJITPC(void* pc)
    80 {
    81     return startOfFixedExecutableMemoryPool() <= pc && pc < endOfFixedExecutableMemoryPool();
    82 }
     79bool isJITPC(void* pc);
    8380
    8481#if !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
Note: See TracChangeset for help on using the changeset viewer.