Bug 1435360 - Baldr: jit::EnsureAsyncInterrupt() shouldn't cause JSRuntime failure if there is no async interrupt support on CLOSED TREE (r=me)
☠☠ backed out by 55c87e7ea09d ☠ ☠
authorLuke Wagner <luke@mozilla.com>
Fri, 09 Mar 2018 14:56:44 -0600
changeset 765598 e2a6bd47f69707533d8cb6eda535e9a011bfa8bd
parent 765597 6c2569d760cd117c7fc12fba9b1ffc9d9077082a
child 765599 5b750710adaa157b6fb593a5744bae758379f616
push id102114
push userbmo:jgilbert@mozilla.com
push dateFri, 09 Mar 2018 22:13:16 +0000
reviewersme
bugs1435360
milestone60.0a1
Bug 1435360 - Baldr: jit::EnsureAsyncInterrupt() shouldn't cause JSRuntime failure if there is no async interrupt support on CLOSED TREE (r=me)
js/src/jit/AsyncInterrupt.cpp
js/src/jit/AsyncInterrupt.h
js/src/vm/JSContext.cpp
--- a/js/src/jit/AsyncInterrupt.cpp
+++ b/js/src/jit/AsyncInterrupt.cpp
@@ -76,35 +76,35 @@ JitAsyncInterruptHandler(int signum, sig
 
     cx->finishHandlingJitInterrupt();
 }
 #endif
 
 static bool sTriedInstallAsyncInterrupt = false;
 static bool sHaveAsyncInterrupt = false;
 
-bool
+void
 jit::EnsureAsyncInterrupt(JSContext* cx)
 {
     // We assume that there are no races creating the first JSRuntime of the process.
     if (sTriedInstallAsyncInterrupt)
-        return sHaveAsyncInterrupt;
+        return;
     sTriedInstallAsyncInterrupt = true;
 
 #if defined(ANDROID) && !defined(__aarch64__)
     // Before Android 4.4 (SDK version 19), there is a bug
     //   https://android-review.googlesource.com/#/c/52333
     // in Bionic's pthread_join which causes pthread_join to return early when
     // pthread_kill is used (on any thread). Nobody expects the pthread_cond_wait
     // EINTRquisition.
     char version_string[PROP_VALUE_MAX];
     PodArrayZero(version_string);
     if (__system_property_get("ro.build.version.sdk", version_string) > 0) {
         if (atol(version_string) < 19)
-            return false;
+            return;
     }
 #endif
 
 #if defined(XP_WIN)
     // Windows uses SuspendThread to stop the active thread from another thread.
 #else
     struct sigaction interruptHandler;
     interruptHandler.sa_flags = SA_SIGINFO;
@@ -120,17 +120,16 @@ jit::EnsureAsyncInterrupt(JSContext* cx)
     if ((prev.sa_flags & SA_SIGINFO && prev.sa_sigaction) ||
         (prev.sa_handler != SIG_DFL && prev.sa_handler != SIG_IGN))
     {
         MOZ_CRASH("contention for interrupt signal");
     }
 #endif // defined(XP_WIN)
 
     sHaveAsyncInterrupt = true;
-    return true;
 }
 
 bool
 jit::HaveAsyncInterrupt()
 {
     MOZ_ASSERT(sTriedInstallAsyncInterrupt);
     return sHaveAsyncInterrupt;
 }
--- a/js/src/jit/AsyncInterrupt.h
+++ b/js/src/jit/AsyncInterrupt.h
@@ -10,17 +10,17 @@
 #include "NamespaceImports.h"
 
 namespace js {
 namespace jit {
 
 // Ensure the given JSRuntime is set up to use async interrupts. Failure to
 // enable signal handlers indicates some catastrophic failure and creation of
 // the runtime must fail.
-MOZ_MUST_USE bool
+void
 EnsureAsyncInterrupt(JSContext* cx);
 
 // Return whether the async interrupt can be used to interrupt Ion code.
 bool
 HaveAsyncInterrupt();
 
 // Force any currently-executing JIT code to call HandleExecutionInterrupt.
 extern void
--- a/js/src/vm/JSContext.cpp
+++ b/js/src/vm/JSContext.cpp
@@ -123,18 +123,17 @@ JSContext::init(ContextKind kind)
             return false;
 
 #ifdef JS_SIMULATOR
         simulator_ = jit::Simulator::Create(this);
         if (!simulator_)
             return false;
 #endif
 
-        if (!jit::EnsureAsyncInterrupt(this))
-            return false;
+        jit::EnsureAsyncInterrupt(this);
         if (!wasm::EnsureSignalHandlers(this))
             return false;
     }
 
     // Set the ContextKind last, so that ProtectedData checks will allow us to
     // initialize this context before it becomes the runtime's active context.
     kind_ = kind;