Title: [236864] trunk/Source/_javascript_Core
Revision
236864
Author
[email protected]
Date
2018-10-04 17:35:25 -0700 (Thu, 04 Oct 2018)

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

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (236863 => 236864)


--- trunk/Source/_javascript_Core/ChangeLog	2018-10-05 00:32:20 UTC (rev 236863)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-10-05 00:35:25 UTC (rev 236864)
@@ -1,5 +1,27 @@
 2018-10-04  Mark Lam  <[email protected]>
 
+        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:
+
+2018-10-04  Mark Lam  <[email protected]>
+
         Disable Options::useWebAssemblyFastMemory() on linux if ASAN signal handling is not disabled.
         https://bugs.webkit.org/show_bug.cgi?id=190283
         <rdar://problem/45015752>

Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp (236863 => 236864)


--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2018-10-05 00:32:20 UTC (rev 236863)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2018-10-05 00:35:25 UTC (rev 236864)
@@ -104,9 +104,6 @@
 static const double executablePoolReservationFraction = 0.25;
 #endif
 
-JS_EXPORT_PRIVATE void* taggedStartOfFixedExecutableMemoryPool;
-JS_EXPORT_PRIVATE void* taggedEndOfFixedExecutableMemoryPool;
-
 #if !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
 JS_EXPORT_PRIVATE bool useFastPermisionsJITCopy { false };
 JS_EXPORT_PRIVATE JITWriteSeparateHeapsFunction jitWriteSeparateHeapsFunction;
@@ -168,13 +165,18 @@
             addFreshFreeSpace(reservationBase, reservationSize);
 
             void* reservationEnd = reinterpret_cast<uint8_t*>(reservationBase) + reservationSize;
-            taggedStartOfFixedExecutableMemoryPool = tagCodePtr<ExecutableMemoryPtrTag>(reservationBase);
-            taggedEndOfFixedExecutableMemoryPool = tagCodePtr<ExecutableMemoryPtrTag>(reservationEnd);
+
+            m_memoryStart = MacroAssemblerCodePtr<ExecutableMemoryPtrTag>(tagCodePtr<ExecutableMemoryPtrTag>(reservationBase));
+            m_memoryEnd = MacroAssemblerCodePtr<ExecutableMemoryPtrTag>(tagCodePtr<ExecutableMemoryPtrTag>(reservationEnd));
         }
     }
 
     virtual ~FixedVMPoolExecutableAllocator();
 
+    void* memoryStart() { return m_memoryStart.untaggedExecutableAddress(); }
+    void* memoryEnd() { return m_memoryEnd.untaggedExecutableAddress(); }
+    bool isJITPC(void* pc) { return memoryStart() <= pc && pc < memoryEnd(); }
+
 protected:
     FreeSpacePtr allocateNewSpace(size_t&) override
     {
@@ -358,6 +360,8 @@
 
 private:
     PageReservation m_reservation;
+    MacroAssemblerCodePtr<ExecutableMemoryPtrTag> m_memoryStart;
+    MacroAssemblerCodePtr<ExecutableMemoryPtrTag> m_memoryEnd;
 };
 
 static FixedVMPoolExecutableAllocator* allocator;
@@ -461,12 +465,10 @@
     }
 
 #if USE(POINTER_PROFILING)
-    void* start = startOfFixedExecutableMemoryPool();
-    void* end = endOfFixedExecutableMemoryPool();
+    void* start = allocator->memoryStart();
+    void* end = allocator->memoryEnd();
     void* resultStart = result->start().untaggedPtr();
     void* resultEnd = result->end().untaggedPtr();
-    RELEASE_ASSERT(start == removeCodePtrTag(taggedStartOfFixedExecutableMemoryPool));
-    RELEASE_ASSERT(end == removeCodePtrTag(taggedEndOfFixedExecutableMemoryPool));
     RELEASE_ASSERT(start <= resultStart && resultStart < end);
     RELEASE_ASSERT(start < resultEnd && resultEnd <= end);
 #endif
@@ -495,8 +497,23 @@
 }
 #endif
 
+void* startOfFixedExecutableMemoryPoolImpl()
+{
+    return allocator->memoryStart();
 }
 
+void* endOfFixedExecutableMemoryPoolImpl()
+{
+    return allocator->memoryEnd();
+}
+
+bool isJITPC(void* pc)
+{
+    return allocator->isJITPC(pc);
+}
+
+} // namespace JSC
+
 #else // !ENABLE(JIT)
 
 namespace JSC {

Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.h (236863 => 236864)


--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.h	2018-10-05 00:32:20 UTC (rev 236863)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.h	2018-10-05 00:35:25 UTC (rev 236864)
@@ -61,25 +61,22 @@
 
 #if ENABLE(JIT)
 
-extern JS_EXPORT_PRIVATE void* taggedStartOfFixedExecutableMemoryPool;
-extern JS_EXPORT_PRIVATE void* taggedEndOfFixedExecutableMemoryPool;
+JS_EXPORT_PRIVATE void* startOfFixedExecutableMemoryPoolImpl();
+JS_EXPORT_PRIVATE void* endOfFixedExecutableMemoryPoolImpl();
 
 template<typename T = void*>
 T startOfFixedExecutableMemoryPool()
 {
-    return untagCodePtr<T, ExecutableMemoryPtrTag>(taggedStartOfFixedExecutableMemoryPool);
+    return bitwise_cast<T>(startOfFixedExecutableMemoryPoolImpl());
 }
 
 template<typename T = void*>
 T endOfFixedExecutableMemoryPool()
 {
-    return untagCodePtr<T, ExecutableMemoryPtrTag>(taggedEndOfFixedExecutableMemoryPool);
+    return bitwise_cast<T>(endOfFixedExecutableMemoryPoolImpl());
 }
 
-inline bool isJITPC(void* pc)
-{
-    return startOfFixedExecutableMemoryPool() <= pc && pc < endOfFixedExecutableMemoryPool();
-}
+bool isJITPC(void* pc);
 
 #if !ENABLE(FAST_JIT_PERMISSIONS) || !CPU(ARM64E)
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to