Bug 1135100 - Don't bother to check if things we don't relocate have been forwarded r=terrence

This commit is contained in:
Jon Coppeard 2015-02-24 09:40:02 +00:00
parent 1092db39e8
commit 897cfb6589
2 changed files with 36 additions and 0 deletions

View File

@ -1935,6 +1935,12 @@ CanRelocateAllocKind(AllocKind kind)
return kind <= FINALIZE_OBJECT_LAST;
}
static bool
CanRelocateTraceKind(JSGCTraceKind kind)
{
return kind == JSTRACE_OBJECT;
}
size_t ArenaHeader::countFreeCells()
{
@ -2249,6 +2255,11 @@ void
MovingTracer::Visit(JSTracer *jstrc, void **thingp, JSGCTraceKind kind)
{
TenuredCell *thing = TenuredCell::fromPointer(*thingp);
if (!CanRelocateTraceKind(kind)) {
MOZ_ASSERT(!IsForwarded(thing));
return;
}
Zone *zone = thing->zoneFromAnyThread();
if (!zone->isGCCompacting()) {
MOZ_ASSERT(!IsForwarded(thing));

View File

@ -1186,11 +1186,36 @@ class RelocationOverlay
/* Functions for checking and updating things that might be moved by compacting GC. */
#define TYPE_MIGHT_BE_FORWARDED(T, value) \
inline bool \
TypeMightBeForwarded(T *thing) \
{ \
return value; \
} \
TYPE_MIGHT_BE_FORWARDED(Cell, true)
TYPE_MIGHT_BE_FORWARDED(JSObject, true)
TYPE_MIGHT_BE_FORWARDED(JSString, false)
TYPE_MIGHT_BE_FORWARDED(JS::Symbol, false)
TYPE_MIGHT_BE_FORWARDED(JSScript, false)
TYPE_MIGHT_BE_FORWARDED(Shape, false)
TYPE_MIGHT_BE_FORWARDED(BaseShape, false)
TYPE_MIGHT_BE_FORWARDED(jit::JitCode, false)
TYPE_MIGHT_BE_FORWARDED(LazyScript, false)
TYPE_MIGHT_BE_FORWARDED(ObjectGroup, false)
#undef TYPE_MIGHT_BE_FORWARDED
template <typename T>
inline bool
IsForwarded(T *t)
{
RelocationOverlay *overlay = RelocationOverlay::fromCell(t);
if (!TypeMightBeForwarded(t)) {
MOZ_ASSERT(!overlay->isForwarded());
return false;
}
return overlay->isForwarded();
}