Bug 996052 - Remove JSVAL_TRACE_KIND, JSVAL_IS_GCTHING and JSVAL_TO_GCTHING r=terrence

This commit is contained in:
Jon Coppeard 2014-04-17 09:36:32 +01:00
Родитель 3bf69c3c8e
Коммит b1182ccb9f
5 изменённых файлов: 9 добавлений и 41 удалений

Просмотреть файл

@ -744,9 +744,9 @@ CountHeap(JSContext *cx, unsigned argc, jsval *vp)
RootedValue startValue(cx, UndefinedValue());
if (args.length() > 0) {
jsval v = args[0];
if (JSVAL_IS_TRACEABLE(v)) {
if (v.isMarkable()) {
startValue = v;
} else if (!JSVAL_IS_NULL(v)) {
} else if (!v.isNull()) {
JS_ReportError(cx,
"the first argument is not null or a heap-allocated "
"thing");
@ -771,11 +771,11 @@ CountHeap(JSContext *cx, unsigned argc, jsval *vp)
return false;
}
traceValue = args[2];
if (!JSVAL_IS_TRACEABLE(traceValue)){
if (!traceValue.isMarkable()){
JS_ReportError(cx, "cannot trace this kind of value");
return false;
}
traceThing = JSVAL_TO_TRACEABLE(traceValue);
traceThing = traceValue.toGCThing();
} else {
for (size_t i = 0; ;) {
if (JS_FlatStringEqualsAscii(flatStr, traceKindNames[i].name)) {

Просмотреть файл

@ -352,7 +352,7 @@ JS::HeapCellRelocate(js::gc::Cell **cellp)
JS_PUBLIC_API(void)
JS::HeapValuePostBarrier(JS::Value *valuep)
{
JS_ASSERT(JSVAL_IS_TRACEABLE(*valuep));
JS_ASSERT(valuep->isMarkable());
if (valuep->isString() && StringIsPermanentAtom(valuep->toString()))
return;
JSRuntime *runtime = static_cast<js::gc::Cell *>(valuep->toGCThing())->runtimeFromMainThread();
@ -363,7 +363,7 @@ JS_PUBLIC_API(void)
JS::HeapValueRelocate(JS::Value *valuep)
{
/* Called with old contents of *valuep before overwriting. */
JS_ASSERT(JSVAL_IS_TRACEABLE(*valuep));
JS_ASSERT(valuep->isMarkable());
if (valuep->isString() && StringIsPermanentAtom(valuep->toString()))
return;
JSRuntime *runtime = static_cast<js::gc::Cell *>(valuep->toGCThing())->runtimeFromMainThread();

Просмотреть файл

@ -1980,38 +1980,6 @@ JS_AddExtraGCRootsTracer(JSRuntime *rt, JSTraceDataOp traceOp, void *data);
extern JS_PUBLIC_API(void)
JS_RemoveExtraGCRootsTracer(JSRuntime *rt, JSTraceDataOp traceOp, void *data);
/*
* JS_CallTracer API and related macros for implementors of JSTraceOp, to
* enumerate all references to traceable things reachable via a property or
* other strong ref identified for debugging purposes by name or index or
* a naming callback.
*
* See the JSTraceOp typedef.
*/
/*
* Use the following macros to check if a particular jsval is a traceable
* thing and to extract the thing and its kind to pass to JS_CallTracer.
*/
static MOZ_ALWAYS_INLINE bool
JSVAL_IS_TRACEABLE(jsval v)
{
return JSVAL_IS_TRACEABLE_IMPL(JSVAL_TO_IMPL(v));
}
static MOZ_ALWAYS_INLINE void *
JSVAL_TO_TRACEABLE(jsval v)
{
return JSVAL_TO_GCTHING(v);
}
static MOZ_ALWAYS_INLINE JSGCTraceKind
JSVAL_TRACE_KIND(jsval v)
{
JS_ASSERT(JSVAL_IS_GCTHING(v));
return (JSGCTraceKind) JSVAL_TRACE_KIND_IMPL(JSVAL_TO_IMPL(v));
}
#ifdef JS_DEBUG
/*

Просмотреть файл

@ -97,7 +97,7 @@ enum JSIterateOp {
JSENUMERATE_DESTROY
};
/* See JSVAL_TRACE_KIND and JSTraceCallback in jsapi.h. */
/* See Value::gcKind() and JSTraceCallback in Tracer.h. */
enum JSGCTraceKind {
JSTRACE_OBJECT,
JSTRACE_STRING,

Просмотреть файл

@ -69,7 +69,7 @@ XPCTraceableVariant::~XPCTraceableVariant()
void XPCTraceableVariant::TraceJS(JSTracer* trc)
{
MOZ_ASSERT(JSVAL_IS_TRACEABLE(mJSVal));
MOZ_ASSERT(mJSVal.isMarkable());
JS_SET_TRACING_DETAILS(trc, GetTraceName, this, 0);
JS_CallHeapValueTracer(trc, &mJSVal, "XPCTraceableVariant::mJSVal");
}
@ -115,7 +115,7 @@ XPCVariant::newVariant(JSContext* cx, jsval aJSVal)
{
nsRefPtr<XPCVariant> variant;
if (!JSVAL_IS_TRACEABLE(aJSVal))
if (!aJSVal.isMarkable())
variant = new XPCVariant(cx, aJSVal);
else
variant = new XPCTraceableVariant(cx, aJSVal);