зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1064578 - Part 7: make MaybeAutoPhase a special case of AutoPhase; r=jonco
--HG-- extra : rebase_source : 1072489364c163a665e88c76c561b33d2ffb3055
This commit is contained in:
Родитель
ed249d7942
Коммит
fb8adde1a7
|
@ -234,40 +234,27 @@ struct AutoPhase
|
|||
{
|
||||
AutoPhase(Statistics &stats, Phase phase
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: stats(stats), phase(phase)
|
||||
: stats(stats), phase(phase), enabled(true)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
stats.beginPhase(phase);
|
||||
}
|
||||
AutoPhase(Statistics &stats, bool condition, Phase phase
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: stats(stats), phase(phase), enabled(condition)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
if (enabled)
|
||||
stats.beginPhase(phase);
|
||||
}
|
||||
~AutoPhase() {
|
||||
stats.endPhase(phase);
|
||||
if (enabled)
|
||||
stats.endPhase(phase);
|
||||
}
|
||||
|
||||
Statistics &stats;
|
||||
Phase phase;
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
struct MaybeAutoPhase
|
||||
{
|
||||
explicit MaybeAutoPhase(Statistics &statsArg, bool condition, Phase phaseArg
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: stats(nullptr)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
if (condition) {
|
||||
stats = &statsArg;
|
||||
phase = phaseArg;
|
||||
stats->beginPhase(phase);
|
||||
}
|
||||
}
|
||||
~MaybeAutoPhase() {
|
||||
if (stats)
|
||||
stats->endPhase(phase);
|
||||
}
|
||||
|
||||
Statistics *stats;
|
||||
Phase phase;
|
||||
bool enabled;
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
|
|
|
@ -555,7 +555,7 @@ bool
|
|||
GCMarker::markDelayedChildren(SliceBudget &budget)
|
||||
{
|
||||
GCRuntime &gc = runtime()->gc;
|
||||
gcstats::MaybeAutoPhase ap(gc.stats, gc.state() == MARK, gcstats::PHASE_MARK_DELAYED);
|
||||
gcstats::AutoPhase ap(gc.stats, gc.state() == MARK, gcstats::PHASE_MARK_DELAYED);
|
||||
|
||||
JS_ASSERT(unmarkedArenaStackTop);
|
||||
do {
|
||||
|
|
|
@ -4650,56 +4650,49 @@ GCRuntime::beginSweepingZoneGroup()
|
|||
gcstats::AutoSCC scc(stats, zoneGroupIndex);
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase apiv(stats, !isHeapCompacting(),
|
||||
gcstats::PHASE_SWEEP_INNER_VIEWS);
|
||||
gcstats::AutoPhase apiv(stats, gcstats::PHASE_SWEEP_INNER_VIEWS);
|
||||
for (GCCompartmentGroupIter c(rt); !c.done(); c.next()) {
|
||||
c->sweepInnerViews();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase apccw(stats, !isHeapCompacting(),
|
||||
gcstats::PHASE_SWEEP_CC_WRAPPER);
|
||||
gcstats::AutoPhase apccw(stats, gcstats::PHASE_SWEEP_CC_WRAPPER);
|
||||
for (GCCompartmentGroupIter c(rt); !c.done(); c.next()) {
|
||||
c->sweepCrossCompartmentWrappers();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase apbs(stats, !isHeapCompacting(),
|
||||
gcstats::PHASE_SWEEP_BASE_SHAPE);
|
||||
gcstats::AutoPhase apbs(stats, gcstats::PHASE_SWEEP_BASE_SHAPE);
|
||||
for (GCCompartmentGroupIter c(rt); !c.done(); c.next()) {
|
||||
c->sweepBaseShapeTable();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase apis(stats, !isHeapCompacting(),
|
||||
gcstats::PHASE_SWEEP_INITIAL_SHAPE);
|
||||
gcstats::AutoPhase apis(stats, gcstats::PHASE_SWEEP_INITIAL_SHAPE);
|
||||
for (GCCompartmentGroupIter c(rt); !c.done(); c.next()) {
|
||||
c->sweepInitialShapeTable();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase apto(stats, !isHeapCompacting(),
|
||||
gcstats::PHASE_SWEEP_TYPE_OBJECT);
|
||||
gcstats::AutoPhase apto(stats, gcstats::PHASE_SWEEP_TYPE_OBJECT);
|
||||
for (GCCompartmentGroupIter c(rt); !c.done(); c.next()) {
|
||||
c->sweepTypeObjectTables();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase apre(stats, !isHeapCompacting(),
|
||||
gcstats::PHASE_SWEEP_REGEXP);
|
||||
gcstats::AutoPhase apre(stats, gcstats::PHASE_SWEEP_REGEXP);
|
||||
for (GCCompartmentGroupIter c(rt); !c.done(); c.next()) {
|
||||
c->sweepRegExps();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase apmisc(stats, !isHeapCompacting(),
|
||||
gcstats::PHASE_SWEEP_MISC);
|
||||
gcstats::AutoPhase apmisc(stats, gcstats::PHASE_SWEEP_MISC);
|
||||
for (GCCompartmentGroupIter c(rt); !c.done(); c.next()) {
|
||||
c->sweepCallsiteClones();
|
||||
c->sweepSavedStacks();
|
||||
|
@ -4729,16 +4722,14 @@ GCRuntime::beginSweepingZoneGroup()
|
|||
}
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase ap(stats, !isHeapCompacting(),
|
||||
gcstats::PHASE_DISCARD_ANALYSIS);
|
||||
gcstats::AutoPhase ap(stats, gcstats::PHASE_DISCARD_ANALYSIS);
|
||||
for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) {
|
||||
zone->sweepAnalysis(&fop, releaseObservedTypes && !zone->isPreservingCode());
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase ap(stats, !isHeapCompacting(),
|
||||
gcstats::PHASE_SWEEP_BREAKPOINT);
|
||||
gcstats::AutoPhase ap(stats, gcstats::PHASE_SWEEP_BREAKPOINT);
|
||||
for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) {
|
||||
zone->sweepBreakpoints(&fop);
|
||||
}
|
||||
|
|
|
@ -5021,8 +5021,8 @@ TypeZone::sweep(FreeOp *fop, bool releaseTypes, bool *oom)
|
|||
}
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase ap2(rt->gc.stats, !rt->isHeapCompacting(),
|
||||
gcstats::PHASE_DISCARD_TI);
|
||||
gcstats::AutoPhase ap2(rt->gc.stats, !rt->isHeapCompacting(),
|
||||
gcstats::PHASE_DISCARD_TI);
|
||||
|
||||
for (ZoneCellIterUnderGC i(zone(), FINALIZE_SCRIPT); !i.done(); i.next()) {
|
||||
JSScript *script = i.get<JSScript>();
|
||||
|
@ -5053,8 +5053,8 @@ TypeZone::sweep(FreeOp *fop, bool releaseTypes, bool *oom)
|
|||
}
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase ap2(rt->gc.stats, !rt->isHeapCompacting(),
|
||||
gcstats::PHASE_SWEEP_TYPES);
|
||||
gcstats::AutoPhase ap2(rt->gc.stats, !rt->isHeapCompacting(),
|
||||
gcstats::PHASE_SWEEP_TYPES);
|
||||
|
||||
for (gc::ZoneCellIterUnderGC iter(zone(), gc::FINALIZE_TYPE_OBJECT);
|
||||
!iter.done(); iter.next())
|
||||
|
@ -5082,8 +5082,8 @@ TypeZone::sweep(FreeOp *fop, bool releaseTypes, bool *oom)
|
|||
}
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase ap2(rt->gc.stats, !rt->isHeapCompacting(),
|
||||
gcstats::PHASE_FREE_TI_ARENA);
|
||||
gcstats::AutoPhase ap2(rt->gc.stats, !rt->isHeapCompacting(),
|
||||
gcstats::PHASE_FREE_TI_ARENA);
|
||||
rt->freeLifoAlloc.transferFrom(&oldAlloc);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче