Bug 1204169 - Push SPS pseudo frame entries when GCing; r=terrence

This commit is contained in:
Nick Fitzgerald 2015-09-18 12:49:09 -07:00
Родитель 100b3d6563
Коммит c0d3a62244
2 изменённых файлов: 20 добавлений и 1 удалений

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

@ -56,6 +56,7 @@ class MOZ_RAII AutoTraceSession
void operator=(const AutoTraceSession&) = delete;
JS::HeapState prevState;
AutoSPSEntry pseudoFrame;
};
struct MOZ_RAII AutoPrepareForTracing

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

@ -5580,11 +5580,29 @@ GCRuntime::finishCollection(JS::gcreason::Reason reason)
}
}
static const char*
HeapStateToLabel(JS::HeapState heapState)
{
switch (heapState) {
case JS::HeapState::MinorCollecting:
return "js::Nursery::collect";
case JS::HeapState::MajorCollecting:
return "js::GCRuntime::collect";
case JS::HeapState::Tracing:
return "JS_IterateCompartments";
case JS::HeapState::Idle:
MOZ_CRASH("Should never have an Idle heap state when pushing GC pseudo frames!");
}
MOZ_ASSERT_UNREACHABLE("Should have exhausted every JS::HeapState variant!");
return nullptr;
}
/* Start a new heap session. */
AutoTraceSession::AutoTraceSession(JSRuntime* rt, JS::HeapState heapState)
: lock(rt),
runtime(rt),
prevState(rt->heapState_)
prevState(rt->heapState_),
pseudoFrame(rt, HeapStateToLabel(heapState), ProfileEntry::Category::GC)
{
MOZ_ASSERT(rt->heapState_ == JS::HeapState::Idle);
MOZ_ASSERT(heapState != JS::HeapState::Idle);