Bug 1233818 part 5 - Rename handlingSignal to handlingSegFault. r=luke
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 23 Dec 2015 11:28:54 +0100
changeset 277380 2267d84b2a9c40e897249e98a8303c551727e171
parent 277379 971decb703848b41402b1829933007d400ba377c
child 277381 011ba20fcaceadf3c2956e9844bd3abdaf786727
push id69479
push userjandemooij@gmail.com
push dateWed, 23 Dec 2015 10:37:01 +0000
treeherdermozilla-inbound@ed06bc78715d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1233818
milestone46.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 1233818 part 5 - Rename handlingSignal to handlingSegFault. r=luke
js/src/asmjs/AsmJSSignalHandlers.cpp
js/src/vm/Runtime.cpp
js/src/vm/Runtime.h
--- a/js/src/asmjs/AsmJSSignalHandlers.cpp
+++ b/js/src/asmjs/AsmJSSignalHandlers.cpp
@@ -53,32 +53,32 @@ RuntimeForCurrentThread()
     return threadData->runtimeIfOnOwnerThread();
 }
 
 // Crashing inside the signal handler can cause the handler to be recursively
 // invoked, eventually blowing the stack without actually showing a crash
 // report dialog via Breakpad. To guard against this we watch for such
 // recursion and fall through to the next handler immediately rather than
 // trying to handle it.
-class AutoSetHandlingSignal
+class AutoSetHandlingSegFault
 {
     JSRuntime* rt;
 
   public:
-    explicit AutoSetHandlingSignal(JSRuntime* rt)
+    explicit AutoSetHandlingSegFault(JSRuntime* rt)
       : rt(rt)
     {
-        MOZ_ASSERT(!rt->handlingSignal);
-        rt->handlingSignal = true;
+        MOZ_ASSERT(!rt->handlingSegFault);
+        rt->handlingSegFault = true;
     }
 
-    ~AutoSetHandlingSignal()
+    ~AutoSetHandlingSegFault()
     {
-        MOZ_ASSERT(rt->handlingSignal);
-        rt->handlingSignal = false;
+        MOZ_ASSERT(rt->handlingSegFault);
+        rt->handlingSegFault = false;
     }
 };
 
 #if defined(XP_WIN)
 # define XMM_sig(p,i) ((p)->Xmm##i)
 # define EIP_sig(p) ((p)->Eip)
 # define RIP_sig(p) ((p)->Rip)
 # define RAX_sig(p) ((p)->Rax)
