зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1135100 - Don't bother to check if things we don't relocate have been forwarded r=terrence
This commit is contained in:
Родитель
846f3968f9
Коммит
2f9550d600
|
@ -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));
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче