Bug 981201 - Stop using JS_IsRunning in PreciseGCRunnable::Run and remove JS_IsRunning. r=bholley
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 15 Nov 2016 10:58:30 +0100
changeset 322513 bf95e2986737f0250ed918bf216f15348108bfbb
parent 322512 fa5e948205052d195f08bff9ef5d750f15de4c9d
child 322514 5beca58068058e2531b1e50a38c000e5db44f0da
push id83897
push userjandemooij@gmail.com
push dateTue, 15 Nov 2016 09:59:53 +0000
treeherdermozilla-inbound@bf95e2986737 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs981201
milestone53.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 981201 - Stop using JS_IsRunning in PreciseGCRunnable::Run and remove JS_IsRunning. r=bholley
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jscntxt.cpp
js/src/jscntxt.h
js/xpconnect/src/XPCComponents.cpp
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -4876,22 +4876,16 @@ JS::SetAsyncTaskCallbacks(JSContext* cx,
 }
 
 JS_PUBLIC_API(void)
 JS_RequestInterruptCallback(JSContext* cx)
 {
     cx->requestInterrupt(JSRuntime::RequestInterruptUrgent);
 }
 
-JS_PUBLIC_API(bool)
-JS_IsRunning(JSContext* cx)
-{
-    return cx->currentlyRunning();
-}
-
 JS::AutoSetAsyncStackForNewCalls::AutoSetAsyncStackForNewCalls(
   JSContext* cx, HandleObject stack, const char* asyncCause,
   JS::AutoSetAsyncStackForNewCalls::AsyncCallKind kind)
   : cx(cx),
     oldAsyncStack(cx, cx->asyncStackForNewActivations),
     oldAsyncCause(cx->asyncCauseForNewActivations),
     oldAsyncCallIsExplicit(cx->asyncCallIsExplicit)
 {
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -4597,23 +4597,16 @@ typedef bool
 (*FinishAsyncTaskCallback)(AsyncTask* task);
 
 /**
  * Set the above callbacks for the given context.
  */
 extern JS_PUBLIC_API(void)
 SetAsyncTaskCallbacks(JSContext* cx, StartAsyncTaskCallback start, FinishAsyncTaskCallback finish);
 
-} // namespace JS
-
-extern JS_PUBLIC_API(bool)
-JS_IsRunning(JSContext* cx);
-
-namespace JS {
-
 /**
  * This class can be used to store a pointer to the youngest frame of a saved
  * stack in the specified JSContext. This reference will be picked up by any new
  * calls performed until the class is destroyed, with the specified asyncCause,
  * that must not be empty.
  *
  * Any stack capture initiated during these new calls will go through the async
  * stack instead of the current stack.
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -938,22 +938,16 @@ bool
 JSContext::isThrowingDebuggeeWouldRun()
 {
     return throwing &&
            unwrappedException_.isObject() &&
            unwrappedException_.toObject().is<ErrorObject>() &&
            unwrappedException_.toObject().as<ErrorObject>().type() == JSEXN_DEBUGGEEWOULDRUN;
 }
 
-bool
-JSContext::currentlyRunning() const
-{
-    return !!activation();
-}
-
 static bool
 ComputeIsJITBroken()
 {
 #if !defined(ANDROID)
     return false;
 #else  // ANDROID
     if (getenv("JS_IGNORE_JIT_BROKENNESS")) {
         return false;
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -445,19 +445,16 @@ struct JSContext : public js::ExclusiveC
     const char* asyncCauseForNewActivations;
 
     /*
      * True if the async call was explicitly requested, e.g. via
      * callFunctionWithAsyncStack.
      */
     bool asyncCallIsExplicit;
 
-    /* Whether this context has JS frames on the stack. */
-    bool currentlyRunning() const;
-
     bool currentlyRunningInInterpreter() const {
         return activation()->isInterpreter();
     }
     bool currentlyRunningInJit() const {
         return activation()->isJit();
     }
     js::InterpreterFrame* interpreterFrame() const {
         return activation()->asInterpreter()->current();
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -2622,20 +2622,16 @@ nsXPCComponents_Utils::ForceShrinkingGC(
 class PreciseGCRunnable : public Runnable
 {
   public:
     PreciseGCRunnable(ScheduledGCCallback* aCallback, bool aShrinking)
     : mCallback(aCallback), mShrinking(aShrinking) {}
 
     NS_IMETHOD Run() override
     {
-        JSContext* cx = dom::danger::GetJSContext();
-        if (JS_IsRunning(cx))
-            return NS_DispatchToMainThread(this);
-
         nsJSContext::GarbageCollectNow(gcreason::COMPONENT_UTILS,
                                        nsJSContext::NonIncrementalGC,
                                        mShrinking ?
                                          nsJSContext::ShrinkingGC :
                                          nsJSContext::NonShrinkingGC);
 
         mCallback->Callback();
         return NS_OK;