Bug 947683 - Fix --disable-threadsafe shell builds on OS X. r=luke, a=NPOTB
authorJan de Mooij <jdemooij@mozilla.com>
Mon, 09 Dec 2013 18:56:24 +0100
changeset 174298 423edfffe821b905a07645955afdd178dcb3bfb0
parent 174297 4ff63564d42e9a7c15cf36a902880b4b5c1d77ce
child 174299 86e26e292344d26897b1377903405a6f17bd4a64
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke, NPOTB
bugs947683
milestone28.0a2
Bug 947683 - Fix --disable-threadsafe shell builds on OS X. r=luke, a=NPOTB
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)