Changeset 263055 in webkit


Ignore:
Timestamp:
Jun 15, 2020, 12:59:24 PM (5 years ago)
Author:
mark.lam@apple.com
Message:

Do not install the VMTraps signal handler if Options::useJIT=false.
https://bugs.webkit.org/show_bug.cgi?id=212543
<rdar://problem/63772519>

Reviewed by Keith Miller.

VMTraps is only needed for JITted code. Hence, if the JIT is disabled, we should
set Options::usePollingTraps() to true to indicate that we won't be using VMTraps.

With this change, we no longer install any signal handling machinery if
Options::useJIT() is false.

Because we may still disable the JIT even if useJIT() is true (due to failure to
allocate JIT memory or a number of other factors), we will also add a check of
VM::canUseJIT() in initializeThreading(), and disable useJIT() if needed. Of
course, this also means we need to call Options::recomputeDependentOptions() to
make other options consistent with useJIT() being false.

  • runtime/InitializeThreading.cpp:

(JSC::initializeThreading):

  • runtime/Options.cpp:

(JSC::disableAllJITOptions):
(JSC::Options::recomputeDependentOptions):
(JSC::recomputeDependentOptions): Deleted.

  • runtime/Options.h:
  • runtime/VMTraps.cpp:

(JSC::VMTraps::initializeSignals):

  • tools/SigillCrashAnalyzer.cpp:

(JSC::SigillCrashAnalyzer::instance):

Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r263054 r263055  
     12020-06-15  Mark Lam  <mark.lam@apple.com>
     2
     3        Do not install the VMTraps signal handler if Options::useJIT=false.
     4        https://bugs.webkit.org/show_bug.cgi?id=212543
     5        <rdar://problem/63772519>
     6
     7        Reviewed by Keith Miller.
     8
     9        VMTraps is only needed for JITted code.  Hence, if the JIT is disabled, we should
     10        set Options::usePollingTraps() to true to indicate that we won't be using VMTraps.
     11
     12        With this change, we no longer install any signal handling machinery if
     13        Options::useJIT() is false.
     14
     15        Because we may still disable the JIT even if useJIT() is true (due to failure to
     16        allocate JIT memory or a number of other factors), we will also add a check of
     17        VM::canUseJIT() in initializeThreading(), and disable useJIT() if needed.  Of
     18        course, this also means we need to call Options::recomputeDependentOptions() to
     19        make other options consistent with useJIT() being false.
     20
     21        * runtime/InitializeThreading.cpp:
     22        (JSC::initializeThreading):
     23        * runtime/Options.cpp:
     24        (JSC::disableAllJITOptions):
     25        (JSC::Options::recomputeDependentOptions):
     26        (JSC::recomputeDependentOptions): Deleted.
     27        * runtime/Options.h:
     28        * runtime/VMTraps.cpp:
     29        (JSC::VMTraps::initializeSignals):
     30        * tools/SigillCrashAnalyzer.cpp:
     31        (JSC::SigillCrashAnalyzer::instance):
     32
    1332020-06-15  Keith Miller  <keith_miller@apple.com>
    234
  • trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp

    r263045 r263055  
    6767        ExecutableAllocator::initialize();
    6868        VM::computeCanUseJIT();
     69        if (!VM::canUseJIT()) {
     70            Options::useJIT() = false;
     71            Options::recomputeDependentOptions();
     72        }
    6973
    70         if (VM::canUseJIT() && Options::useSigillCrashAnalyzer())
     74        if (Options::useSigillCrashAnalyzer())
    7175            enableSigillCrashAnalyzer();
    7276
  • trunk/Source/JavaScriptCore/runtime/Options.cpp

    r263046 r263055  
    11/*
    2  * Copyright (C) 2011-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    376376}
    377377
    378 static void recomputeDependentOptions()
    379 {
    380 #if !defined(NDEBUG)
    381     Options::validateDFGExceptionHandling() = true;
    382 #endif
    383 #if !ENABLE(JIT)
     378static void disableAllJITOptions()
     379{
    384380    Options::useLLInt() = true;
    385381    Options::useJIT() = false;
     
    389385    Options::useDOMJIT() = false;
    390386    Options::useRegExpJIT() = false;
     387}
     388
     389void Options::recomputeDependentOptions()
     390{
     391#if !defined(NDEBUG)
     392    Options::validateDFGExceptionHandling() = true;
     393#endif
     394#if !ENABLE(JIT)
     395    disableAllJITOptions();
    391396#endif
    392397#if !ENABLE(CONCURRENT_JS)
     
    408413#endif
    409414
     415    // At initialization time, we may decide that useJIT should be false for any
     416    // number of reasons (including failing to allocate JIT memory), and therefore,
     417    // will / should not be able to enable any JIT related services.
    410418    if (!Options::useJIT()) {
     419        disableAllJITOptions();
     420        Options::useConcurrentJIT() = false;
    411421        Options::useSigillCrashAnalyzer() = false;
    412422        Options::useWebAssembly() = false;
     423        Options::usePollingTraps() = true;
    413424    }
    414425
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r253164 r263055  
    11/*
    2  * Copyright (C) 2011-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8888
    8989    JS_EXPORT_PRIVATE static void ensureOptionsAreCoherent();
     90    static void recomputeDependentOptions();
    9091
    9192#define DECLARE_OPTION_ACCESSORS(type_, name_, defaultValue_, availability_, description_) \
  • trunk/Source/JavaScriptCore/runtime/VMTraps.cpp

    r263045 r263055  
    298298{
    299299#if ENABLE(SIGNAL_BASED_VM_TRAPS)
    300     if (!Options::usePollingTraps())
     300    if (!Options::usePollingTraps()) {
     301        ASSERT(Options::useJIT());
    301302        SignalSender::initializeSignals();
     303    }
    302304#endif
    303305}
  • trunk/Source/JavaScriptCore/tools/SigillCrashAnalyzer.cpp

    r263045 r263055  
    11/*
    2  * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    200200    static std::once_flag once;
    201201    std::call_once(once, [] {
     202        ASSERT(Options::useJIT());
    202203        installCrashHandler();
    203204        analyzer = new SigillCrashAnalyzer;
Note: See TracChangeset for help on using the changeset viewer.