Bug 965745 - Always patch loop backedges in Ion if interrupt flag is set. r=jandem, a=sledru
authorJon Coppeard <jcoppeard@mozilla.com>
Wed, 05 Feb 2014 14:09:41 +0000
changeset 182760 5093186ca570434e8744c5a9afaf317b9b043501
parent 182759 52535112e9ffd03d470a2d1b9f82f4182724c669
child 182761 24540c36c5158d88bfada765708c5c904c1e1f5e
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, sledru
bugs965745
milestone29.0a2
Bug 965745 - Always patch loop backedges in Ion if interrupt flag is set. r=jandem, a=sledru
js/src/jit/Ion.cpp
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -342,43 +342,42 @@ JitRuntime::handleAccessViolation(JSRunt
     JS_ASSERT(!rt->currentThreadOwnsOperationCallbackLock());
 #endif
 
     // Taking this lock is necessary to prevent the interrupting thread from marking
     // the memory as inaccessible while we are patching backedges. This will cause us
     // to SEGV while still inside the signal handler, and the process will terminate.
     JSRuntime::AutoLockForOperationCallback lock(rt);
 
+    // Ion code in the runtime faulted after it was made inaccessible. Reset
+    // the code privileges and patch all loop backedges to perform an interrupt
+    // check instead.
     ensureIonCodeAccessible(rt);
     return true;
 }
 
 void
 JitRuntime::ensureIonCodeAccessible(JSRuntime *rt)
 {
     JS_ASSERT(rt->currentThreadOwnsOperationCallbackLock());
 
     // This can only be called on the main thread and while handling signals,
     // which happens on a separate thread in OS X.
 #ifndef XP_MACOSX
     JS_ASSERT(CurrentThreadCanAccessRuntime(rt));
 #endif
 
-    if (!ionCodeProtected_)
-        return;
-
-    // Ion code in the runtime faulted after it was made inaccessible. Reset
-    // the code privileges and patch all loop backedges to perform an interrupt
-    // check instead.
-    ionAlloc_->toggleAllCodeAsAccessible(true);
-    ionCodeProtected_ = false;
+    if (ionCodeProtected_) {
+        ionAlloc_->toggleAllCodeAsAccessible(true);
+        ionCodeProtected_ = false;
+    }
 
     if (rt->interrupt) {
-        // The interrupt handler needs to be invoked by this thread, but we
-        // are inside a signal handler and have no idea what is above us on the
+        // The interrupt handler needs to be invoked by this thread, but we may
+        // be inside a signal handler and have no idea what is above us on the
         // stack (probably we are executing Ion code at an arbitrary point, but
         // we could be elsewhere, say repatching a jump for an IonCache).
         // Patch all backedges in the runtime so they will invoke the interrupt
         // handler the next time they execute.
         patchIonBackedges(rt, BackedgeInterruptCheck);
     }
 }