summaryrefslogtreecommitdiffstats
path: root/dom/base/nsJSEnvironment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/nsJSEnvironment.cpp')
-rw-r--r--dom/base/nsJSEnvironment.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp
index 4a984d294..dfd380fc2 100644
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -625,7 +625,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsJSContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsJSContext)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGlobalObjectRef)
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsJSContext)
@@ -1356,9 +1355,20 @@ nsJSContext::RunCycleCollectorSlice()
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));
+ uint32_t runningTime = TimeBetween(gCCStats.mBeginTime, now);
+ if (runningTime < kMaxICCDuration) {
+ // Try to make up for a delay in running this slice.
+ float sliceDelayMultiplier = TimeBetween(gCCStats.mEndSliceTime, now) / (float)kICCIntersliceDelay;
+ float delaySliceBudget = kICCSliceBudget * sliceDelayMultiplier;
+
+ // Increase slice budgets up to |maxLaterSlice| as we approach
+ // half way through the ICC, to avoid large sync CCs.
+ float percentToHalfDone = std::min(2.0f * runningTime / kMaxICCDuration, 1.0f);
+ const float maxLaterSlice = 40.0f;
+ float laterSliceBudget = maxLaterSlice * percentToHalfDone;
+
+ budget = js::SliceBudget(js::TimeBudget(std::max({delaySliceBudget,
+ laterSliceBudget, (float)kICCSliceBudget})));
}
}
}
@@ -2618,7 +2628,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsJSArgArray)
tmp->ReleaseJSObjects();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsJSArgArray)
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsJSArgArray)