author | Jon Coppeard <jcoppeard@mozilla.com> |
Fri, 07 May 2021 07:39:50 +0000 | |
changeset 578822 | bc66f595b5a0603bcf54cce5aa2e2b44584cac50 |
parent 578821 | f22a0ec697b099224196c6aedbe74f55495e1afe |
child 578823 | 074748eaa2b2a7cd31c715da07c54f706dc7f0b0 |
push id | 38444 |
push user | nbeleuzu@mozilla.com |
push date | Fri, 07 May 2021 16:18:55 +0000 |
treeherder | mozilla-central@54ac35a2ef29 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mccr8 |
bugs | 1709849 |
milestone | 90.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/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -1087,34 +1087,35 @@ void nsJSContext::GarbageCollectNow(JS:: if (sScheduler.InIncrementalGC() && aIncremental == IncrementalGC) { // We're in the middle of incremental GC. Do another slice. JS::PrepareForIncrementalGC(cx); JS::IncrementalGCSlice(cx, aReason, aSliceMillis); return; } - JSGCInvocationKind gckind = aShrinking == ShrinkingGC ? GC_SHRINK : GC_NORMAL; + JS::GCOptions options = + aShrinking == ShrinkingGC ? JS::GCOptions::Shrink : JS::GCOptions::Normal; if (aIncremental == NonIncrementalGC || aReason == JS::GCReason::FULL_GC_TIMER) { sScheduler.SetNeedsFullGC(); } if (sScheduler.NeedsFullGC()) { JS::PrepareForFullGC(cx); } if (aIncremental == IncrementalGC) { // Incremental GC slices will be triggered by the sGCRunner. If one doesn't // already exist, create it in the GC_SLICE_END callback for the first // slice being executed here. - JS::StartIncrementalGC(cx, gckind, aReason, aSliceMillis); + JS::StartIncrementalGC(cx, options, aReason, aSliceMillis); } else { - JS::NonIncrementalGC(cx, gckind, aReason); + JS::NonIncrementalGC(cx, options, aReason); } } static void FinishAnyIncrementalGC() { AUTO_PROFILER_LABEL("FinishAnyIncrementalGC", GCCC); if (sScheduler.InIncrementalGC()) { AutoJSAPI jsapi;
--- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -4931,29 +4931,32 @@ void WorkerPrivate::GarbageCollectIntern // We haven't compiled anything yet. Just bail out. return; } if (aShrinking || aCollectChildren) { JS::PrepareForFullGC(aCx); if (aShrinking && mSyncLoopStack.IsEmpty()) { - JS::NonIncrementalGC(aCx, GC_SHRINK, JS::GCReason::DOM_WORKER); + JS::NonIncrementalGC(aCx, JS::GCOptions::Shrink, + JS::GCReason::DOM_WORKER); // Check whether the CC collected anything and if so GC again. This is // necessary to collect all garbage. if (data->mCCCollectedAnything) { - JS::NonIncrementalGC(aCx, GC_NORMAL, JS::GCReason::DOM_WORKER); + JS::NonIncrementalGC(aCx, JS::GCOptions::Normal, + JS::GCReason::DOM_WORKER); } if (!aCollectChildren) { LOG(WorkerLog(), ("Worker %p collected idle garbage\n", this)); } } else { - JS::NonIncrementalGC(aCx, GC_NORMAL, JS::GCReason::DOM_WORKER); + JS::NonIncrementalGC(aCx, JS::GCOptions::Normal, + JS::GCReason::DOM_WORKER); LOG(WorkerLog(), ("Worker %p collected garbage\n", this)); } } else { JS_MaybeGC(aCx); LOG(WorkerLog(), ("Worker %p collected periodic garbage\n", this)); } if (aCollectChildren) {
--- a/js/public/GCAPI.h +++ b/js/public/GCAPI.h @@ -45,23 +45,16 @@ enum class GCOptions : uint32_t { // ensures all unreferenced objects are removed from the system. // // Finally, compact the GC heap. Shrink = 1, }; } // namespace JS -/** - * Kinds of js_GC invocation. - */ -using JSGCInvocationKind = JS::GCOptions; -static constexpr JSGCInvocationKind GC_NORMAL = JS::GCOptions::Normal; -static constexpr JSGCInvocationKind GC_SHRINK = JS::GCOptions::Shrink; - typedef enum JSGCParamKey { /** * Maximum nominal heap before last ditch GC. * * Soft limit on the number of bytes we are allowed to allocate in the GC * heap. Attempts to allocate gcthings over this limit will return null and * subsequently invoke the standard OOM machinery, independent of available * physical memory.
--- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -1612,17 +1612,17 @@ nsXPCComponents_Utils::GetWeakReference( NS_ENSURE_SUCCESS(rv, rv); ref.forget(_retval); return NS_OK; } NS_IMETHODIMP nsXPCComponents_Utils::ForceGC(JSContext* aCx) { PrepareForFullGC(aCx); - NonIncrementalGC(aCx, GC_NORMAL, GCReason::COMPONENT_UTILS); + NonIncrementalGC(aCx, GCOptions::Normal, GCReason::COMPONENT_UTILS); return NS_OK; } NS_IMETHODIMP nsXPCComponents_Utils::ForceCC(nsICycleCollectorListener* listener) { nsJSContext::CycleCollectNow(listener); return NS_OK; } @@ -1657,17 +1657,17 @@ NS_IMETHODIMP nsXPCComponents_Utils::ClearMaxCCTime() { nsJSContext::ClearMaxCCSliceTime(); return NS_OK; } NS_IMETHODIMP nsXPCComponents_Utils::ForceShrinkingGC(JSContext* aCx) { PrepareForFullGC(aCx); - NonIncrementalGC(aCx, GC_SHRINK, GCReason::COMPONENT_UTILS); + NonIncrementalGC(aCx, GCOptions::Shrink, GCReason::COMPONENT_UTILS); return NS_OK; } class PreciseGCRunnable : public Runnable { public: PreciseGCRunnable(nsIScheduledGCCallback* aCallback, bool aShrinking) : mozilla::Runnable("PreciseGCRunnable"), mCallback(aCallback),
--- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -1511,17 +1511,17 @@ void CycleCollectedJSRuntime::CheckGrayB bool CycleCollectedJSRuntime::AreGCGrayBitsValid() const { return js::AreGCGrayBitsValid(mJSRuntime); } void CycleCollectedJSRuntime::GarbageCollect(JS::GCReason aReason) const { JSContext* cx = CycleCollectedJSContext::Get()->Context(); JS::PrepareForFullGC(cx); - JS::NonIncrementalGC(cx, GC_NORMAL, aReason); + JS::NonIncrementalGC(cx, JS::GCOptions::Normal, aReason); } void CycleCollectedJSRuntime::JSObjectsTenured() { JSContext* cx = CycleCollectedJSContext::Get()->Context(); for (auto iter = mNurseryObjects.Iter(); !iter.Done(); iter.Next()) { nsWrapperCache* cache = iter.Get(); JSObject* wrapper = cache->GetWrapperMaybeDead(); MOZ_DIAGNOSTIC_ASSERT(wrapper);