mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 77959236fb15 (bug 1084651)
This commit is contained in:
parent
a9be2c8b89
commit
5835114c2a
@ -45,7 +45,6 @@
|
|||||||
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "jswrapper.h"
|
#include "jswrapper.h"
|
||||||
#include "js/SliceBudget.h"
|
|
||||||
#include "nsIArray.h"
|
#include "nsIArray.h"
|
||||||
#include "nsIObjectInputStream.h"
|
#include "nsIObjectInputStream.h"
|
||||||
#include "nsIObjectOutputStream.h"
|
#include "nsIObjectOutputStream.h"
|
||||||
@ -1693,24 +1692,24 @@ nsJSContext::RunCycleCollectorSlice()
|
|||||||
|
|
||||||
// Decide how long we want to budget for this slice. By default,
|
// Decide how long we want to budget for this slice. By default,
|
||||||
// use an unlimited budget.
|
// use an unlimited budget.
|
||||||
js::SliceBudget budget;
|
int64_t sliceBudget = -1;
|
||||||
|
|
||||||
if (sIncrementalCC) {
|
if (sIncrementalCC) {
|
||||||
if (gCCStats.mBeginTime.IsNull()) {
|
if (gCCStats.mBeginTime.IsNull()) {
|
||||||
// If no CC is in progress, use the standard slice time.
|
// If no CC is in progress, use the standard slice time.
|
||||||
budget = js::SliceBudget(js::TimeBudget(kICCSliceBudget));
|
sliceBudget = kICCSliceBudget;
|
||||||
} else {
|
} else {
|
||||||
TimeStamp now = TimeStamp::Now();
|
TimeStamp now = TimeStamp::Now();
|
||||||
|
|
||||||
// Only run a limited slice if we're within the max running time.
|
// Only run a limited slice if we're within the max running time.
|
||||||
if (TimeBetween(gCCStats.mBeginTime, now) < kMaxICCDuration) {
|
if (TimeBetween(gCCStats.mBeginTime, now) < kMaxICCDuration) {
|
||||||
float sliceMultiplier = std::max(TimeBetween(gCCStats.mEndSliceTime, now) / (float)kICCIntersliceDelay, 1.0f);
|
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();
|
gCCStats.FinishCycleCollectionSlice();
|
||||||
}
|
}
|
||||||
@ -1727,10 +1726,7 @@ nsJSContext::RunCycleCollectorWorkSlice(int64_t aWorkBudget)
|
|||||||
js::ProfileEntry::Category::CC);
|
js::ProfileEntry::Category::CC);
|
||||||
|
|
||||||
gCCStats.PrepareForCycleCollectionSlice();
|
gCCStats.PrepareForCycleCollectionSlice();
|
||||||
|
nsCycleCollector_collectSliceWork(aWorkBudget);
|
||||||
js::SliceBudget budget = js::SliceBudget(js::WorkBudget(aWorkBudget));
|
|
||||||
nsCycleCollector_collectSlice(budget);
|
|
||||||
|
|
||||||
gCCStats.FinishCycleCollectionSlice();
|
gCCStats.FinishCycleCollectionSlice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +177,7 @@
|
|||||||
#include "nsDumpUtils.h"
|
#include "nsDumpUtils.h"
|
||||||
#include "xpcpublic.h"
|
#include "xpcpublic.h"
|
||||||
#include "GeckoProfiler.h"
|
#include "GeckoProfiler.h"
|
||||||
|
#include "js/SliceBudget.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -4187,7 +4188,7 @@ nsCycleCollector_collect(nsICycleCollectorListener* aManualListener)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsCycleCollector_collectSlice(SliceBudget& budget)
|
nsCycleCollector_collectSlice(int64_t aSliceTime)
|
||||||
{
|
{
|
||||||
CollectorData* data = sCollectorData.get();
|
CollectorData* data = sCollectorData.get();
|
||||||
|
|
||||||
@ -4198,6 +4199,29 @@ nsCycleCollector_collectSlice(SliceBudget& budget)
|
|||||||
PROFILER_LABEL("nsCycleCollector", "collectSlice",
|
PROFILER_LABEL("nsCycleCollector", "collectSlice",
|
||||||
js::ProfileEntry::Category::CC);
|
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);
|
data->mCollector->Collect(SliceCC, budget, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,6 @@ template<class T> struct already_AddRefed;
|
|||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
#include "nsID.h"
|
#include "nsID.h"
|
||||||
|
|
||||||
#include "js/SliceBudget.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class CycleCollectedJSRuntime;
|
class CycleCollectedJSRuntime;
|
||||||
@ -58,7 +56,13 @@ already_AddRefed<nsICycleCollectorLogSink> nsCycleCollector_createLogSink();
|
|||||||
|
|
||||||
void nsCycleCollector_collect(nsICycleCollectorListener* aManualListener);
|
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();
|
uint32_t nsCycleCollector_suspectedCount();
|
||||||
void nsCycleCollector_shutdown();
|
void nsCycleCollector_shutdown();
|
||||||
|
Loading…
Reference in New Issue
Block a user