author | Andrew McCreight <continuation@gmail.com> |
Thu, 08 Sep 2016 13:04:30 -0700 | |
changeset 313844 | 0154cd83212689f344562d3ae83f7c2623e72019 |
parent 313843 | 90a82f2bfb3a78e7f3b4aa2f8e2b18ad74d5ee86 |
child 313845 | 40663c31d2d6bd122ab90dc4b76376102b75d821 |
push id | 81726 |
push user | cbook@mozilla.com |
push date | Wed, 14 Sep 2016 10:11:30 +0000 |
treeherder | mozilla-inbound@da51e6314ee5 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | froydnj, smaug |
bugs | 1299934 |
milestone | 51.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -1325,17 +1325,17 @@ public: void PrepareForGarbageCollection(); void FinishAnyCurrentCollection(); bool Collect(ccType aCCType, SliceBudget& aBudget, nsICycleCollectorListener* aManualListener, bool aPreferShorterSlices = false); - void Shutdown(); + void Shutdown(bool aDoCollect); bool IsIdle() const { return mIncrementalPhase == IdlePhase; } void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, size_t* aObjectSize, size_t* aGraphSize, size_t* aPurpleBufferSize) const; @@ -3871,27 +3871,24 @@ nsCycleCollector::BeginCollection(ccType uint32_t nsCycleCollector::SuspectedCount() { CheckThreadSafety(); return mPurpleBuf.Count(); } void -nsCycleCollector::Shutdown() +nsCycleCollector::Shutdown(bool aDoCollect) { CheckThreadSafety(); // Always delete snow white objects. FreeSnowWhite(true); -#ifndef NS_FREE_PERMANENT_DATA - if (PR_GetEnv("MOZ_CC_RUN_DURING_SHUTDOWN")) -#endif - { + if (aDoCollect) { ShutdownCollect(); } } void nsCycleCollector::RemoveObjectFromGraph(void* aObj) { if (IsIdle()) { @@ -4191,26 +4188,26 @@ nsCycleCollector_finishAnyCurrentCollect if (!data->mCollector) { return; } data->mCollector->FinishAnyCurrentCollection(); } void -nsCycleCollector_shutdown() +nsCycleCollector_shutdown(bool aDoCollect) { CollectorData* data = sCollectorData.get(); if (data) { MOZ_ASSERT(data->mCollector); PROFILER_LABEL("nsCycleCollector", "shutdown", js::ProfileEntry::Category::CC); - data->mCollector->Shutdown(); + data->mCollector->Shutdown(aDoCollect); data->mCollector = nullptr; if (data->mRuntime) { // Run any remaining tasks that may have been enqueued via // RunInStableState during the final cycle collection. data->mRuntime->ProcessStableStateQueue(); } if (!data->mRuntime) { delete data;
--- a/xpcom/base/nsCycleCollector.h +++ b/xpcom/base/nsCycleCollector.h @@ -46,17 +46,20 @@ bool nsCycleCollector_doDeferredDeletion already_AddRefed<nsICycleCollectorLogSink> nsCycleCollector_createLogSink(); void nsCycleCollector_collect(nsICycleCollectorListener* aManualListener); void nsCycleCollector_collectSlice(js::SliceBudget& budget, bool aPreferShorterSlices = false); uint32_t nsCycleCollector_suspectedCount(); -void nsCycleCollector_shutdown(); + +// If aDoCollect is true, then run the GC and CC a few times before +// shutting down the CC completely. +void nsCycleCollector_shutdown(bool aDoCollect = true); // Helpers for interacting with JS void nsCycleCollector_registerJSRuntime(mozilla::CycleCollectedJSRuntime* aRt); void nsCycleCollector_forgetJSRuntime(); #define NS_CYCLE_COLLECTOR_LOGGER_CID \ { 0x58be81b4, 0x39d2, 0x437c, \ { 0x94, 0xea, 0xae, 0xde, 0x2c, 0x62, 0x08, 0xd3 } }
--- a/xpcom/build/XPCOMInit.cpp +++ b/xpcom/build/XPCOMInit.cpp @@ -979,17 +979,23 @@ ShutdownXPCOM(nsIServiceManager* aServMg if (obs) { obs->Observe(nullptr, NS_XPCOM_SHUTDOWN_LOADERS_OBSERVER_ID, nullptr); } } moduleLoaders = nullptr; } - nsCycleCollector_shutdown(); + bool shutdownCollect; +#ifdef NS_FREE_PERMANENT_DATA + shutdownCollect = true; +#else + shutdownCollect = !!PR_GetEnv("MOZ_CC_RUN_DURING_SHUTDOWN"); +#endif + nsCycleCollector_shutdown(shutdownCollect); PROFILER_MARKER("Shutdown xpcom"); // If we are doing any shutdown checks, poison writes. if (gShutdownChecks != SCM_NOTHING) { #ifdef XP_MACOSX mozilla::OnlyReportDirtyWrites(); #endif /* XP_MACOSX */ mozilla::BeginLateWriteChecks();