Title: [236880] trunk/Source/_javascript_Core
Revision
236880
Author
[email protected]
Date
2018-10-05 11:33:41 -0700 (Fri, 05 Oct 2018)

Log Message

performJITMemcpy() should handle the case when the executable allocator is not initialized yet.
https://bugs.webkit.org/show_bug.cgi?id=190317
<rdar://problem/45039398>

Reviewed by Saam Barati.

When SeparatedWXHeaps is in use, jitWriteThunkGenerator() will call performJITMemcpy()
to copy memory before the JIT fixed memory pool is initialize.  Before r236864,
performJITMemcpy() would just do a memcpy in that case.  We need to restore the
equivalent behavior.

* jit/ExecutableAllocator.cpp:
(JSC::isJITPC):
* jit/ExecutableAllocator.h:
(JSC::performJITMemcpy):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (236879 => 236880)


--- trunk/Source/_javascript_Core/ChangeLog	2018-10-05 18:26:56 UTC (rev 236879)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-10-05 18:33:41 UTC (rev 236880)
@@ -1,3 +1,21 @@
+2018-10-05  Mark Lam  <[email protected]>
+
+        performJITMemcpy() should handle the case when the executable allocator is not initialized yet.
+        https://bugs.webkit.org/show_bug.cgi?id=190317
+        <rdar://problem/45039398>
+
+        Reviewed by Saam Barati.
+
+        When SeparatedWXHeaps is in use, jitWriteThunkGenerator() will call performJITMemcpy()
+        to copy memory before the JIT fixed memory pool is initialize.  Before r236864,
+        performJITMemcpy() would just do a memcpy in that case.  We need to restore the
+        equivalent behavior.
+
+        * jit/ExecutableAllocator.cpp:
+        (JSC::isJITPC):
+        * jit/ExecutableAllocator.h:
+        (JSC::performJITMemcpy):
+
 2018-10-05  Carlos Eduardo Ramalho  <[email protected]>
 
         [WPE][JSC] Use Unified Sources for Platform-specific sources

Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp (236879 => 236880)


--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2018-10-05 18:26:56 UTC (rev 236879)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2018-10-05 18:33:41 UTC (rev 236880)
@@ -331,7 +331,7 @@
         // asyncDisassembly option as our caller will set our pages execute only.
         return linkBuffer.finalizeCodeWithoutDisassembly<JITThunkPtrTag>();
     }
-#else // CPU(ARM64) && USE(EXECUTE_ONLY_JIT_WRITE_FUNCTION)
+#else // not CPU(ARM64) && USE(EXECUTE_ONLY_JIT_WRITE_FUNCTION)
     static void genericWriteToJITRegion(off_t offset, const void* data, size_t dataSize)
     {
         memcpy((void*)(startOfFixedWritableMemoryPool + offset), data, dataSize);
@@ -350,7 +350,7 @@
         auto codePtr = MacroAssemblerCodePtr<JITThunkPtrTag>(tagCFunctionPtr<JITThunkPtrTag>(function));
         return MacroAssemblerCodeRef<JITThunkPtrTag>::createSelfManagedCodeRef(codePtr);
     }
-#endif
+#endif // CPU(ARM64) && USE(EXECUTE_ONLY_JIT_WRITE_FUNCTION)
 
 #else // OS(DARWIN) && HAVE(REMAP_JIT)
     void initializeSeparatedWXHeaps(void*, size_t, void*, size_t)
@@ -509,7 +509,7 @@
 
 bool isJITPC(void* pc)
 {
-    return allocator->isJITPC(pc);
+    return allocator && allocator->isJITPC(pc);
 }
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.h (236879 => 236880)


--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.h	2018-10-05 18:26:56 UTC (rev 236879)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.h	2018-10-05 18:33:41 UTC (rev 236880)
@@ -93,7 +93,7 @@
     RELEASE_ASSERT(roundUpToMultipleOf<instructionSize>(dst) == dst);
     RELEASE_ASSERT(roundUpToMultipleOf<instructionSize>(src) == src);
 #endif
-    if (dst >= startOfFixedExecutableMemoryPool() && dst < endOfFixedExecutableMemoryPool()) {
+    if (isJITPC(dst)) {
         RELEASE_ASSERT(reinterpret_cast<uint8_t*>(dst) + n <= endOfFixedExecutableMemoryPool());
 #if ENABLE(FAST_JIT_PERMISSIONS)
 #if !CPU(ARM64E)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to