@@ -740,21 +740,21 @@ HandleFault(PEXCEPTION_POINTERS exceptio
         return false;
 
     uint8_t** ppc = ContextToPC(context);
     uint8_t* pc = *ppc;
 
     if (record->NumberParameters < 2)
         return false;
 
-    // Don't allow recursive handling of signals, see AutoSetHandlingSignal.
+    // Don't allow recursive handling of signals, see AutoSetHandlingSegFault.
     JSRuntime* rt = RuntimeForCurrentThread();
-    if (!rt || rt->handlingSignal)
+    if (!rt || rt->handlingSegFault)
         return false;
-    AutoSetHandlingSignal handling(rt);
+    AutoSetHandlingSegFault handling(rt);
 
     AsmJSActivation* activation = rt->asmJSActivationStack();
     if (!activation)
         return false;
 
     const AsmJSModule& module = activation->module();
 
     // These checks aren't necessary, but, since we can, check anyway to make
@@ -849,20 +849,20 @@ struct ExceptionRequest
 {
     Request__mach_exception_raise_t body;
     mach_msg_trailer_t trailer;
 };
 
 static bool
 HandleMachException(JSRuntime* rt, const ExceptionRequest& request)
 {
-    // Don't allow recursive handling of signals, see AutoSetHandlingSignal.
-    if (rt->handlingSignal)
+    // Don't allow recursive handling of signals, see AutoSetHandlingSegFault.
+    if (rt->handlingSegFault)
         return false;
-    AutoSetHandlingSignal handling(rt);
+    AutoSetHandlingSegFault handling(rt);
 
     // Get the port of the JSRuntime's thread from the message.
     mach_port_t rtThread = request.body.thread.name;
 
     // Read out the JSRuntime thread's register state.
     EMULATOR_CONTEXT context;
 # if defined(JS_CODEGEN_X64)
     unsigned int thread_state_count = x86_THREAD_STATE64_COUNT;
@@ -1097,21 +1097,21 @@ HandleFault(int signum, siginfo_t* info,
     MOZ_RELEASE_ASSERT(signum == SIGSEGV);
     if (info->si_code != SEGV_ACCERR)
         return false;
 
     CONTEXT* context = (CONTEXT*)ctx;
     uint8_t** ppc = ContextToPC(context);
     uint8_t* pc = *ppc;
 
-    // Don't allow recursive handling of signals, see AutoSetHandlingSignal.
+    // Don't allow recursive handling of signals, see AutoSetHandlingSegFault.
     JSRuntime* rt = RuntimeForCurrentThread();
-    if (!rt || rt->handlingSignal)
+    if (!rt || rt->handlingSegFault)
         return false;
-    AutoSetHandlingSignal handling(rt);
+    AutoSetHandlingSegFault handling(rt);
 
     AsmJSActivation* activation = rt->asmJSActivationStack();
     if (!activation)
         return false;
 
     const AsmJSModule& module = activation->module();
     if (!module.containsFunctionPC(pc))
         return false;
@@ -1287,17 +1287,17 @@ js::EnsureSignalHandlersInstalled(JSRunt
     if (!AddVectoredExceptionHandler(/* FirstHandler = */ true, AsmJSFaultHandler))
         return false;
 # elif defined(XP_DARWIN)
     // OSX handles seg faults via the Mach exception handler above, so don't
     // install AsmJSFaultHandler.
 # else
     // SA_NODEFER allows us to reenter the signal handler if we crash while
     // handling the signal, and fall through to the Breakpad handler by testing
-    // handlingSignal.
+    // handlingSegFault.
     struct sigaction faultHandler;
     faultHandler.sa_flags = SA_SIGINFO | SA_NODEFER;
     faultHandler.sa_sigaction = &AsmJSFaultHandler;
     sigemptyset(&faultHandler.sa_mask);
     if (sigaction(SIGSEGV, &faultHandler, &sPrevSEGVHandler))
         MOZ_CRASH("unable to install segv handler");
 # endif
 #endif // defined(ASMJS_MAY_USE_SIGNAL_HANDLERS_FOR_OOB)
--- a/js/src/vm/Runtime.cpp
+++ b/js/src/vm/Runtime.cpp
@@ -140,17 +140,17 @@ JSRuntime::JSRuntime(JSRuntime* parentRu
     asmJSActivationStack_(nullptr),
     asyncStackForNewActivations(this),
     asyncCauseForNewActivations(this),
     asyncCallIsExplicit(false),
     entryMonitor(nullptr),
     parentRuntime(parentRuntime),
     interrupt_(false),
     telemetryCallback(nullptr),
-    handlingSignal(false),
+    handlingSegFault(false),
     interruptCallback(nullptr),
     exclusiveAccessLock(nullptr),
     exclusiveAccessOwner(nullptr),
     mainThreadHasExclusiveAccess(false),
     numExclusiveThreads(0),
     numCompartments(0),
     localeCallbacks(nullptr),
     defaultLocale(nullptr),
--- a/js/src/vm/Runtime.h
+++ b/js/src/vm/Runtime.h
@@ -837,18 +837,18 @@ struct JSRuntime : public JS::shadow::Ru
     }
 
     // For read-only JIT use:
     void* addressOfInterruptUint32() {
         static_assert(sizeof(interrupt_) == sizeof(uint32_t), "Assumed by JIT callers");
         return &interrupt_;
     }
 
-    /* Set when handling a signal for a thread associated with this runtime. */
-    bool handlingSignal;
+    // Set when handling a segfault in the asm.js signal handler.
+    bool handlingSegFault;
 
     JSInterruptCallback interruptCallback;
 
 #ifdef DEBUG
     void assertCanLock(js::RuntimeLock which);
 #else
     void assertCanLock(js::RuntimeLock which) {}
 #endif