From cdfc960ca4190b9250f7c11a22306409bfbfbe24 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Sun, 3 Feb 2013 20:16:19 -0800 Subject: [PATCH] Bug 837566 - Remove js_RemoveRoot. r=terrence. --HG-- extra : rebase_source : b3b615c34cfa4b9766a3484060242498c5a57e63 --- dom/plugins/base/nsJSNPRuntime.cpp | 2 +- js/src/jsapi.cpp | 16 ++++++++-------- js/src/jsapi.h | 5 ----- js/src/jsgc.cpp | 6 +++--- js/src/jsgc.h | 3 +++ js/src/vm/OldDebugAPI.cpp | 6 +++--- js/xpconnect/public/nsAutoJSValHolder.h | 2 +- 7 files changed, 19 insertions(+), 21 deletions(-) diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index e2c682add5e..a26514affff 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -524,7 +524,7 @@ nsJSObjWrapper::NP_Invalidate(NPObject *npobj) if (jsnpobj && jsnpobj->mJSObj) { // Unroot the object's JSObject - js_RemoveRoot(sJSRuntime, &jsnpobj->mJSObj); + JS_RemoveObjectRootRT(sJSRuntime, &jsnpobj->mJSObj); if (sJSObjWrappers.ops) { // Remove the wrapper from the hash diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 0b89746864f..fb38ad6f532 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -1654,52 +1654,52 @@ JS_PUBLIC_API(void) JS_RemoveValueRoot(JSContext *cx, jsval *vp) { CHECK_REQUEST(cx); - js_RemoveRoot(cx->runtime(), (void *)vp); + RemoveRoot(cx->runtime(), (void *)vp); } JS_PUBLIC_API(void) JS_RemoveStringRoot(JSContext *cx, JSString **rp) { CHECK_REQUEST(cx); - js_RemoveRoot(cx->runtime(), (void *)rp); + RemoveRoot(cx->runtime(), (void *)rp); } JS_PUBLIC_API(void) JS_RemoveObjectRoot(JSContext *cx, JSObject **rp) { CHECK_REQUEST(cx); - js_RemoveRoot(cx->runtime(), (void *)rp); + RemoveRoot(cx->runtime(), (void *)rp); } JS_PUBLIC_API(void) JS_RemoveScriptRoot(JSContext *cx, JSScript **rp) { CHECK_REQUEST(cx); - js_RemoveRoot(cx->runtime(), (void *)rp); + RemoveRoot(cx->runtime(), (void *)rp); } JS_PUBLIC_API(void) JS_RemoveValueRootRT(JSRuntime *rt, jsval *vp) { - js_RemoveRoot(rt, (void *)vp); + RemoveRoot(rt, (void *)vp); } JS_PUBLIC_API(void) JS_RemoveStringRootRT(JSRuntime *rt, JSString **rp) { - js_RemoveRoot(rt, (void *)rp); + RemoveRoot(rt, (void *)rp); } JS_PUBLIC_API(void) JS_RemoveObjectRootRT(JSRuntime *rt, JSObject **rp) { - js_RemoveRoot(rt, (void *)rp); + RemoveRoot(rt, (void *)rp); } JS_PUBLIC_API(void) JS_RemoveScriptRootRT(JSRuntime *rt, JSScript **rp) { - js_RemoveRoot(rt, (void *)rp); + RemoveRoot(rt, (void *)rp); } JS_NEVER_INLINE JS_PUBLIC_API(void) diff --git a/js/src/jsapi.h b/js/src/jsapi.h index f26ae68bce8..9b4b43ac51b 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -1980,11 +1980,6 @@ JS_RemoveObjectRootRT(JSRuntime *rt, JSObject **rp); extern JS_PUBLIC_API(void) JS_RemoveScriptRootRT(JSRuntime *rt, JSScript **rp); -/* TODO: remove these APIs */ - -extern JS_FRIEND_API(void) -js_RemoveRoot(JSRuntime *rt, void *rp); - /* * C-compatible version of the Anchor class. It should be called after the last * use of the variable it protects. diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index d0db35c7834..ccb99a69b5c 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -1104,11 +1104,11 @@ js_AddObjectRoot(JSRuntime *rt, JSObject **objp) extern JS_FRIEND_API(void) js_RemoveObjectRoot(JSRuntime *rt, JSObject **objp) { - js_RemoveRoot(rt, objp); + RemoveRoot(rt, objp); } -JS_FRIEND_API(void) -js_RemoveRoot(JSRuntime *rt, void *rp) +void +js::RemoveRoot(JSRuntime *rt, void *rp) { rt->gcRootsHash.remove(rp); rt->gcPoke = true; diff --git a/js/src/jsgc.h b/js/src/jsgc.h index 01152d5528c..dc9e3416832 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -668,6 +668,9 @@ AddObjectRoot(JSRuntime *rt, JSObject **rp, const char *name); extern bool AddScriptRoot(JSContext *cx, JSScript **rp, const char *name); +extern void +RemoveRoot(JSRuntime *rt, void *rp); + } /* namespace js */ extern bool diff --git a/js/src/vm/OldDebugAPI.cpp b/js/src/vm/OldDebugAPI.cpp index 96ce76af49d..dd28fcd9df3 100644 --- a/js/src/vm/OldDebugAPI.cpp +++ b/js/src/vm/OldDebugAPI.cpp @@ -754,10 +754,10 @@ JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda) pd = pda->array; for (i = 0; i < pda->length; i++) { - js_RemoveRoot(cx->runtime(), &pd[i].id); - js_RemoveRoot(cx->runtime(), &pd[i].value); + RemoveRoot(cx->runtime(), &pd[i].id); + RemoveRoot(cx->runtime(), &pd[i].value); if (pd[i].flags & JSPD_ALIAS) - js_RemoveRoot(cx->runtime(), &pd[i].alias); + RemoveRoot(cx->runtime(), &pd[i].alias); } js_free(pd); pda->array = nullptr; diff --git a/js/xpconnect/public/nsAutoJSValHolder.h b/js/xpconnect/public/nsAutoJSValHolder.h index 4a737f33eee..6577388fec4 100644 --- a/js/xpconnect/public/nsAutoJSValHolder.h +++ b/js/xpconnect/public/nsAutoJSValHolder.h @@ -64,7 +64,7 @@ public: bool Hold(JSRuntime* aRt) { // Do we really care about different runtimes? if (mRt && aRt != mRt) { - js_RemoveRoot(mRt, &mVal); + JS_RemoveValueRootRT(mRt, &mVal); mRt = nullptr; }