Title: [250383] trunk/Source/_javascript_Core
Revision
250383
Author
mark....@apple.com
Date
2019-09-26 08:07:17 -0700 (Thu, 26 Sep 2019)

Log Message

We need to initialize the Gigacage first in setJITEnabled() when disabling the JIT.
https://bugs.webkit.org/show_bug.cgi?id=202257

Reviewed by Saam Barati.

Because of an OS quirk, even after the JIT region has been unmapped, the OS thinks
that region is reserved, and as such, can cause Gigacage allocation to fail.  We
work around this by initializing the Gigacage first.

Note: when called, setJITEnabled() is always called extra early in the process
bootstrap.  Under normal operation (when setJITEnabled() isn't called at all), we
will naturally initialize the Gigacage before we allocate the JIT region.
Hence, this workaround is merely ensuring the same behavior of allocation ordering.

This patch only applies to iOS.

* jit/ExecutableAllocator.cpp:
(JSC::ExecutableAllocator::setJITEnabled):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (250382 => 250383)


--- trunk/Source/_javascript_Core/ChangeLog	2019-09-26 09:48:28 UTC (rev 250382)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-09-26 15:07:17 UTC (rev 250383)
@@ -1,3 +1,24 @@
+2019-09-26  Mark Lam  <mark....@apple.com>
+
+        We need to initialize the Gigacage first in setJITEnabled() when disabling the JIT.
+        https://bugs.webkit.org/show_bug.cgi?id=202257
+
+        Reviewed by Saam Barati.
+
+        Because of an OS quirk, even after the JIT region has been unmapped, the OS thinks
+        that region is reserved, and as such, can cause Gigacage allocation to fail.  We
+        work around this by initializing the Gigacage first.
+
+        Note: when called, setJITEnabled() is always called extra early in the process
+        bootstrap.  Under normal operation (when setJITEnabled() isn't called at all), we
+        will naturally initialize the Gigacage before we allocate the JIT region. 
+        Hence, this workaround is merely ensuring the same behavior of allocation ordering.
+
+        This patch only applies to iOS.
+
+        * jit/ExecutableAllocator.cpp:
+        (JSC::ExecutableAllocator::setJITEnabled):
+
 2019-09-25  Guillaume Emont  <guijem...@igalia.com>
 
         testapi: slow devices need more time before watchdog fires

Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp (250382 => 250383)


--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2019-09-26 09:48:28 UTC (rev 250382)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2019-09-26 15:07:17 UTC (rev 250383)
@@ -130,6 +130,17 @@
 
 #if PLATFORM(IOS_FAMILY) && (CPU(ARM64) || CPU(ARM))
     if (!enabled) {
+        // Because of an OS quirk, even after the JIT region has been unmapped,
+        // the OS thinks that region is reserved, and as such, can cause Gigacage
+        // allocation to fail. We work around this by initializing the Gigacage
+        // first.
+        // Note: when called, setJITEnabled() is always called extra early in the
+        // process bootstrap. Under normal operation (when setJITEnabled() isn't
+        // called at all), we will naturally initialize the Gigacage before we
+        // allocate the JIT region. Hence, this workaround is merely ensuring the
+        // same behavior of allocation ordering.
+        Gigacage::ensureGigacage();
+
         constexpr size_t size = 1;
         constexpr int protection = PROT_READ | PROT_WRITE | PROT_EXEC;
         constexpr int flags = MAP_PRIVATE | MAP_ANON | MAP_JIT;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to