Backed out changeset 77959236fb15 (bug 1084651)

This commit is contained in:
Carsten "Tomcat" Book 2014-11-07 15:30:16 +01:00
parent a9be2c8b89
commit 5835114c2a
3 changed files with 37 additions and 13 deletions

View File

@ -45,7 +45,6 @@
#include "jsapi.h"
#include "jswrapper.h"
#include "js/SliceBudget.h"
#include "nsIArray.h"
#include "nsIObjectInputStream.h"
#include "nsIObjectOutputStream.h"
@ -1693,24 +1692,24 @@ nsJSContext::RunCycleCollectorSlice()
// Decide how long we want to budget for this slice. By default,
// use an unlimited budget.
js::SliceBudget budget;
int64_t sliceBudget = -1;
if (sIncrementalCC) {
if (gCCStats.mBeginTime.IsNull()) {
// If no CC is in progress, use the standard slice time.
budget = js::SliceBudget(js::TimeBudget(kICCSliceBudget));
sliceBudget = kICCSliceBudget;
} else {
TimeStamp now = TimeStamp::Now();
// Only run a limited slice if we're within the max running time.
if (TimeBetween(gCCStats.mBeginTime, now) < kMaxICCDuration) {
float sliceMultiplier = std::max(TimeBetween(gCCStats.mEndSliceTime, now) / (float)kICCIntersliceDelay, 1.0f);
budget = js::SliceBudget(js::TimeBudget(kICCSliceBudget * sliceMultiplier));
sliceBudget = kICCSliceBudget * sliceMultiplier;
}
}
}
nsCycleCollector_collectSlice(budget);
nsCycleCollector_collectSlice(sliceBudget);
gCCStats.FinishCycleCollectionSlice();
}
@ -1727,10 +1726,7 @@ nsJSContext::RunCycleCollectorWorkSlice(int64_t aWorkBudget)
js::ProfileEntry::Category::CC);
gCCStats.PrepareForCycleCollectionSlice();
js::SliceBudget budget = js::SliceBudget(js::WorkBudget(aWorkBudget));
nsCycleCollector_collectSlice(budget);
nsCycleCollector_collectSliceWork(aWorkBudget);
gCCStats.FinishCycleCollectionSlice();
}

View File

@ -177,6 +177,7 @@
#include "nsDumpUtils.h"
#include "xpcpublic.h"
#include "GeckoProfiler.h"
#include "js/SliceBudget.h"
#include <stdint.h>
#include <stdio.h>
@ -4187,7 +4188,7 @@ nsCycleCollector_collect(nsICycleCollectorListener* aManualListener)
}
void
nsCycleCollector_collectSlice(SliceBudget& budget)
nsCycleCollector_collectSlice(int64_t aSliceTime)
{
CollectorData* data = sCollectorData.get();
@ -4198,6 +4199,29 @@ nsCycleCollector_collectSlice(SliceBudget& budget)
PROFILER_LABEL("nsCycleCollector", "collectSlice",
js::ProfileEntry::Category::CC);
SliceBudget budget;
if (aSliceTime >= 0) {
budget = SliceBudget(js::TimeBudget(aSliceTime));
}
data->mCollector->Collect(SliceCC, budget, nullptr);
}
void
nsCycleCollector_collectSliceWork(int64_t aSliceWork)
{
CollectorData* data = sCollectorData.get();
// We should have started the cycle collector by now.
MOZ_ASSERT(data);
MOZ_ASSERT(data->mCollector);
PROFILER_LABEL("nsCycleCollector", "collectSliceWork",
js::ProfileEntry::Category::CC);
SliceBudget budget;
if (aSliceWork >= 0) {
budget = SliceBudget(js::WorkBudget(aSliceWork));
}
data->mCollector->Collect(SliceCC, budget, nullptr);
}

View File

@ -15,8 +15,6 @@ template<class T> struct already_AddRefed;
#include "nsError.h"
#include "nsID.h"
#include "js/SliceBudget.h"
namespace mozilla {
class CycleCollectedJSRuntime;
@ -58,7 +56,13 @@ already_AddRefed<nsICycleCollectorLogSink> nsCycleCollector_createLogSink();
void nsCycleCollector_collect(nsICycleCollectorListener* aManualListener);
void nsCycleCollector_collectSlice(js::SliceBudget& budget);
// If aSliceTime is negative, the CC will run to completion. Otherwise,
// aSliceTime will be used as the time budget for the slice, in ms.
void nsCycleCollector_collectSlice(int64_t aSliceTime);
// If aSliceTime is negative, the CC will run to completion. Otherwise,
// aSliceTime will be used as the work budget for the slice.
void nsCycleCollector_collectSliceWork(int64_t aSliceWork);
uint32_t nsCycleCollector_suspectedCount();
void nsCycleCollector_shutdown();