From 7839608d943e2518f6d31b872b72bcfab8fecab8 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Fri, 27 Jan 2012 17:01:04 -0800 Subject: [PATCH] Bug 716619 - Simplify GC probes (r=sfink) --- js/src/ETWProvider.man | 19 +++++++------- js/src/gc/Statistics.cpp | 32 ++++++++---------------- js/src/jsprobes.h | 54 ++++++++++++++++++++-------------------- 3 files changed, 46 insertions(+), 59 deletions(-) diff --git a/js/src/ETWProvider.man b/js/src/ETWProvider.man index 10d8cda56dc..c9005beff8a 100644 --- a/js/src/ETWProvider.man +++ b/js/src/ETWProvider.man @@ -79,29 +79,29 @@ - - + + diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp index b1a1197ca11..ba17a972246 100644 --- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -206,7 +206,7 @@ Statistics::beginGC(JSCompartment *comp, gcreason::Reason reason) triggerReason = reason; beginPhase(PHASE_GC); - Probes::GCStart(compartment); + Probes::GCStart(); GCCrashData crashData; crashData.isCompartment = !!compartment; @@ -283,7 +283,7 @@ Statistics::printStats() void Statistics::endGC() { - Probes::GCEnd(compartment); + Probes::GCEnd(); endPhase(PHASE_GC); crash::SnapshotGCStack(); @@ -315,16 +315,10 @@ Statistics::beginPhase(Phase phase) { phaseStarts[phase] = PRMJ_Now(); - if (phase == gcstats::PHASE_SWEEP) { - Probes::GCStartSweepPhase(NULL); - if (!compartment) { - for (JSCompartment **c = runtime->compartments.begin(); - c != runtime->compartments.end(); ++c) - { - Probes::GCStartSweepPhase(*c); - } - } - } + if (phase == gcstats::PHASE_MARK) + Probes::GCStartMarkPhase(); + else if (phase == gcstats::PHASE_SWEEP) + Probes::GCStartSweepPhase(); } void @@ -333,16 +327,10 @@ Statistics::endPhase(Phase phase) phaseEnds[phase] = PRMJ_Now(); phaseTimes[phase] += phaseEnds[phase] - phaseStarts[phase]; - if (phase == gcstats::PHASE_SWEEP) { - if (!compartment) { - for (JSCompartment **c = runtime->compartments.begin(); - c != runtime->compartments.end(); ++c) - { - Probes::GCEndSweepPhase(*c); - } - } - Probes::GCEndSweepPhase(NULL); - } + if (phase == gcstats::PHASE_MARK) + Probes::GCEndMarkPhase(); + else if (phase == gcstats::PHASE_SWEEP) + Probes::GCEndSweepPhase(); } } /* namespace gcstats */ diff --git a/js/src/jsprobes.h b/js/src/jsprobes.h index 17485a89a1c..ae904ee04db 100644 --- a/js/src/jsprobes.h +++ b/js/src/jsprobes.h @@ -190,21 +190,21 @@ bool releaseMemory(JSContext *cx, void *address, size_t nbytes); * Garbage collection probes * * GC timing is tricky and at the time of this writing is changing frequently. - * GCStart(NULL)/GCEnd(NULL) are intended to bracket the entire garbage - * collection (either global or single-compartment), but a separate thread may - * continue doing work after GCEnd. + * GCStart/GCEnd are intended to bracket the entire garbage collection (either + * global or single-compartment), but a separate thread may continue doing work + * after GCEnd. * * Multiple compartments' GC will be interleaved during a global collection * (eg, compartment 1 starts, compartment 2 starts, compartment 1 ends, ...) */ -bool GCStart(JSCompartment *compartment); -bool GCEnd(JSCompartment *compartment); +bool GCStart(); +bool GCEnd(); -bool GCStartMarkPhase(JSCompartment *compartment); -bool GCEndMarkPhase(JSCompartment *compartment); +bool GCStartMarkPhase(); +bool GCEndMarkPhase(); -bool GCStartSweepPhase(JSCompartment *compartment); -bool GCEndSweepPhase(JSCompartment *compartment); +bool GCStartSweepPhase(); +bool GCEndSweepPhase(); /* * Various APIs for inserting custom probe points. These might be used to mark @@ -363,12 +363,12 @@ bool ETWCalloutBegin(JSContext *cx, JSFunction *fun); bool ETWCalloutEnd(JSContext *cx, JSFunction *fun); bool ETWAcquireMemory(JSContext *cx, void *address, size_t nbytes); bool ETWReleaseMemory(JSContext *cx, void *address, size_t nbytes); -bool ETWGCStart(JSCompartment *compartment); -bool ETWGCEnd(JSCompartment *compartment); -bool ETWGCStartMarkPhase(JSCompartment *compartment); -bool ETWGCEndMarkPhase(JSCompartment *compartment); -bool ETWGCStartSweepPhase(JSCompartment *compartment); -bool ETWGCEndSweepPhase(JSCompartment *compartment); +bool ETWGCStart(); +bool ETWGCEnd(); +bool ETWGCStartMarkPhase(); +bool ETWGCEndMarkPhase(); +bool ETWGCStartSweepPhase(); +bool ETWGCEndSweepPhase(); bool ETWCustomMark(JSString *string); bool ETWCustomMark(const char *string); bool ETWCustomMark(int marker); @@ -644,12 +644,12 @@ Probes::releaseMemory(JSContext *cx, void *address, size_t nbytes) } inline bool -Probes::GCStart(JSCompartment *compartment) +Probes::GCStart() { bool ok = true; #ifdef MOZ_ETW - if (ProfilingActive && !ETWGCStart(compartment)) + if (ProfilingActive && !ETWGCStart()) ok = false; #endif @@ -657,12 +657,12 @@ Probes::GCStart(JSCompartment *compartment) } inline bool -Probes::GCEnd(JSCompartment *compartment) +Probes::GCEnd() { bool ok = true; #ifdef MOZ_ETW - if (ProfilingActive && !ETWGCEnd(compartment)) + if (ProfilingActive && !ETWGCEnd()) ok = false; #endif @@ -670,12 +670,12 @@ Probes::GCEnd(JSCompartment *compartment) } inline bool -Probes::GCStartMarkPhase(JSCompartment *compartment) +Probes::GCStartMarkPhase() { bool ok = true; #ifdef MOZ_ETW - if (ProfilingActive && !ETWGCStartMarkPhase(compartment)) + if (ProfilingActive && !ETWGCStartMarkPhase()) ok = false; #endif @@ -683,12 +683,12 @@ Probes::GCStartMarkPhase(JSCompartment *compartment) } inline bool -Probes::GCEndMarkPhase(JSCompartment *compartment) +Probes::GCEndMarkPhase() { bool ok = true; #ifdef MOZ_ETW - if (ProfilingActive && !ETWGCEndMarkPhase(compartment)) + if (ProfilingActive && !ETWGCEndMarkPhase()) ok = false; #endif @@ -696,12 +696,12 @@ Probes::GCEndMarkPhase(JSCompartment *compartment) } inline bool -Probes::GCStartSweepPhase(JSCompartment *compartment) +Probes::GCStartSweepPhase() { bool ok = true; #ifdef MOZ_ETW - if (ProfilingActive && !ETWGCStartSweepPhase(compartment)) + if (ProfilingActive && !ETWGCStartSweepPhase()) ok = false; #endif @@ -709,12 +709,12 @@ Probes::GCStartSweepPhase(JSCompartment *compartment) } inline bool -Probes::GCEndSweepPhase(JSCompartment *compartment) +Probes::GCEndSweepPhase() { bool ok = true; #ifdef MOZ_ETW - if (ProfilingActive && !ETWGCEndSweepPhase(compartment)) + if (ProfilingActive && !ETWGCEndSweepPhase()) ok = false; #endif