Bug 939476 - Only use separate GC stats phase for markDelayedChildren() in mark phase r=billm

This commit is contained in:
Jon Coppeard 2013-11-20 15:37:30 +00:00
parent 2caccf2110
commit 8dff303b2e
3 changed files with 34 additions and 9 deletions

View File

@ -281,7 +281,6 @@ static const PhaseInfo phases[] = {
{ PHASE_SWEEP, "Sweep", PHASE_NO_PARENT },
{ PHASE_SWEEP_MARK, "Mark During Sweeping", PHASE_SWEEP },
{ PHASE_SWEEP_MARK_TYPES, "Mark Types During Sweeping", PHASE_SWEEP_MARK },
{ PHASE_SWEEP_MARK_DELAYED, "Mark Delayed During Sweeping", PHASE_SWEEP_MARK },
{ PHASE_SWEEP_MARK_INCOMING_BLACK, "Mark Incoming Black Pointers", PHASE_SWEEP_MARK },
{ PHASE_SWEEP_MARK_WEAK, "Mark Weak", PHASE_SWEEP_MARK },
{ PHASE_SWEEP_MARK_INCOMING_GRAY, "Mark Incoming Gray Pointers", PHASE_SWEEP_MARK },

View File

@ -33,7 +33,6 @@ enum Phase {
PHASE_SWEEP,
PHASE_SWEEP_MARK,
PHASE_SWEEP_MARK_TYPES,
PHASE_SWEEP_MARK_DELAYED,
PHASE_SWEEP_MARK_INCOMING_BLACK,
PHASE_SWEEP_MARK_WEAK,
PHASE_SWEEP_MARK_INCOMING_GRAY,
@ -207,6 +206,30 @@ struct AutoPhase
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
struct MaybeAutoPhase
{
MaybeAutoPhase(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: stats(nullptr)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
void construct(Statistics &statsArg, Phase phaseArg)
{
JS_ASSERT(!stats);
stats = &statsArg;
phase = phaseArg;
stats->beginPhase(phase);
}
~MaybeAutoPhase() {
if (stats)
stats->endPhase(phase);
}
Statistics *stats;
Phase phase;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
struct AutoSCC
{
AutoSCC(Statistics &stats, unsigned scc

View File

@ -1800,10 +1800,9 @@ GCMarker::markDelayedChildren(ArenaHeader *aheader)
bool
GCMarker::markDelayedChildren(SliceBudget &budget)
{
gcstats::Phase phase = runtime->gcIncrementalState == MARK
? gcstats::PHASE_MARK_DELAYED
: gcstats::PHASE_SWEEP_MARK_DELAYED;
gcstats::AutoPhase ap(runtime->gcStats, phase);
gcstats::MaybeAutoPhase ap;
if (runtime->gcIncrementalState == MARK)
ap.construct(runtime->gcStats, gcstats::PHASE_MARK_DELAYED);
JS_ASSERT(unmarkedArenaStackTop);
do {
@ -3177,10 +3176,14 @@ js::gc::MarkingValidator::nonIncrementalMark()
MarkRuntime(gcmarker, true);
}
SliceBudget budget;
runtime->gcIncrementalState = MARK;
runtime->gcMarker.drainMarkStack(budget);
{
gcstats::AutoPhase ap1(runtime->gcStats, gcstats::PHASE_MARK);
SliceBudget budget;
runtime->gcIncrementalState = MARK;
runtime->gcMarker.drainMarkStack(budget);
}
runtime->gcIncrementalState = SWEEP;
{
gcstats::AutoPhase ap(runtime->gcStats, gcstats::PHASE_SWEEP);
MarkAllWeakReferences(runtime, gcstats::PHASE_SWEEP_MARK_WEAK);