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.cpp67
1 files changed, 37 insertions, 30 deletions
diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp
index 1397bd25b5..a14a22bcf0 100644
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -1707,38 +1707,38 @@ void nsJSContext::MaybeRunNextCollectorSlice(nsIDocShell* aDocShell,
return;
}
- if (!sScheduler->IsUserActive()) {
- if (sScheduler->InIncrementalGC() || sScheduler->IsCollectingCycles()) {
- Maybe<TimeStamp> next = nsRefreshDriver::GetNextTickHint();
- if (next.isSome()) {
- // Try to not delay the next RefreshDriver tick, so give a reasonable
- // deadline for collectors.
- sScheduler->RunNextCollectorTimer(aReason, next.value());
- }
- } else {
- nsCOMPtr<nsIDocShell> shell = aDocShell;
- NS_DispatchToCurrentThreadQueue(
- NS_NewRunnableFunction(
- "nsJSContext::MaybeRunNextCollectorSlice",
- [shell] {
- nsIDocShell::BusyFlags busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
- shell->GetBusyFlags(&busyFlags);
- if (busyFlags == nsIDocShell::BUSY_FLAGS_NONE) {
- return;
- }
-
- // In order to improve performance on the next page, run a minor
- // GC. The 16ms limit ensures it isn't called all the time if
- // there are for example multiple iframes loading at the same
- // time.
- JS::RunNurseryCollection(
- CycleCollectedJSRuntime::Get()->Runtime(),
- JS::GCReason::PREPARE_FOR_PAGELOAD,
- mozilla::TimeDuration::FromMilliseconds(16));
- }),
- EventQueuePriority::Idle);
+ if (!sScheduler->IsUserActive() &&
+ (sScheduler->InIncrementalGC() || sScheduler->IsCollectingCycles())) {
+ Maybe<TimeStamp> next = nsRefreshDriver::GetNextTickHint();
+ if (next.isSome()) {
+ // Try to not delay the next RefreshDriver tick, so give a reasonable
+ // deadline for collectors.
+ sScheduler->RunNextCollectorTimer(aReason, next.value());
}
}
+
+ nsCOMPtr<nsIDocShell> shell = aDocShell;
+ NS_DispatchToCurrentThreadQueue(
+ NS_NewRunnableFunction("nsJSContext::MaybeRunNextCollectorSlice",
+ [shell] {
+ nsIDocShell::BusyFlags busyFlags =
+ nsIDocShell::BUSY_FLAGS_NONE;
+ shell->GetBusyFlags(&busyFlags);
+ if (busyFlags == nsIDocShell::BUSY_FLAGS_NONE) {
+ return;
+ }
+
+ // In order to improve performance on the next
+ // page, run a minor GC. The 16ms limit ensures
+ // it isn't called all the time if there are for
+ // example multiple iframes loading at the same
+ // time.
+ JS::RunNurseryCollection(
+ CycleCollectedJSRuntime::Get()->Runtime(),
+ JS::GCReason::PREPARE_FOR_PAGELOAD,
+ mozilla::TimeDuration::FromMilliseconds(16));
+ }),
+ EventQueuePriority::Idle);
}
// static
@@ -2121,6 +2121,13 @@ void nsJSContext::EnsureStatics() {
"javascript.options.mem.gc_compacting",
(void*)JSGC_COMPACTING_ENABLED);
+#ifdef NIGHTLY_BUILD
+ Preferences::RegisterCallbackAndCall(
+ SetMemoryPrefChangedCallbackBool,
+ "javascript.options.mem.gc_experimental_semispace_nursery",
+ (void*)JSGC_SEMISPACE_NURSERY_ENABLED);
+#endif
+
Preferences::RegisterCallbackAndCall(
SetMemoryPrefChangedCallbackBool,
"javascript.options.mem.gc_parallel_marking",