Changeset 238564 in webkit


Ignore:
Timestamp:
Nov 27, 2018 11:47:17 AM (5 years ago)
Author:
mark.lam@apple.com
Message:

Introducing a ENABLE_SEPARATED_WX_HEAP macro.
https://bugs.webkit.org/show_bug.cgi?id=192013
<rdar://problem/45494310>

Reviewed by Keith Miller.

This makes the code a little more readable.

I put the definition of ENABLE_SEPARATED_WX_HEAP in JSC's config.h instead of
Platform.h because ENABLE_SEPARATED_WX_HEAP is only needed inside JSC. Also,
ENABLE_SEPARATED_WX_HEAP depends on ENABLE(FAST_JIT_PERMISSIONS), which is only
defined for JSC.

  • config.h:
  • jit/ExecutableAllocator.cpp:

(JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator):
(JSC::FixedVMPoolExecutableAllocator::initializeSeparatedWXHeaps):

  • jit/ExecutableAllocator.h:

(JSC::performJITMemcpy):

  • runtime/Options.cpp:

(JSC::recomputeDependentOptions):

Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r238543 r238564  
     12018-11-27  Mark Lam  <mark.lam@apple.com>
     2
     3        Introducing a ENABLE_SEPARATED_WX_HEAP macro.
     4        https://bugs.webkit.org/show_bug.cgi?id=192013
     5        <rdar://problem/45494310>
     6
     7        Reviewed by Keith Miller.
     8
     9        This makes the code a little more readable.
     10
     11        I put the definition of ENABLE_SEPARATED_WX_HEAP in JSC's config.h instead of
     12        Platform.h because ENABLE_SEPARATED_WX_HEAP is only needed inside JSC.  Also,
     13        ENABLE_SEPARATED_WX_HEAP depends on ENABLE(FAST_JIT_PERMISSIONS), which is only
     14        defined for JSC.
     15
     16        * config.h:
     17        * jit/ExecutableAllocator.cpp:
     18        (JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator):
     19        (JSC::FixedVMPoolExecutableAllocator::initializeSeparatedWXHeaps):
     20        * jit/ExecutableAllocator.h:
     21        (JSC::performJITMemcpy):
     22        * runtime/Options.cpp:
     23        (JSC::recomputeDependentOptions):
     24
    1252018-11-26  Caio Lima  <ticaiolima@gmail.com>
    226
  • trunk/Source/JavaScriptCore/config.h

    r234227 r238564  
    11/*
    2  * Copyright (C) 2006, 2007, 2008, 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
    33 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
    44 *
     
    3838
    3939#include <wtf/DisallowCType.h>
     40
     41#if !defined(ENABLE_SEPARATED_WX_HEAP)
     42#if (!ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)) && PLATFORM(IOS_FAMILY) && CPU(ARM64)
     43#define ENABLE_SEPARATED_WX_HEAP 1
     44#else
     45#define ENABLE_SEPARATED_WX_HEAP 0
     46#endif
     47#endif // !defined(ENABLE_SEPARATED_WX_HEAP)
  • trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp

    r238388 r238564  
    105105#endif
    106106
    107 #if !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
     107#if ENABLE(SEPARATED_WX_HEAP)
    108108JS_EXPORT_PRIVATE bool useFastPermisionsJITCopy { false };
    109109JS_EXPORT_PRIVATE JITWriteSeparateHeapsFunction jitWriteSeparateHeapsFunction;
     
    183183            void* reservationBase = m_reservation.base();
    184184
    185 #if ENABLE(FAST_JIT_PERMISSIONS) && CPU(ARM64E)
     185#if ENABLE(FAST_JIT_PERMISSIONS) && !ENABLE(SEPARATED_WX_HEAP)
    186186            RELEASE_ASSERT(os_thread_self_restrict_rwx_is_supported());
    187187            os_thread_self_restrict_rwx_to_rx();
    188188
    189 #else // not ENABLE(FAST_JIT_PERMISSIONS) or not CPU(ARM64E)
     189#else // not ENABLE(FAST_JIT_PERMISSIONS) or ENABLE(SEPARATED_WX_HEAP)
    190190#if ENABLE(FAST_JIT_PERMISSIONS)
    191191            if (os_thread_self_restrict_rwx_is_supported()) {
     
    201201                initializeSeparatedWXHeaps(m_reservation.base(), pageSize(), reservationBase, reservationSize);
    202202            }
    203 #endif // not ENABLE(FAST_JIT_PERMISSIONS) or not CPU(ARM64E)
     203#endif // not ENABLE(FAST_JIT_PERMISSIONS) or ENABLE(SEPARATED_WX_HEAP)
    204204
    205205            addFreshFreeSpace(reservationBase, reservationSize);
     
    295295        memset_s(&writableAddr, sizeof(writableAddr), 0, sizeof(writableAddr));
    296296
    297 #if !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
     297#if ENABLE(SEPARATED_WX_HEAP)
    298298        jitWriteSeparateHeapsFunction = reinterpret_cast<JITWriteSeparateHeapsFunction>(writeThunk.code().executableAddress());
    299299#endif
  • trunk/Source/JavaScriptCore/jit/ExecutableAllocator.h

    r238388 r238564  
    7979JS_EXPORT_PRIVATE bool isJITPC(void* pc);
    8080
    81 #if !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
     81#if ENABLE(SEPARATED_WX_HEAP)
    8282
    8383typedef void (*JITWriteSeparateHeapsFunction)(off_t, const void*, size_t);
     
    8585extern JS_EXPORT_PRIVATE bool useFastPermisionsJITCopy;
    8686
    87 #endif // !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
     87#endif // ENABLE(SEPARATED_WX_HEAP)
    8888
    8989static inline void* performJITMemcpy(void *dst, const void *src, size_t n)
     
    9797        RELEASE_ASSERT(reinterpret_cast<uint8_t*>(dst) + n <= endOfFixedExecutableMemoryPool());
    9898#if ENABLE(FAST_JIT_PERMISSIONS)
    99 #if !CPU(ARM64E)
     99#if ENABLE(SEPARATED_WX_HEAP)
    100100        if (useFastPermisionsJITCopy)
    101101#endif
     
    108108#endif // ENABLE(FAST_JIT_PERMISSIONS)
    109109
    110 #if !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
     110#if ENABLE(SEPARATED_WX_HEAP)
    111111        if (jitWriteSeparateHeapsFunction) {
    112112            // Use execute-only write thunk for writes inside the JIT region. This is a variant of
  • trunk/Source/JavaScriptCore/runtime/Options.cpp

    r237266 r238564  
    469469    }
    470470   
    471 #if PLATFORM(IOS_FAMILY) && CPU(ARM64) && !CPU(ARM64E)
     471#if ENABLE(SEPARATED_WX_HEAP)
    472472    // Override globally for now. Longer term we'll just make the default
    473473    // be to have this option enabled, and have platforms that don't support
Note: See TracChangeset for help on using the changeset viewer.