Bug 1133759 - Always shrink GC buffers at the end of a shrinking GC r=terrence

This commit is contained in:
Jon Coppeard 2015-02-18 12:35:05 +00:00
Родитель b2df85cfa3
Коммит 5e9b465d18
4 изменённых файлов: 15 добавлений и 7 удалений

Просмотреть файл

@ -2204,9 +2204,12 @@ DOMGCSliceCallback(JSRuntime *aRt, JS::GCProgress aProgress, const JS::GCDescrip
nsJSContext::KillFullGCTimer();
// Avoid shrinking during heavy activity, which is suggested by
// compartment GC.
// compartment GC. We don't need to shrink after a shrinking GC as this
// happens automatically in this case.
if (aDesc.invocationKind_ == GC_NORMAL) {
nsJSContext::PokeShrinkGCBuffers();
}
}
if (ShouldTriggerCC(nsCycleCollector_suspectedCount())) {
nsCycleCollector_dispatchDeferredDeletion();

Просмотреть файл

@ -263,9 +263,10 @@ enum GCProgress {
struct JS_PUBLIC_API(GCDescription) {
bool isCompartment_;
JSGCInvocationKind invocationKind_;
explicit GCDescription(bool isCompartment)
: isCompartment_(isCompartment) {}
GCDescription(bool isCompartment, JSGCInvocationKind kind)
: isCompartment_(isCompartment), invocationKind_(kind) {}
char16_t *formatMessage(JSRuntime *rt) const;
char16_t *formatJSON(JSRuntime *rt, uint64_t timestamp) const;

Просмотреть файл

@ -1005,7 +1005,7 @@ Statistics::beginSlice(const ZoneGCStats &zoneStats, JSGCInvocationKind gckind,
bool wasFullGC = zoneStats.isCollectingAllZones();
if (sliceCallback)
(*sliceCallback)(runtime, first ? JS::GC_CYCLE_BEGIN : JS::GC_SLICE_BEGIN,
JS::GCDescription(!wasFullGC));
JS::GCDescription(!wasFullGC, gckind));
}
}
@ -1029,7 +1029,7 @@ Statistics::endSlice()
bool wasFullGC = zoneStats.isCollectingAllZones();
if (sliceCallback)
(*sliceCallback)(runtime, last ? JS::GC_CYCLE_END : JS::GC_SLICE_END,
JS::GCDescription(!wasFullGC));
JS::GCDescription(!wasFullGC, gckind));
}
/* Do this after the slice callback since it uses these values. */

Просмотреть файл

@ -5463,6 +5463,10 @@ GCRuntime::compactPhase(bool lastGC)
releaseRelocatedArenas(relocatedList);
#endif
// Ensure execess chunks are returns to the system and free arenas
// decommitted.
shrinkBuffers();
#ifdef DEBUG
CheckHashTablesAfterMovingGC(rt);
for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
@ -6303,6 +6307,7 @@ js::PrepareForDebugGC(JSRuntime *rt)
JS_PUBLIC_API(void)
JS::ShrinkGCBuffers(JSRuntime *rt)
{
MOZ_ASSERT(!rt->isHeapBusy());
rt->gc.shrinkBuffers();
}
@ -6311,7 +6316,6 @@ GCRuntime::shrinkBuffers()
{
AutoLockHelperThreadState helperLock;
AutoLockGC lock(rt);
MOZ_ASSERT(!rt->isHeapBusy());
if (CanUseExtraThreads())
helperState.startBackgroundShrink(lock);