Backed out 6 changesets (bug 1110928) for valgrind failures a=backout

Backed out changeset 97a60b61a65a (bug 1110928)
Backed out changeset 5b62dda2ebd0 (bug 1110928)
Backed out changeset b587547a6df1 (bug 1110928)
Backed out changeset fb7cb3957c0d (bug 1110928)
Backed out changeset 41d7f44db1ee (bug 1110928)
Backed out changeset e809ddd9c7db (bug 1110928)

MozReview-Commit-ID: L0DCJ0HD1sG
This commit is contained in:
Wes Kocher 2017-01-23 17:34:23 -08:00
parent 7bbd79b58c
commit ae32e28e86
6 changed files with 15 additions and 65 deletions

View File

@ -1215,7 +1215,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
mHasSeenGamepadInput(false),
mNotifiedIDDestroyed(false),
mAllowScriptsToClose(false),
mTopLevelOuterContentWindow(false),
mSuspendDepth(0),
mFreezeDepth(0),
mFocusMethod(0),
@ -2909,7 +2908,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
newInnerWindow->mChromeEventHandler = mChromeEventHandler;
}
nsJSContext::PokeGC(JS::gcreason::SET_NEW_DOCUMENT, GetWrapperPreserveColor());
nsJSContext::PokeGC(JS::gcreason::SET_NEW_DOCUMENT);
kungFuDeathGrip->DidInitializeContext();
// We wait to fire the debugger hook until the window is all set up and hooked
@ -3056,9 +3055,6 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
nsCOMPtr<nsPIDOMWindowOuter> parentWindow = GetScriptableParentOrNull();
MOZ_RELEASE_ASSERT(!parentWindow || !mTabGroup || mTabGroup == Cast(parentWindow)->mTabGroup);
mTopLevelOuterContentWindow =
!mIsChrome && GetScriptableTopInternal() == this;
NS_ASSERTION(!mNavigator, "Non-null mNavigator in outer window!");
if (mFrames) {
@ -3138,12 +3134,7 @@ nsGlobalWindow::DetachFromDocShell()
mChromeEventHandler = nullptr; // force release now
if (mContext) {
// When we're about to destroy a top level content window
// (for example a tab), we trigger a full GC by passing null as the last
// param. We also trigger a full GC for chrome windows.
nsJSContext::PokeGC(JS::gcreason::SET_DOC_SHELL,
(mTopLevelOuterContentWindow || mIsChrome) ?
nullptr : GetWrapperPreserveColor());
nsJSContext::PokeGC(JS::gcreason::SET_DOC_SHELL);
mContext = nullptr;
}

View File

@ -1851,8 +1851,6 @@ protected:
// even if "dom.allow_scripts_to_close_windows" is false.
bool mAllowScriptsToClose : 1;
bool mTopLevelOuterContentWindow : 1;
nsCOMPtr<nsIScriptContext> mContext;
nsWeakPtr mOpener;
nsCOMPtr<nsIControllers> mControllers;

View File

@ -604,7 +604,7 @@ void
nsJSContext::Destroy()
{
if (mGCOnDestruction) {
PokeGC(JS::gcreason::NSJSCONTEXT_DESTROY, mWindowProxy);
PokeGC(JS::gcreason::NSJSCONTEXT_DESTROY);
}
DropJSObjects(this);
@ -1202,11 +1202,8 @@ nsJSContext::GarbageCollectNow(JS::gcreason::Reason aReason,
JSGCInvocationKind gckind = aShrinking == ShrinkingGC ? GC_SHRINK : GC_NORMAL;
if (aIncremental == NonIncrementalGC || aReason == JS::gcreason::FULL_GC_TIMER) {
sNeedsFullGC = true;
}
if (sNeedsFullGC) {
if (sNeedsFullGC || aReason != JS::gcreason::CC_WAITING) {
sNeedsFullGC = false;
JS::PrepareForFullGC(sContext);
} else {
CycleCollectedJSContext::Get()->PrepareWaitingZonesForGC();
@ -1583,7 +1580,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));
}
@ -1853,7 +1850,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.
@ -1916,22 +1915,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::GetObjectZone(aObj);
CycleCollectedJSContext::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;
}
@ -2174,10 +2162,6 @@ DOMGCSliceCallback(JSContext* aCx, JS::GCProgress aProgress, const JS::GCDescrip
nsCycleCollector_dispatchDeferredDeletion();
}
if (!aDesc.isZone_) {
sNeedsFullGC = false;
}
break;
}

View File

@ -105,8 +105,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 PokeShrinkingGC();

View File

@ -72,7 +72,6 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/Conversions.h"
#include "js/HeapAPI.h"
#include "mozilla/Alignment.h"
#include "mozilla/Assertions.h"
@ -121,7 +120,6 @@
#include "nsFontMetrics.h"
#include "Units.h"
#include "CanvasUtils.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSetHandleInlines.h"
#include "mozilla/layers/CanvasClient.h"
@ -1745,12 +1743,6 @@ CanvasRenderingContext2D::RegisterAllocation()
if (context) {
JS_updateMallocCounter(context, mWidth * mHeight * 4);
}
JSObject* wrapper = GetWrapperPreserveColor();
if (wrapper) {
CycleCollectedJSContext::Get()->
AddZoneWaitingForGC(JS::GetObjectZone(wrapper));
}
}
static already_AddRefed<LayerManager>

View File

@ -1065,10 +1065,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) {
@ -1318,13 +1314,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.
@ -1334,6 +1323,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);
@ -2405,12 +2397,6 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
NS_IMETHODIMP
nsDocumentViewer::ClearHistoryEntry()
{
if (mDocument) {
nsJSContext::PokeGC(JS::gcreason::PAGE_HIDE,
mDocument->GetWrapperPreserveColor(),
NS_GC_DELAY * 2);
}
mSHEntry = nullptr;
return NS_OK;
}