Bug 1167318 - Remove GetGCThingTraceKind in favor of the typed Cell variants; r=jonco

This commit is contained in:
Terrence Cole 2015-05-21 11:41:18 -07:00
parent 090d80ccdc
commit 31c36b64c3
4 changed files with 6 additions and 19 deletions

View File

@ -192,7 +192,7 @@ js::CheckTracedThing(JSTracer* trc, T thing)
MOZ_ASSERT(thing->isAligned());
MOZ_ASSERT(MapTypeToTraceKind<typename mozilla::RemovePointer<T>::Type>::kind ==
GetGCThingTraceKind(thing));
thing->getTraceKind());
/*
* Do not check IsMarkingTracer directly -- it should only be used in paths
@ -930,9 +930,9 @@ js::GCMarker::eagerlyMarkChildren(JSRope* rope)
// other ropes or linear strings, it cannot refer to GC things of other
// types.
ptrdiff_t savedPos = stack.position();
JS_DIAGNOSTICS_ASSERT(GetGCThingTraceKind(rope) == JSTRACE_STRING);
JS_DIAGNOSTICS_ASSERT(rope->getTraceKind() == JSTRACE_STRING);
while (true) {
JS_DIAGNOSTICS_ASSERT(GetGCThingTraceKind(rope) == JSTRACE_STRING);
JS_DIAGNOSTICS_ASSERT(rope->getTraceKind() == JSTRACE_STRING);
JS_DIAGNOSTICS_ASSERT(rope->JSString::isRope());
AssertZoneIsMarking(rope);
MOZ_ASSERT(rope->isMarked());
@ -1796,7 +1796,7 @@ void
js::gc::StoreBuffer::WholeCellEdges::trace(TenuringTracer& mover) const
{
MOZ_ASSERT(edge->isTenured());
JSGCTraceKind kind = GetGCThingTraceKind(edge);
JSGCTraceKind kind = edge->getTraceKind();
if (kind <= JSTRACE_OBJECT) {
JSObject *object = static_cast<JSObject*>(edge);
mover.traceObject(object);
@ -1824,7 +1824,7 @@ js::gc::StoreBuffer::CellPtrEdge::trace(TenuringTracer& mover) const
if (!*edge)
return;
MOZ_ASSERT(GetGCThingTraceKind(*edge) == JSTRACE_OBJECT);
MOZ_ASSERT((*edge)->getTraceKind() == JSTRACE_OBJECT);
mover.traverse(reinterpret_cast<JSObject**>(edge));
}

View File

@ -596,7 +596,7 @@ JS_FRIEND_API(JSGCTraceKind)
js::GCThingTraceKind(void* thing)
{
MOZ_ASSERT(thing);
return gc::GetGCThingTraceKind(thing);
return static_cast<js::gc::Cell*>(thing)->getTraceKind();
}
JS_FRIEND_API(void)

View File

@ -176,9 +176,6 @@ CanBeFinalizedInBackground(AllocKind kind, const Class* clasp)
(!clasp->finalize || (clasp->flags & JSCLASS_BACKGROUND_FINALIZE)));
}
inline JSGCTraceKind
GetGCThingTraceKind(const void* thing);
// Fortunately, few places in the system need to deal with fully abstract
// cells. In those places that do, we generally want to move to a layout
// templated function as soon as possible. This template wraps the upcast

View File

@ -26,16 +26,6 @@ GetGCObjectKind(const Class* clasp)
return GetGCObjectKind(nslots);
}
inline JSGCTraceKind
GetGCThingTraceKind(const void* thing)
{
MOZ_ASSERT(thing);
const Cell* cell = static_cast<const Cell*>(thing);
if (IsInsideNursery(cell))
return JSTRACE_OBJECT;
return MapAllocToTraceKind(cell->asTenured().getAllocKind());
}
inline void
GCRuntime::poke()
{