зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1097302, increase the number of major forget skippables, r=mccr8
--HG-- extra : rebase_source : b465ff26006f688cb76d0f3bfe0ed1a564081992
This commit is contained in:
Родитель
3fad6064bb
Коммит
f82ed0c20b
|
@ -394,19 +394,56 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
}
|
||||
#endif
|
||||
|
||||
static bool previousWasJSCleanup = false;
|
||||
enum ForgetSkippableCleanupState
|
||||
{
|
||||
eInitial = 0,
|
||||
eUnmarkJSEventListeners = 1,
|
||||
eUnmarkMessageManagers = 2,
|
||||
eUnmarkStrongObservers = 3,
|
||||
eUnmarkJSHolders = 4,
|
||||
eDone = 5
|
||||
};
|
||||
|
||||
static_assert(eDone == NS_MAJOR_FORGET_SKIPPABLE_CALLS,
|
||||
"There must be one forgetSkippable call per cleanup state.");
|
||||
|
||||
static uint32_t sFSState = eDone;
|
||||
if (prepareForCC) {
|
||||
sFSState = eDone;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (cleanupJS) {
|
||||
nsContentUtils::UnmarkGrayJSListenersInCCGenerationDocuments(sGeneration);
|
||||
MarkMessageManagers();
|
||||
// After a GC we start clean up phases from the beginning,
|
||||
// but we don't want to do the additional clean up phases here
|
||||
// since we have done already plenty of gray unmarking while going through
|
||||
// frame message managers and docshells.
|
||||
sFSState = eInitial;
|
||||
return NS_OK;
|
||||
} else {
|
||||
++sFSState;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
static_cast<nsObserverService *>(obs.get())->UnmarkGrayStrongObservers();
|
||||
|
||||
previousWasJSCleanup = true;
|
||||
} else if (previousWasJSCleanup) {
|
||||
previousWasJSCleanup = false;
|
||||
if (!prepareForCC) {
|
||||
switch(sFSState) {
|
||||
case eUnmarkJSEventListeners: {
|
||||
nsContentUtils::UnmarkGrayJSListenersInCCGenerationDocuments(sGeneration);
|
||||
break;
|
||||
}
|
||||
case eUnmarkMessageManagers: {
|
||||
MarkMessageManagers();
|
||||
break;
|
||||
}
|
||||
case eUnmarkStrongObservers: {
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
static_cast<nsObserverService *>(obs.get())->UnmarkGrayStrongObservers();
|
||||
break;
|
||||
}
|
||||
case eUnmarkJSHolders: {
|
||||
xpc_UnmarkSkippableJSHolders();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ const size_t gStackSize = 8192;
|
|||
// and doing the actual CC.
|
||||
#define NS_CC_DELAY 6000 // ms
|
||||
|
||||
#define NS_CC_SKIPPABLE_DELAY 400 // ms
|
||||
#define NS_CC_SKIPPABLE_DELAY 250 // ms
|
||||
|
||||
// Maximum amount of time that should elapse between incremental CC slices
|
||||
static const int64_t kICCIntersliceDelay = 32; // ms
|
||||
|
@ -144,8 +144,6 @@ static const uint32_t kMaxICCDuration = 2000; // ms
|
|||
// Large value used to specify that a script should run essentially forever
|
||||
#define NS_UNLIMITED_SCRIPT_RUNTIME (0x40000000LL << 32)
|
||||
|
||||
#define NS_MAJOR_FORGET_SKIPPABLE_CALLS 2
|
||||
|
||||
// if you add statics here, add them to the list in StartupJSEnvironment
|
||||
|
||||
static nsITimer *sGCTimer;
|
||||
|
@ -2036,8 +2034,10 @@ CCTimerFired(nsITimer *aTimer, void *aClosure)
|
|||
// any because that will allow us to include the GC time in the CC pause.
|
||||
nsJSContext::RunCycleCollectorSlice();
|
||||
}
|
||||
} else if ((sPreviousSuspectedCount + 100) <= suspected) {
|
||||
// Only do a forget skippable if there are more than a few new objects.
|
||||
} else if (((sPreviousSuspectedCount + 100) <= suspected) ||
|
||||
(sCleanupsSinceLastGC < NS_MAJOR_FORGET_SKIPPABLE_CALLS)) {
|
||||
// Only do a forget skippable if there are more than a few new objects
|
||||
// or we're doing the initial forget skippables.
|
||||
FireForgetSkippable(suspected, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ struct CycleCollectorResults;
|
|||
// a page) and doing the actual GC.
|
||||
#define NS_GC_DELAY 4000 // ms
|
||||
|
||||
#define NS_MAJOR_FORGET_SKIPPABLE_CALLS 5
|
||||
|
||||
class nsJSContext : public nsIScriptContext
|
||||
{
|
||||
public:
|
||||
|
|
Загрузка…
Ссылка в новой задаче