зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1116821, bug 1110928) for Windows OOMs
CLOSED TREE Backed out changeset 9d593597df5f (bug 1110928) Backed out changeset d68c75986335 (bug 1110928) Backed out changeset 21d807074550 (bug 1110928) Backed out changeset ca77252e50dd (bug 1116821)
This commit is contained in:
Родитель
b39fa64608
Коммит
e75fcfb043
|
@ -2680,6 +2680,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
|||
newInnerWindow->mChromeEventHandler = mChromeEventHandler;
|
||||
}
|
||||
|
||||
nsJSContext::PokeGC(JS::gcreason::SET_NEW_DOCUMENT);
|
||||
mContext->DidInitializeContext();
|
||||
|
||||
// We wait to fire the debugger hook until the window is all set up and hooked
|
||||
|
@ -2902,7 +2903,7 @@ nsGlobalWindow::DetachFromDocShell()
|
|||
mChromeEventHandler = nullptr; // force release now
|
||||
|
||||
if (mContext) {
|
||||
nsJSContext::PokeGC(JS::gcreason::SET_DOC_SHELL, GetWrapperPreserveColor());
|
||||
nsJSContext::PokeGC(JS::gcreason::SET_DOC_SHELL);
|
||||
mContext = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -654,7 +654,7 @@ nsJSContext::DestroyJSContext()
|
|||
js_options_dot_str, this);
|
||||
|
||||
if (mGCOnDestruction) {
|
||||
PokeGC(JS::gcreason::NSJSCONTEXT_DESTROY, mWindowProxy);
|
||||
PokeGC(JS::gcreason::NSJSCONTEXT_DESTROY);
|
||||
}
|
||||
|
||||
JS_DestroyContextNoGC(mContext);
|
||||
|
@ -1463,11 +1463,8 @@ nsJSContext::GarbageCollectNow(JS::gcreason::Reason aReason,
|
|||
return;
|
||||
}
|
||||
|
||||
if (aIncremental == NonIncrementalGC || aReason == JS::gcreason::FULL_GC_TIMER) {
|
||||
sNeedsFullGC = true;
|
||||
}
|
||||
|
||||
if (sNeedsFullGC) {
|
||||
if (sNeedsFullGC || aReason != JS::gcreason::CC_WAITING) {
|
||||
sNeedsFullGC = false;
|
||||
JS::PrepareForFullGC(sRuntime);
|
||||
} else {
|
||||
CycleCollectedJSRuntime::Get()->PrepareWaitingZonesForGC();
|
||||
|
@ -1828,7 +1825,7 @@ nsJSContext::EndCycleCollectionCallback(CycleCollectorResults &aResults)
|
|||
uint32_t ccNowDuration = TimeBetween(gCCStats.mBeginTime, endCCTimeStamp);
|
||||
|
||||
if (NeedsGCAfterCC()) {
|
||||
PokeGC(JS::gcreason::CC_WAITING, nullptr,
|
||||
PokeGC(JS::gcreason::CC_WAITING,
|
||||
NS_GC_DELAY - std::min(ccNowDuration, kMaxICCDuration));
|
||||
}
|
||||
|
||||
|
@ -2092,7 +2089,9 @@ nsJSContext::LoadEnd()
|
|||
return;
|
||||
}
|
||||
|
||||
// Its probably a good idea to GC soon since we have finished loading.
|
||||
sLoadingInProgress = false;
|
||||
PokeGC(JS::gcreason::LOAD_END);
|
||||
}
|
||||
|
||||
// Only trigger expensive timers when they have been checked a number of times.
|
||||
|
@ -2155,20 +2154,11 @@ nsJSContext::RunNextCollectorTimer()
|
|||
|
||||
// static
|
||||
void
|
||||
nsJSContext::PokeGC(JS::gcreason::Reason aReason, JSObject* aObj, int aDelay)
|
||||
nsJSContext::PokeGC(JS::gcreason::Reason aReason, int aDelay)
|
||||
{
|
||||
if (sShuttingDown) {
|
||||
return;
|
||||
}
|
||||
sNeedsFullGC = sNeedsFullGC || aReason != JS::gcreason::CC_WAITING;
|
||||
|
||||
if (aObj) {
|
||||
JS::Zone* zone = JS::GetTenuredGCThingZone(aObj);
|
||||
CycleCollectedJSRuntime::Get()->AddZoneWaitingForGC(zone);
|
||||
} else if (aReason != JS::gcreason::CC_WAITING) {
|
||||
sNeedsFullGC = true;
|
||||
}
|
||||
|
||||
if (sGCTimer || sInterSliceGCTimer) {
|
||||
if (sGCTimer || sInterSliceGCTimer || sShuttingDown) {
|
||||
// There's already a timer for GC'ing, just return
|
||||
return;
|
||||
}
|
||||
|
@ -2351,10 +2341,6 @@ DOMGCSliceCallback(JSRuntime *aRt, JS::GCProgress aProgress, const JS::GCDescrip
|
|||
|
||||
nsJSContext::KillShrinkGCBuffersTimer();
|
||||
|
||||
if (!aDesc.isCompartment_) {
|
||||
sNeedsFullGC = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,8 +110,7 @@ public:
|
|||
|
||||
static void RunNextCollectorTimer();
|
||||
|
||||
// The GC should probably run soon, in the zone of object aObj (if given).
|
||||
static void PokeGC(JS::gcreason::Reason aReason, JSObject* aObj, int aDelay = 0);
|
||||
static void PokeGC(JS::gcreason::Reason aReason, int aDelay = 0);
|
||||
static void KillGCTimer();
|
||||
|
||||
static void PokeShrinkGCBuffers();
|
||||
|
|
|
@ -1039,10 +1039,6 @@ nsDocumentViewer::LoadComplete(nsresult aStatus)
|
|||
|
||||
nsJSContext::LoadEnd();
|
||||
|
||||
// It's probably a good idea to GC soon since we have finished loading.
|
||||
nsJSContext::PokeGC(JS::gcreason::LOAD_END,
|
||||
mDocument ? mDocument->GetWrapperPreserveColor() : nullptr);
|
||||
|
||||
#ifdef NS_PRINTING
|
||||
// Check to see if someone tried to print during the load
|
||||
if (mPrintIsPending) {
|
||||
|
@ -1315,13 +1311,6 @@ nsDocumentViewer::PageHide(bool aIsUnload)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (aIsUnload) {
|
||||
// Poke the GC. The window might be collectable garbage now.
|
||||
nsJSContext::PokeGC(JS::gcreason::PAGE_HIDE,
|
||||
mDocument->GetWrapperPreserveColor(),
|
||||
NS_GC_DELAY * 2);
|
||||
}
|
||||
|
||||
mDocument->OnPageHide(!aIsUnload, nullptr);
|
||||
|
||||
// inform the window so that the focus state is reset.
|
||||
|
@ -1331,6 +1320,9 @@ nsDocumentViewer::PageHide(bool aIsUnload)
|
|||
window->PageHidden();
|
||||
|
||||
if (aIsUnload) {
|
||||
// Poke the GC. The window might be collectable garbage now.
|
||||
nsJSContext::PokeGC(JS::gcreason::PAGE_HIDE, NS_GC_DELAY * 2);
|
||||
|
||||
// if Destroy() was called during OnPageHide(), mDocument is nullptr.
|
||||
NS_ENSURE_STATE(mDocument);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче