Bug 952650 (part 14) - Remove JSVAL_IS_GCTHING. r=till.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 28 Apr 2014 16:01:30 -0700
changeset 181304 eadb3ac8bc7f7115b8151f8c88818ea350568c20
parent 181303 582a4beff7b0d33d5acbb1ba8336b94b6dc1d2ef
child 181305 a97a14bb56df42807f0bbb13a379ba75601fc874
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewerstill
bugs952650
milestone32.0a1
Bug 952650 (part 14) - Remove JSVAL_IS_GCTHING. r=till.
dom/base/DOMRequest.cpp
dom/indexedDB/IDBIndex.cpp
dom/indexedDB/IDBObjectStore.cpp
dom/workers/XMLHttpRequest.cpp
js/jsd/jsd_val.cpp
js/public/Value.h
js/src/jsapi.cpp
js/src/jsapi.h
js/xpconnect/public/nsAutoJSValHolder.h
js/xpconnect/src/XPCVariant.cpp
--- a/dom/base/DOMRequest.cpp
+++ b/dom/base/DOMRequest.cpp
@@ -96,17 +96,17 @@ DOMRequest::GetError(nsISupports** aErro
 void
 DOMRequest::FireSuccess(JS::Handle<JS::Value> aResult)
 {
   NS_ASSERTION(!mDone, "mDone shouldn't have been set to true already!");
   NS_ASSERTION(!mError, "mError shouldn't have been set!");
   NS_ASSERTION(mResult == JSVAL_VOID, "mResult shouldn't have been set!");
 
   mDone = true;
-  if (JSVAL_IS_GCTHING(aResult)) {
+  if (aResult.isGCThing()) {
     RootResultVal();
   }
   mResult = aResult;
 
   FireEvent(NS_LITERAL_STRING("success"), false, false);
 }
 
 void
--- a/dom/indexedDB/IDBIndex.cpp
+++ b/dom/indexedDB/IDBIndex.cpp
@@ -833,17 +833,17 @@ IDBIndex::GetKeyPath(JSContext* aCx, Err
 
   if (!mCachedKeyPath.isUndefined()) {
     return mCachedKeyPath;
   }
 
   aRv = GetKeyPath().ToJSVal(aCx, mCachedKeyPath);
   ENSURE_SUCCESS(aRv, JSVAL_VOID);
 
-  if (JSVAL_IS_GCTHING(mCachedKeyPath)) {
+  if (mCachedKeyPath.isGCThing()) {
     mozilla::HoldJSObjects(this);
     mRooted = true;
   }
 
   return mCachedKeyPath;
 }
 
 already_AddRefed<IDBRequest>
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -2617,17 +2617,17 @@ IDBObjectStore::GetKeyPath(JSContext* aC
 
   if (!mCachedKeyPath.isUndefined()) {
     return mCachedKeyPath;
   }
 
   aRv = GetKeyPath().ToJSVal(aCx, mCachedKeyPath);
   ENSURE_SUCCESS(aRv, JSVAL_VOID);
 
-  if (JSVAL_IS_GCTHING(mCachedKeyPath)) {
+  if (mCachedKeyPath.isGCThing()) {
     mozilla::HoldJSObjects(this);
     mRooted = true;
   }
 
   return mCachedKeyPath;
 }
 
 already_AddRefed<DOMStringList>
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -2284,12 +2284,12 @@ XMLHttpRequest::GetResponseText(nsAStrin
   aRv = mStateData.mResponseTextResult;
   aResponseText = mStateData.mResponseText;
 }
 
 void
 XMLHttpRequest::UpdateState(const StateData& aStateData)
 {
   mStateData = aStateData;
-  if (JSVAL_IS_GCTHING(mStateData.mResponse)) {
+  if (mStateData.mResponse.isGCThing()) {
     mozilla::HoldJSObjects(this);
   }
 }
--- a/js/jsd/jsd_val.cpp
+++ b/js/jsd/jsd_val.cpp
@@ -242,17 +242,17 @@ jsd_NewValue(JSDContext* jsdc, jsval val
 {
     JS::RootedValue val(jsdc->jsrt, value);
     AutoSafeJSContext cx;
     JSDValue* jsdval;
 
     if(!(jsdval = (JSDValue*) calloc(1, sizeof(JSDValue))))
         return nullptr;
 
-    if(JSVAL_IS_GCTHING(val))
+    if(val.isGCThing())
     {
         bool ok;
         JSAutoCompartment ac(cx, jsdc->glob);
 
         ok = JS::AddNamedValueRoot(cx, &jsdval->val, "JSDValue");
         if(ok && val.isString()) {
             if(!JS_WrapValue(cx, &val)) {
                 ok = false;
@@ -274,17 +274,17 @@ jsd_NewValue(JSDContext* jsdc, jsval val
 
 void
 jsd_DropValue(JSDContext* jsdc, JSDValue* jsdval)
 {
     MOZ_ASSERT(jsdval->nref > 0);
     if(0 == --jsdval->nref)
     {
         jsd_RefreshValue(jsdc, jsdval);
-        if(JSVAL_IS_GCTHING(jsdval->val))
+        if(jsdval->val.isGCThing())
         {
             AutoSafeJSContext cx;
             JSAutoCompartment ac(cx, jsdc->glob);
             JS::RemoveValueRoot(cx, &jsdval->val);
         }
         free(jsdval);
     }
 }
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -1869,22 +1869,16 @@ OBJECT_TO_JSVAL(JSObject *obj)
 }
 
 static inline jsval
 BOOLEAN_TO_JSVAL(bool b)
 {
     return IMPL_TO_JSVAL(BOOLEAN_TO_JSVAL_IMPL(b));
 }
 
-static inline bool
-JSVAL_IS_GCTHING(jsval v)
-{
-    return JSVAL_IS_GCTHING_IMPL(JSVAL_TO_IMPL(v));
-}
-
 static inline void *
 JSVAL_TO_GCTHING(jsval v)
 {
     MOZ_ASSERT(JSVAL_IS_GCTHING(v));
     return JSVAL_TO_GCTHING_IMPL(JSVAL_TO_IMPL(v));
 }
 
 /* To be GC-safe, privates are tagged as doubles. */
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -5978,17 +5978,17 @@ JS_SaveExceptionState(JSContext *cx)
     JSExceptionState *state;
 
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     state = cx->pod_malloc<JSExceptionState>();
     if (state) {
         state->throwing =
             JS_GetPendingException(cx, MutableHandleValue::fromMarkedLocation(&state->exception));
-        if (state->throwing && JSVAL_IS_GCTHING(state->exception))
+        if (state->throwing && state->exception.isGCThing())
             AddValueRoot(cx, &state->exception, "JSExceptionState.exception");
     }
     return state;
 }
 
 JS_PUBLIC_API(void)
 JS_RestoreExceptionState(JSContext *cx, JSExceptionState *state)
 {
@@ -6004,17 +6004,17 @@ JS_RestoreExceptionState(JSContext *cx, 
 }
 
 JS_PUBLIC_API(void)
 JS_DropExceptionState(JSContext *cx, JSExceptionState *state)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     if (state) {
-        if (state->throwing && JSVAL_IS_GCTHING(state->exception)) {
+        if (state->throwing && state->exception.isGCThing()) {
             assertSameCompartment(cx, state->exception);
             RemoveRoot(cx->runtime(), &state->exception);
         }
         js_free(state);
     }
 }
 
 JS_PUBLIC_API(JSErrorReport *)
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -839,17 +839,17 @@ INTERNED_STRING_TO_JSID(JSContext *cx, J
 
 /*
  * Returns true iff the given jsval is immune to GC and can be used across
  * multiple JSRuntimes without requiring any conversion API.
  */
 static MOZ_ALWAYS_INLINE bool
 JSVAL_IS_UNIVERSAL(jsval v)
 {
-    return !JSVAL_IS_GCTHING(v);
+    return !v.isGCThing();
 }
 
 namespace JS {
 
 class AutoIdRooter : private AutoGCRooter
 {
   public:
     explicit AutoIdRooter(JSContext *cx, jsid aId = INT_TO_JSID(0)
--- a/js/xpconnect/public/nsAutoJSValHolder.h
+++ b/js/xpconnect/public/nsAutoJSValHolder.h
@@ -112,17 +112,17 @@ public:
   JS::Value get() const { return mVal; }
 
   nsAutoJSValHolder &operator=(JSObject* aOther) {
     return *this = OBJECT_TO_JSVAL(aOther);
   }
 
   nsAutoJSValHolder &operator=(JS::Value aOther) {
 #ifdef DEBUG
-    if (JSVAL_IS_GCTHING(aOther) && !aOther.isNull()) {
+    if (aOther.isGCThing() && !aOther.isNull()) {
       MOZ_ASSERT(IsHeld(), "Not rooted!");
     }
 #endif
     mVal = aOther;
     return *this;
   }
 
 private:
--- a/js/xpconnect/src/XPCVariant.cpp
+++ b/js/xpconnect/src/XPCVariant.cpp
@@ -51,17 +51,17 @@ XPCVariant::XPCVariant(JSContext* cx, js
     } else
         mReturnRawObject = false;
 }
 
 XPCTraceableVariant::~XPCTraceableVariant()
 {
     jsval val = GetJSValPreserveColor();
 
-    MOZ_ASSERT(JSVAL_IS_GCTHING(val), "Must be traceable or unlinked");
+    MOZ_ASSERT(val.isGCThing(), "Must be traceable or unlinked");
 
     // If val is JSVAL_STRING, we don't need to clean anything up; simply
     // removing the string from the root set is good.
     if (!val.isString())
         nsVariant::Cleanup(&mData);
 
     if (!val.isNull())
         RemoveFromRootSet();