Bug 947683 - Fix --disable-threadsafe shell builds on OS X. r=luke
authorJan de Mooij <jdemooij@mozilla.com>
Mon, 09 Dec 2013 18:56:24 +0100
changeset 159507 f6d5a48271b6ac51fa7da369273e8cb94abe2d21
parent 159506 74e803227d04d4032f276804ef7e20d0e5d6fd69
child 159508 79340a11b93cac2c995a095ab0d89dbd55e77d12
push id37342
push userjandemooij@gmail.com
push dateMon, 09 Dec 2013 17:57:15 +0000
treeherdermozilla-inbound@f6d5a48271b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs947683
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 947683 - Fix --disable-threadsafe shell builds on OS X. r=luke
js/src/jit/AsmJSSignalHandlers.cpp
--- a/js/src/jit/AsmJSSignalHandlers.cpp
+++ b/js/src/jit/AsmJSSignalHandlers.cpp
@@ -739,16 +739,17 @@ AsmJSMachExceptionHandler::AsmJSMachExce
   : installed_(false),
     thread_(nullptr),
     port_(MACH_PORT_NULL)
 {}
 
 void
 AsmJSMachExceptionHandler::uninstall()
 {
+#ifdef JS_THREADSAFE
     if (installed_) {
         thread_port_t thread = mach_thread_self();
         kern_return_t kret = thread_set_exception_ports(thread,
                                                         EXC_MASK_BAD_ACCESS,
                                                         MACH_PORT_NULL,
                                                         EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES,
                                                         THREAD_STATE_NONE);
         mach_port_deallocate(mach_task_self(), thread);
@@ -776,21 +777,25 @@ AsmJSMachExceptionHandler::uninstall()
         PR_JoinThread(thread_);
         thread_ = nullptr;
     }
     if (port_ != MACH_PORT_NULL) {
         DebugOnly<kern_return_t> kret = mach_port_destroy(mach_task_self(), port_);
         JS_ASSERT(kret == KERN_SUCCESS);
         port_ = MACH_PORT_NULL;
     }
+#else
+    JS_ASSERT(!installed_);
+#endif
 }
 
 bool
 AsmJSMachExceptionHandler::install(JSRuntime *rt)
 {
+#ifdef JS_THREADSAFE
     JS_ASSERT(!installed());
     kern_return_t kret;
     mach_port_t thread;
 
     // Get a port which can send and receive data.
     kret = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port_);
     if (kret != KERN_SUCCESS)
         goto error;
@@ -820,16 +825,19 @@ AsmJSMachExceptionHandler::install(JSRun
         goto error;
 
     installed_ = true;
     return true;
 
   error:
     uninstall();
     return false;
+#else
+    return false;
+#endif
 }
 
 #else  // If not Windows or Mac, assume Unix
 
 // Be very cautious and default to not handling; we don't want to accidentally
 // silence real crashes from real bugs.
 static bool
 HandleSignal(int signum, siginfo_t *info, void *ctx)