Title: [238564] trunk/Source/_javascript_Core
Revision
238564
Author
mark....@apple.com
Date
2018-11-27 11:47:17 -0800 (Tue, 27 Nov 2018)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (238563 => 238564)


--- trunk/Source/_javascript_Core/ChangeLog	2018-11-27 19:41:17 UTC (rev 238563)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-11-27 19:47:17 UTC (rev 238564)
@@ -1,3 +1,27 @@
+2018-11-27  Mark Lam  <mark....@apple.com>
+
+        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):
+
 2018-11-26  Caio Lima  <ticaiol...@gmail.com>
 
         Re-introduce op_bitnot

Modified: trunk/Source/_javascript_Core/config.h (238563 => 238564)


--- trunk/Source/_javascript_Core/config.h	2018-11-27 19:41:17 UTC (rev 238563)
+++ trunk/Source/_javascript_Core/config.h	2018-11-27 19:47:17 UTC (rev 238564)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Samuel Weinig <sam.wei...@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
@@ -37,3 +37,11 @@
 #endif
 
 #include <wtf/DisallowCType.h>
+
+#if !defined(ENABLE_SEPARATED_WX_HEAP)
+#if (!ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)) && PLATFORM(IOS_FAMILY) && CPU(ARM64)
+#define ENABLE_SEPARATED_WX_HEAP 1
+#else
+#define ENABLE_SEPARATED_WX_HEAP 0
+#endif
+#endif // !defined(ENABLE_SEPARATED_WX_HEAP)

Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp (238563 => 238564)


--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2018-11-27 19:41:17 UTC (rev 238563)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2018-11-27 19:47:17 UTC (rev 238564)
@@ -104,7 +104,7 @@
 static const double executablePoolReservationFraction = 0.25;
 #endif
 
-#if !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
+#if ENABLE(SEPARATED_WX_HEAP)
 JS_EXPORT_PRIVATE bool useFastPermisionsJITCopy { false };
 JS_EXPORT_PRIVATE JITWriteSeparateHeapsFunction jitWriteSeparateHeapsFunction;
 #endif
@@ -182,11 +182,11 @@
             ASSERT(m_reservation.size() == reservationSize);
             void* reservationBase = m_reservation.base();
 
-#if ENABLE(FAST_JIT_PERMISSIONS) && CPU(ARM64E)
+#if ENABLE(FAST_JIT_PERMISSIONS) && !ENABLE(SEPARATED_WX_HEAP)
             RELEASE_ASSERT(os_thread_self_restrict_rwx_is_supported());
             os_thread_self_restrict_rwx_to_rx();
 
-#else // not ENABLE(FAST_JIT_PERMISSIONS) or not CPU(ARM64E)
+#else // not ENABLE(FAST_JIT_PERMISSIONS) or ENABLE(SEPARATED_WX_HEAP)
 #if ENABLE(FAST_JIT_PERMISSIONS)
             if (os_thread_self_restrict_rwx_is_supported()) {
                 useFastPermisionsJITCopy = true;
@@ -200,7 +200,7 @@
                 reservationSize -= pageSize();
                 initializeSeparatedWXHeaps(m_reservation.base(), pageSize(), reservationBase, reservationSize);
             }
-#endif // not ENABLE(FAST_JIT_PERMISSIONS) or not CPU(ARM64E)
+#endif // not ENABLE(FAST_JIT_PERMISSIONS) or ENABLE(SEPARATED_WX_HEAP)
 
             addFreshFreeSpace(reservationBase, reservationSize);
 
@@ -294,7 +294,7 @@
         // Zero out writableAddr to avoid leaking the address of the writable mapping.
         memset_s(&writableAddr, sizeof(writableAddr), 0, sizeof(writableAddr));
 
-#if !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
+#if ENABLE(SEPARATED_WX_HEAP)
         jitWriteSeparateHeapsFunction = reinterpret_cast<JITWriteSeparateHeapsFunction>(writeThunk.code().executableAddress());
 #endif
     }

Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.h (238563 => 238564)


--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.h	2018-11-27 19:41:17 UTC (rev 238563)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.h	2018-11-27 19:47:17 UTC (rev 238564)
@@ -78,13 +78,13 @@
 
 JS_EXPORT_PRIVATE bool isJITPC(void* pc);
 
-#if !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
+#if ENABLE(SEPARATED_WX_HEAP)
 
 typedef void (*JITWriteSeparateHeapsFunction)(off_t, const void*, size_t);
 extern JS_EXPORT_PRIVATE JITWriteSeparateHeapsFunction jitWriteSeparateHeapsFunction;
 extern JS_EXPORT_PRIVATE bool useFastPermisionsJITCopy;
 
-#endif // !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
+#endif // ENABLE(SEPARATED_WX_HEAP)
 
 static inline void* performJITMemcpy(void *dst, const void *src, size_t n)
 {
@@ -96,7 +96,7 @@
     if (isJITPC(dst)) {
         RELEASE_ASSERT(reinterpret_cast<uint8_t*>(dst) + n <= endOfFixedExecutableMemoryPool());
 #if ENABLE(FAST_JIT_PERMISSIONS)
-#if !CPU(ARM64E)
+#if ENABLE(SEPARATED_WX_HEAP)
         if (useFastPermisionsJITCopy)
 #endif
         {
@@ -107,7 +107,7 @@
         }
 #endif // ENABLE(FAST_JIT_PERMISSIONS)
 
-#if !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
+#if ENABLE(SEPARATED_WX_HEAP)
         if (jitWriteSeparateHeapsFunction) {
             // Use execute-only write thunk for writes inside the JIT region. This is a variant of
             // memcpy that takes an offset into the JIT region as its destination (first) parameter.

Modified: trunk/Source/_javascript_Core/runtime/Options.cpp (238563 => 238564)


--- trunk/Source/_javascript_Core/runtime/Options.cpp	2018-11-27 19:41:17 UTC (rev 238563)
+++ trunk/Source/_javascript_Core/runtime/Options.cpp	2018-11-27 19:47:17 UTC (rev 238564)
@@ -468,7 +468,7 @@
         Options::useOSREntryToFTL() = false;
     }
     
-#if PLATFORM(IOS_FAMILY) && CPU(ARM64) && !CPU(ARM64E)
+#if ENABLE(SEPARATED_WX_HEAP)
     // Override globally for now. Longer term we'll just make the default
     // be to have this option enabled, and have platforms that don't support
     // it just silently use a single mapping.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to