- Revision
- 263055
- Author
- mark....@apple.com
- Date
- 2020-06-15 12:59:24 -0700 (Mon, 15 Jun 2020)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (263054 => 263055)
--- trunk/Source/_javascript_Core/ChangeLog 2020-06-15 19:50:03 UTC (rev 263054)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-06-15 19:59:24 UTC (rev 263055)
@@ -1,3 +1,35 @@
+2020-06-15 Mark Lam <mark....@apple.com>
+
+ 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):
+
2020-06-15 Keith Miller <keith_mil...@apple.com>
CheckIsConstant should not use BadCache exit kind
Modified: trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp (263054 => 263055)
--- trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp 2020-06-15 19:50:03 UTC (rev 263054)
+++ trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp 2020-06-15 19:59:24 UTC (rev 263055)
@@ -66,8 +66,12 @@
ExecutableAllocator::initialize();
VM::computeCanUseJIT();
+ if (!VM::canUseJIT()) {
+ Options::useJIT() = false;
+ Options::recomputeDependentOptions();
+ }
- if (VM::canUseJIT() && Options::useSigillCrashAnalyzer())
+ if (Options::useSigillCrashAnalyzer())
enableSigillCrashAnalyzer();
LLInt::initialize();
Modified: trunk/Source/_javascript_Core/runtime/Options.cpp (263054 => 263055)
--- trunk/Source/_javascript_Core/runtime/Options.cpp 2020-06-15 19:50:03 UTC (rev 263054)
+++ trunk/Source/_javascript_Core/runtime/Options.cpp 2020-06-15 19:59:24 UTC (rev 263055)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -375,12 +375,8 @@
Options::thresholdForGlobalLexicalBindingEpoch() = UINT_MAX;
}
-static void recomputeDependentOptions()
+static void disableAllJITOptions()
{
-#if !defined(NDEBUG)
- Options::validateDFGExceptionHandling() = true;
-#endif
-#if !ENABLE(JIT)
Options::useLLInt() = true;
Options::useJIT() = false;
Options::useBaselineJIT() = false;
@@ -388,7 +384,16 @@
Options::useFTLJIT() = false;
Options::useDOMJIT() = false;
Options::useRegExpJIT() = false;
+}
+
+void Options::recomputeDependentOptions()
+{
+#if !defined(NDEBUG)
+ Options::validateDFGExceptionHandling() = true;
#endif
+#if !ENABLE(JIT)
+ disableAllJITOptions();
+#endif
#if !ENABLE(CONCURRENT_JS)
Options::useConcurrentJIT() = false;
#endif
@@ -407,9 +412,15 @@
Options::useConcurrentGC() = false;
#endif
+ // At initialization time, we may decide that useJIT should be false for any
+ // number of reasons (including failing to allocate JIT memory), and therefore,
+ // will / should not be able to enable any JIT related services.
if (!Options::useJIT()) {
+ disableAllJITOptions();
+ Options::useConcurrentJIT() = false;
Options::useSigillCrashAnalyzer() = false;
Options::useWebAssembly() = false;
+ Options::usePollingTraps() = true;
}
if (!jitEnabledByDefault() && !Options::useJIT())
Modified: trunk/Source/_javascript_Core/runtime/Options.h (263054 => 263055)
--- trunk/Source/_javascript_Core/runtime/Options.h 2020-06-15 19:50:03 UTC (rev 263054)
+++ trunk/Source/_javascript_Core/runtime/Options.h 2020-06-15 19:59:24 UTC (rev 263055)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -87,6 +87,7 @@
JS_EXPORT_PRIVATE static void dumpAllOptionsInALine(StringBuilder&);
JS_EXPORT_PRIVATE static void ensureOptionsAreCoherent();
+ static void recomputeDependentOptions();
#define DECLARE_OPTION_ACCESSORS(type_, name_, defaultValue_, availability_, description_) \
ALWAYS_INLINE static OptionsStorage::type_& name_() { return g_jscConfig.options.name_; } \
Modified: trunk/Source/_javascript_Core/runtime/VMTraps.cpp (263054 => 263055)
--- trunk/Source/_javascript_Core/runtime/VMTraps.cpp 2020-06-15 19:50:03 UTC (rev 263054)
+++ trunk/Source/_javascript_Core/runtime/VMTraps.cpp 2020-06-15 19:59:24 UTC (rev 263055)
@@ -297,8 +297,10 @@
void VMTraps::initializeSignals()
{
#if ENABLE(SIGNAL_BASED_VM_TRAPS)
- if (!Options::usePollingTraps())
+ if (!Options::usePollingTraps()) {
+ ASSERT(Options::useJIT());
SignalSender::initializeSignals();
+ }
#endif
}
Modified: trunk/Source/_javascript_Core/tools/SigillCrashAnalyzer.cpp (263054 => 263055)
--- trunk/Source/_javascript_Core/tools/SigillCrashAnalyzer.cpp 2020-06-15 19:50:03 UTC (rev 263054)
+++ trunk/Source/_javascript_Core/tools/SigillCrashAnalyzer.cpp 2020-06-15 19:59:24 UTC (rev 263055)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -199,6 +199,7 @@
static SigillCrashAnalyzer* analyzer;
static std::once_flag once;
std::call_once(once, [] {
+ ASSERT(Options::useJIT());
installCrashHandler();
analyzer = new SigillCrashAnalyzer;
});