Changeset 250383 in webkit


Ignore:
Timestamp:
Sep 26, 2019, 8:07:17 AM (6 years ago)
Author:
mark.lam@apple.com
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):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r250340 r250383  
     12019-09-26  Mark Lam  <mark.lam@apple.com>
     2
     3        We need to initialize the Gigacage first in setJITEnabled() when disabling the JIT.
     4        https://bugs.webkit.org/show_bug.cgi?id=202257
     5
     6        Reviewed by Saam Barati.
     7
     8        Because of an OS quirk, even after the JIT region has been unmapped, the OS thinks
     9        that region is reserved, and as such, can cause Gigacage allocation to fail.  We
     10        work around this by initializing the Gigacage first.
     11
     12        Note: when called, setJITEnabled() is always called extra early in the process
     13        bootstrap.  Under normal operation (when setJITEnabled() isn't called at all), we
     14        will naturally initialize the Gigacage before we allocate the JIT region.
     15        Hence, this workaround is merely ensuring the same behavior of allocation ordering.
     16
     17        This patch only applies to iOS.
     18
     19        * jit/ExecutableAllocator.cpp:
     20        (JSC::ExecutableAllocator::setJITEnabled):
     21
    1222019-09-25  Guillaume Emont  <guijemont@igalia.com>
    223
  • trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp

    r249808 r250383  
    131131#if PLATFORM(IOS_FAMILY) && (CPU(ARM64) || CPU(ARM))
    132132    if (!enabled) {
     133        // Because of an OS quirk, even after the JIT region has been unmapped,
     134        // the OS thinks that region is reserved, and as such, can cause Gigacage
     135        // allocation to fail. We work around this by initializing the Gigacage
     136        // first.
     137        // Note: when called, setJITEnabled() is always called extra early in the
     138        // process bootstrap. Under normal operation (when setJITEnabled() isn't
     139        // called at all), we will naturally initialize the Gigacage before we
     140        // allocate the JIT region. Hence, this workaround is merely ensuring the
     141        // same behavior of allocation ordering.
     142        Gigacage::ensureGigacage();
     143
    133144        constexpr size_t size = 1;
    134145        constexpr int protection = PROT_READ | PROT_WRITE | PROT_EXEC;
Note: See TracChangeset for help on using the changeset viewer.