bug 1455210 remove misleading CycleCollectedJSContext null checks r=baku
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 16 Apr 2018 19:33:55 +1200
changeset 468769 7c7be4064df10bfade7511a9b25fb4b21511029c
parent 468768 b63e4bff951e97ce23e5673cb55a990a1bbb1a3c
child 468770 eb34acceb9dcba6faff9eee5e8c9183755ddd37a
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1455210
milestone61.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 1455210 remove misleading CycleCollectedJSContext null checks r=baku The caller of WorkerPrivate::DoRunLoop() keeps the WorkerJSContext alive, and so there will always be a CycleCollectedJSContext in DoRunLoop. WorkerPrivate::EnterDebuggerEventLoop() assumes that WorkerPrivate::GetJSContext() returns a JSContext, and so EnterDebuggerEventLoop also must only be called while DoRunLoop is on the stack and therefore keeping the WorkerJSContext alive. MozReview-Commit-ID: EJgt73LsTx1
dom/workers/WorkerPrivate.cpp
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -3335,19 +3335,17 @@ WorkerPrivate::DoRunLoop(JSContext* aCx)
         debuggerRunnablesPending = !mDebuggerQueue.IsEmpty();
       }
 
       MOZ_ASSERT(runnable);
       static_cast<nsIRunnable*>(runnable)->Run();
       runnable->Release();
 
       CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
-      if (ccjs) {
-        ccjs->PerformDebuggerMicroTaskCheckpoint();
-      }
+      ccjs->PerformDebuggerMicroTaskCheckpoint();
 
       if (debuggerRunnablesPending) {
         WorkerDebuggerGlobalScope* globalScope = DebuggerGlobalScope();
         MOZ_ASSERT(globalScope);
 
         // Now *might* be a good time to GC. Let the JS engine make the decision.
         JSAutoCompartment ac(aCx, globalScope->GetGlobalJSObject());
         JS_MaybeGC(aCx);
@@ -4435,19 +4433,17 @@ WorkerPrivate::EnterDebuggerEventLoop()
         WaitForWorkerEvents();
       }
 
       ProcessAllControlRunnablesLocked();
 
       // XXXkhuey should we abort JS on the stack here if we got Abort above?
     }
     CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
-    if (context) {
-      context->PerformDebuggerMicroTaskCheckpoint();
-    }
+    context->PerformDebuggerMicroTaskCheckpoint();
     if (debuggerRunnablesPending) {
       // Start the periodic GC timer if it is not already running.
       SetGCTimerMode(PeriodicTimer);
 
       WorkerRunnable* runnable = nullptr;
 
       {
         MutexAutoLock lock(mMutex);
@@ -4455,19 +4451,17 @@ WorkerPrivate::EnterDebuggerEventLoop()
         mDebuggerQueue.Pop(runnable);
       }
 
       MOZ_ASSERT(runnable);
       static_cast<nsIRunnable*>(runnable)->Run();
       runnable->Release();
 
       CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
-      if (ccjs) {
-        ccjs->PerformDebuggerMicroTaskCheckpoint();
-      }
+      ccjs->PerformDebuggerMicroTaskCheckpoint();
 
       // Now *might* be a good time to GC. Let the JS engine make the decision.
       if (JS::CurrentGlobalOrNull(cx)) {
         JS_MaybeGC(cx);
       }
     }
   }
 }