mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1208554 - Take Velocity into account for WheelScrollAnimations. r=kats (2fe3c0e047)
- Bug 1207656: APZ mouse wheel scroll: don't ignore minimum duration. r=dvander (c195a2b7e2)
- Bug 1199468 - Create prefs for the smooth scroll timing function shape. r=kats (f65176f9b1)
- Bug 1247677 - Add support for the general.smoothScroll.{pages,pixels} prefs in APZ. r=dvander (e56a15b294)
- Bug 1244735 - Preference to override the default behaviour for partial present. r=jrmuizel (a0e19e8a8e)
- Bug 1223144 - Scale texture coordinates in CompositorOGL for non POT textures. r=mwoodrow (a4b654b00a)
- set reporter end (09ddff0c78)
- Add full mix-blend mode support to the D3D11 compositor. (bug 1238496, r=bas) (6ef3e68cbf)
- Bug 1235994 - For wheel events which may have momentum following them, handle scroll snapping in APZ. r=mstange (b9837185ea)
- Bug 1230674 - part 4, Update AsyncPanZoomController to call overscroll api when building for Android r=kats (60d551820d)
- Bug 1235994 - Extract a helper function to request a snap to the predicted destination. r=botond (c4436d3c5e)
- Bug 1243547 - Route scroll position adjusting for surface shifting directly to APZC. r=rbarker (3b86ab8f2f)
- Bug 1192919 - Follow-up to fix build error with logging enabled. r=me and DONTBUILD (f29229d6c4)
- Bug 1242173 - Typing in input fields does not visually update r= (a2ef65d735)
- Bug 1244901 - When recording transform duration for potential checkerboarding time, do so on the compositor thread. r=botond (cf0be4b328)
- Bug 1240202 - Avoid getting stuck in overscroll when a second finger goes down while overscrolled and in the TOUCHING state. r=kats (96c7ef87af)
- Bug 1236519 - Ensure JSFunction::isDerivedClassConstructor properly handles lazy self-hosted functions. r=till a=bustage (236b72dd50)
- Bug 1232229 - Add some instrumentation and more fencing to ArenaLists; r=ehoogeveen (f6595958c6)
- Bug 1232229 - Instrument setting ArenaHeader::next to catch misuse and fix existing instrumentation. r=terrence (68377d13b7)
- Bug 1248949 - Optimize Arena::thingsPerArena. r=terrence (ee28f3a6af)
- Bug 1245965 - Fix and OOM handling failure in NewMemInfoObject; r=sfink (29e684a163)
- Bug 1245518 - Implement ModuleEnvironmentObject::getOwnPropertyDescriptor() which is called by the debugger r=shu (cef4dc6fce)
- Bug 1232113 - "Make the format specifiers in JS_snprintf() invocations more portable". r=jwalden+bmo (cdf8a9915f)
- Bug 1234387 - DumpBacktrace: Check the result of Sprinter::init function. r=bbouvier (3b7f6aac37)
- Bug 1233944 - Upgrade MOZ_ASSERT to MOZ_RELEASE_ASSERT in JSObject::setGroup. r=me (75e7aa92dc)
- Bug 1203696: Make js::IsInternalFunctionObject consider non-lambdas internal. r=bhackett (1531e8ecd9)
- Bug 1235641 - Add line and column info to dump bytecode basic blocks. r=sstangl (0f642867a0)
- Bug 1052793, part 1 - Do per-zone GC for CC_WAITING triggers. r=smaug (b733898730)
- Bug 1052793, part 2 - Shrink GC buffers during compartmental GCs. r=terrence (0e4cd6218e)
- Bug 1237169 - Remove some unused parameters in and around xpcom/base/. r=mccr8. (9a08690fa7)
- Bug 1247122 - Propagate the NS_ERROR_OUT_OF_MEMORY from CycleCollectedJSRuntime CTOR, r=khuey (5e8bd1d14b)
- Bug 1200514 - Run remaining stable state runnables after final cycle collection. r=froydnj,mccr8 (410c3bf2ad)
- Bug 1247381 - Restore a CC optimization dropped in bug 1105069 part 7; r=mccr8 (c76e8613e7)
- Bug 1249932 - indicate in the GC and CC log (browser console) whetherit is about default or content process, r=mccr8 (1d89d18e69)
- Bug 1232113 - "Make the format specifiers in JS_snprintf() invocations more portable". r=jandem (d9a480c28c)
- Bug 1223222 - Part 1: Add NSPRLogModulesParser. r=froydnj (2a79976e1f)
- Bug 1223222 - Part 2: Add tests for NSPRLogModulesParser. r=froydnj (bde482099c)
- Bug 1233881 - Support dynamically setting log levels at runtime via prefs. r=froydnj (c5c685f924)
- Bug 1223222 - Part 3: Remove usage of PR_NewLogModule in mozilla LogModule code. r=froydnj (6eee38c6a7)
- Bug 1150917 - Remove all values from nsIProgrammingLanguage except UNKNOWN and JAVASCRIPT. r=froydnj (9626abcc33)
- Bug 1174972 - Add basic mozilla logging backend. r=froydnj,r=bwc,r=jduell (8e22fb5a66)
- Bug 961430 - Allow pid be added to the log file name automatically. r=froydnj (4d28e09d9a)
- Bug 1239212 - Append missing newlines to log messages. r=froydnj (0a94f048f0)
- Bug 1242097 - Support sync module for logging (r=erahm) (ce3648c763)
- Bug 885952 - Add thread name to MozLogging, r=froydnj (94bb1979e2)
- Bug 1239941 - Copy va_list before using it in LogModuleManager::Print. r=froydnj (0767e1900e)
- Bug 1249451 - nsCycleCollector::ScanRoots may cause some unexpected purple buffer usage, r=mccr8 (96591fa1a1)
- Bug 1237169 (follow-up) - Fix static analysis bustage. r=me. (3e177f98cc)
- Bug 1242151: using va_list needs <stdarg.h> at least on OpenBSD r=erahm (7c36e9191c)
- Bug 1226376 - Part 1: Allow non-trivial constexpr constructors in MOZ_TRIVIAL_CTOR_DTOR classes, r=ehsan (ec1fb5cc1d)
- Bug 1226376 - Part 2: Annotate StaticMutex with MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS, r=nfroyd (484904f38a)
- Bug 1223927 - Add resident-unique measurement to OS X. r=njn (4b97965c38)
- Bug 1224685 - Add |resident-unique| measurement to Windows. r=njn (bde0a2fbed)
- Bug 1239516 - Use nsDependentCSubstring for wrapping a slice of a char buffer. r=karlt (bd62aee33a)
- bug 1245745 include libpulse version in update URL r=glandium (74f389b1c7)
- Bug 1245673 - Remove useless NS_INT32_TO_PTR from DumpSerialNumbers. r=froydnj (16d58e9abd)
- Bug 1243949 - Fatally assert when we fail to create an XPCOM log. r=froydnj (9121c52fed)
- Remove the workaround added in bug 1022420 now that clang-cl understands __declspec(novtable) (fc81af6630)
- Bug 1239888 - Inline PLDHashTable::{Done,Get}(). r=froydnjx. (9faa5b7c2a)
- Bug 1244606 - Remove PL_DHASH_FASTCALL. r=froydnj. (6620b7c82e)
- Bug 1159306 - explicitly initialize nsBaseHashtableET::mData; r=erahm (458559bea7)
- Bug 1220544 - Fix -Wunreachable-code warnings in xpcom. r=mccr8 (371d0809e4)
- reapply Bug 833117 - Replace g_slice_set_config() with G_SLICE environmen variable (c47805a6cf)
- bug 1171574 - XPCOMGlue doesn't need LEADING_UNDERSCORE for iOS. r=froydnj (a4472ef3d3)
This commit is contained in:
@@ -209,7 +209,7 @@ NoteWeakMapsTracer::trace(JSObject* aMap, JS::GCCellPtr aKey,
|
||||
mChildTracer.mKey = aKey;
|
||||
mChildTracer.mKeyDelegate = kdelegate;
|
||||
|
||||
if (aValue.is<JSString>()) {
|
||||
if (!aValue.is<JSString>()) {
|
||||
JS::TraceChildren(&mChildTracer, aValue);
|
||||
}
|
||||
|
||||
@@ -406,12 +406,10 @@ static const JSZoneParticipant sJSZoneCycleCollectorGlobal;
|
||||
static
|
||||
void JSObjectsTenuredCb(JSRuntime* aRuntime, void* aData)
|
||||
{
|
||||
static_cast<CycleCollectedJSRuntime*>(aData)->JSObjectsTenured(aRuntime);
|
||||
static_cast<CycleCollectedJSRuntime*>(aData)->JSObjectsTenured();
|
||||
}
|
||||
|
||||
CycleCollectedJSRuntime::CycleCollectedJSRuntime(JSRuntime* aParentRuntime,
|
||||
uint32_t aMaxBytes,
|
||||
uint32_t aMaxNurseryBytes)
|
||||
CycleCollectedJSRuntime::CycleCollectedJSRuntime()
|
||||
: mGCThingCycleCollectorGlobal(sGCThingCycleCollectorGlobal)
|
||||
, mJSZoneCycleCollectorGlobal(sJSZoneCycleCollectorGlobal)
|
||||
, mJSRuntime(nullptr)
|
||||
@@ -425,16 +423,52 @@ CycleCollectedJSRuntime::CycleCollectedJSRuntime(JSRuntime* aParentRuntime,
|
||||
nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
|
||||
mOwningThread = thread.forget().downcast<nsThread>().take();
|
||||
MOZ_RELEASE_ASSERT(mOwningThread);
|
||||
}
|
||||
|
||||
CycleCollectedJSRuntime::~CycleCollectedJSRuntime()
|
||||
{
|
||||
// If the allocation failed, here we are.
|
||||
if (!mJSRuntime) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mDeferredFinalizerTable.Count());
|
||||
|
||||
// Last chance to process any events.
|
||||
ProcessMetastableStateQueue(mBaseRecursionDepth);
|
||||
MOZ_ASSERT(mMetastableStateEvents.IsEmpty());
|
||||
|
||||
ProcessStableStateQueue();
|
||||
MOZ_ASSERT(mStableStateEvents.IsEmpty());
|
||||
|
||||
// Clear mPendingException first, since it might be cycle collected.
|
||||
mPendingException = nullptr;
|
||||
|
||||
JS_DestroyRuntime(mJSRuntime);
|
||||
mJSRuntime = nullptr;
|
||||
nsCycleCollector_forgetJSRuntime();
|
||||
|
||||
mozilla::dom::DestroyScriptSettings();
|
||||
|
||||
mOwningThread->SetScriptObserver(nullptr);
|
||||
NS_RELEASE(mOwningThread);
|
||||
}
|
||||
|
||||
nsresult
|
||||
CycleCollectedJSRuntime::Initialize(JSRuntime* aParentRuntime,
|
||||
uint32_t aMaxBytes,
|
||||
uint32_t aMaxNurseryBytes)
|
||||
{
|
||||
MOZ_ASSERT(!mJSRuntime);
|
||||
|
||||
mOwningThread->SetScriptObserver(this);
|
||||
// The main thread has a base recursion depth of 0, workers of 1.
|
||||
mBaseRecursionDepth = RecursionDepth();
|
||||
|
||||
mozilla::dom::InitScriptSettings();
|
||||
|
||||
mJSRuntime = JS_NewRuntime(aMaxBytes, aMaxNurseryBytes, aParentRuntime);
|
||||
if (!mJSRuntime) {
|
||||
MOZ_CRASH();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (!JS_AddExtraGCRootsTracer(mJSRuntime, TraceBlackJS, this)) {
|
||||
@@ -476,31 +510,8 @@ CycleCollectedJSRuntime::CycleCollectedJSRuntime(JSRuntime* aParentRuntime,
|
||||
JS::dbg::SetDebuggerMallocSizeOf(mJSRuntime, moz_malloc_size_of);
|
||||
|
||||
nsCycleCollector_registerJSRuntime(this);
|
||||
}
|
||||
|
||||
CycleCollectedJSRuntime::~CycleCollectedJSRuntime()
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
MOZ_ASSERT(!mDeferredFinalizerTable.Count());
|
||||
|
||||
// Last chance to process any events.
|
||||
ProcessMetastableStateQueue(mBaseRecursionDepth);
|
||||
MOZ_ASSERT(mMetastableStateEvents.IsEmpty());
|
||||
|
||||
ProcessStableStateQueue();
|
||||
MOZ_ASSERT(mStableStateEvents.IsEmpty());
|
||||
|
||||
// Clear mPendingException first, since it might be cycle collected.
|
||||
mPendingException = nullptr;
|
||||
|
||||
JS_DestroyRuntime(mJSRuntime);
|
||||
mJSRuntime = nullptr;
|
||||
nsCycleCollector_forgetJSRuntime();
|
||||
|
||||
mozilla::dom::DestroyScriptSettings();
|
||||
|
||||
mOwningThread->SetScriptObserver(nullptr);
|
||||
NS_RELEASE(mOwningThread);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
size_t
|
||||
@@ -650,6 +661,8 @@ void
|
||||
CycleCollectedJSRuntime::TraverseZone(JS::Zone* aZone,
|
||||
nsCycleCollectionTraversalCallback& aCb)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
/*
|
||||
* We treat the zone as being gray. We handle non-gray GCthings in the
|
||||
* zone by not reporting their children to the CC. The black-gray invariant
|
||||
@@ -963,6 +976,8 @@ mozilla::TraceScriptHolder(nsISupports* aHolder, JSTracer* aTracer)
|
||||
void
|
||||
CycleCollectedJSRuntime::TraceNativeGrayRoots(JSTracer* aTracer)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
// NB: This is here just to preserve the existing XPConnect order. I doubt it
|
||||
// would hurt to do this after the JS holders.
|
||||
TraceAdditionalNativeGrayRoots(aTracer);
|
||||
@@ -977,6 +992,7 @@ CycleCollectedJSRuntime::TraceNativeGrayRoots(JSTracer* aTracer)
|
||||
void
|
||||
CycleCollectedJSRuntime::AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
mJSHolders.Put(aHolder, aTracer);
|
||||
}
|
||||
|
||||
@@ -1027,6 +1043,8 @@ struct ClearJSHolder : public TraceCallbacks
|
||||
void
|
||||
CycleCollectedJSRuntime::RemoveJSHolder(void* aHolder)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
nsScriptObjectTracer* tracer = mJSHolders.Get(aHolder);
|
||||
if (!tracer) {
|
||||
return;
|
||||
@@ -1039,6 +1057,7 @@ CycleCollectedJSRuntime::RemoveJSHolder(void* aHolder)
|
||||
bool
|
||||
CycleCollectedJSRuntime::IsJSHolder(void* aHolder)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
return mJSHolders.Get(aHolder, nullptr);
|
||||
}
|
||||
|
||||
@@ -1051,6 +1070,8 @@ AssertNoGcThing(JS::GCCellPtr aGCThing, const char* aName, void* aClosure)
|
||||
void
|
||||
CycleCollectedJSRuntime::AssertNoObjectsToTrace(void* aPossibleJSHolder)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
nsScriptObjectTracer* tracer = mJSHolders.Get(aPossibleJSHolder);
|
||||
if (tracer) {
|
||||
tracer->Trace(aPossibleJSHolder, TraceCallbackFunc(AssertNoGcThing), nullptr);
|
||||
@@ -1061,6 +1082,8 @@ CycleCollectedJSRuntime::AssertNoObjectsToTrace(void* aPossibleJSHolder)
|
||||
already_AddRefed<nsIException>
|
||||
CycleCollectedJSRuntime::GetPendingException() const
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
nsCOMPtr<nsIException> out = mPendingException;
|
||||
return out.forget();
|
||||
}
|
||||
@@ -1068,30 +1091,36 @@ CycleCollectedJSRuntime::GetPendingException() const
|
||||
void
|
||||
CycleCollectedJSRuntime::SetPendingException(nsIException* aException)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
mPendingException = aException;
|
||||
}
|
||||
|
||||
std::queue<nsCOMPtr<nsIRunnable>>&
|
||||
CycleCollectedJSRuntime::GetPromiseMicroTaskQueue()
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
return mPromiseMicroTaskQueue;
|
||||
}
|
||||
|
||||
nsCycleCollectionParticipant*
|
||||
CycleCollectedJSRuntime::GCThingParticipant()
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
return &mGCThingCycleCollectorGlobal;
|
||||
}
|
||||
|
||||
nsCycleCollectionParticipant*
|
||||
CycleCollectedJSRuntime::ZoneParticipant()
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
return &mJSZoneCycleCollectorGlobal;
|
||||
}
|
||||
|
||||
nsresult
|
||||
CycleCollectedJSRuntime::TraverseRoots(nsCycleCollectionNoteRootCallback& aCb)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
TraverseNativeRoots(aCb);
|
||||
|
||||
NoteWeakMapsTracer trc(mJSRuntime, aCb);
|
||||
@@ -1108,6 +1137,8 @@ CycleCollectedJSRuntime::TraverseRoots(nsCycleCollectionNoteRootCallback& aCb)
|
||||
bool
|
||||
CycleCollectedJSRuntime::UsefulToMergeZones() const
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
return false;
|
||||
}
|
||||
@@ -1137,6 +1168,7 @@ CycleCollectedJSRuntime::UsefulToMergeZones() const
|
||||
void
|
||||
CycleCollectedJSRuntime::FixWeakMappingGrayBits() const
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
MOZ_ASSERT(!JS::IsIncrementalGCInProgress(mJSRuntime),
|
||||
"Don't call FixWeakMappingGrayBits during a GC.");
|
||||
FixWeakMappingGrayBitsTracer fixer(mJSRuntime);
|
||||
@@ -1146,12 +1178,15 @@ CycleCollectedJSRuntime::FixWeakMappingGrayBits() const
|
||||
bool
|
||||
CycleCollectedJSRuntime::AreGCGrayBitsValid() const
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
return js::AreGCGrayBitsValid(mJSRuntime);
|
||||
}
|
||||
|
||||
void
|
||||
CycleCollectedJSRuntime::GarbageCollect(uint32_t aReason) const
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
MOZ_ASSERT(aReason < JS::gcreason::NUM_REASONS);
|
||||
JS::gcreason::Reason gcreason = static_cast<JS::gcreason::Reason>(aReason);
|
||||
|
||||
@@ -1160,8 +1195,10 @@ CycleCollectedJSRuntime::GarbageCollect(uint32_t aReason) const
|
||||
}
|
||||
|
||||
void
|
||||
CycleCollectedJSRuntime::JSObjectsTenured(JSRuntime* aRuntime)
|
||||
CycleCollectedJSRuntime::JSObjectsTenured()
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
for (auto iter = mNurseryObjects.Iter(); !iter.Done(); iter.Next()) {
|
||||
nsWrapperCache* cache = iter.Get();
|
||||
JSObject* wrapper = cache->GetWrapperPreserveColor();
|
||||
@@ -1186,6 +1223,7 @@ for (auto iter = mPreservedNurseryObjects.Iter(); !iter.Done(); iter.Next()) {
|
||||
void
|
||||
CycleCollectedJSRuntime::NurseryWrapperAdded(nsWrapperCache* aCache)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
MOZ_ASSERT(aCache);
|
||||
MOZ_ASSERT(aCache->GetWrapperPreserveColor());
|
||||
MOZ_ASSERT(!JS::ObjectIsTenured(aCache->GetWrapperPreserveColor()));
|
||||
@@ -1195,6 +1233,8 @@ CycleCollectedJSRuntime::NurseryWrapperAdded(nsWrapperCache* aCache)
|
||||
void
|
||||
CycleCollectedJSRuntime::NurseryWrapperPreserved(JSObject* aWrapper)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
mPreservedNurseryObjects.InfallibleAppend(
|
||||
JS::PersistentRooted<JSObject*>(mJSRuntime, aWrapper));
|
||||
}
|
||||
@@ -1204,6 +1244,8 @@ CycleCollectedJSRuntime::DeferredFinalize(DeferredFinalizeAppendFunction aAppend
|
||||
DeferredFinalizeFunction aFunc,
|
||||
void* aThing)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
void* thingArray = nullptr;
|
||||
bool hadThingArray = mDeferredFinalizerTable.Get(aFunc, &thingArray);
|
||||
|
||||
@@ -1216,6 +1258,8 @@ CycleCollectedJSRuntime::DeferredFinalize(DeferredFinalizeAppendFunction aAppend
|
||||
void
|
||||
CycleCollectedJSRuntime::DeferredFinalize(nsISupports* aSupports)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
typedef DeferredFinalizerImpl<nsISupports> Impl;
|
||||
DeferredFinalize(Impl::AppendDeferredFinalizePointer, Impl::DeferredFinalize,
|
||||
aSupports);
|
||||
@@ -1224,12 +1268,14 @@ CycleCollectedJSRuntime::DeferredFinalize(nsISupports* aSupports)
|
||||
void
|
||||
CycleCollectedJSRuntime::DumpJSHeap(FILE* aFile)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
js::DumpHeap(Runtime(), aFile, js::CollectNurseryBeforeDump);
|
||||
}
|
||||
|
||||
void
|
||||
CycleCollectedJSRuntime::ProcessStableStateQueue()
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
MOZ_RELEASE_ASSERT(!mDoingStableStates);
|
||||
mDoingStableStates = true;
|
||||
|
||||
@@ -1245,6 +1291,7 @@ CycleCollectedJSRuntime::ProcessStableStateQueue()
|
||||
void
|
||||
CycleCollectedJSRuntime::ProcessMetastableStateQueue(uint32_t aRecursionDepth)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
MOZ_RELEASE_ASSERT(!mDoingStableStates);
|
||||
mDoingStableStates = true;
|
||||
|
||||
@@ -1275,6 +1322,8 @@ CycleCollectedJSRuntime::ProcessMetastableStateQueue(uint32_t aRecursionDepth)
|
||||
void
|
||||
CycleCollectedJSRuntime::AfterProcessTask(uint32_t aRecursionDepth)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
// See HTML 6.1.4.2 Processing model
|
||||
|
||||
// Execute any events that were waiting for a microtask to complete.
|
||||
@@ -1295,12 +1344,15 @@ CycleCollectedJSRuntime::AfterProcessTask(uint32_t aRecursionDepth)
|
||||
void
|
||||
CycleCollectedJSRuntime::AfterProcessMicrotask()
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
AfterProcessMicrotask(RecursionDepth());
|
||||
}
|
||||
|
||||
void
|
||||
CycleCollectedJSRuntime::AfterProcessMicrotask(uint32_t aRecursionDepth)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
// Between microtasks, execute any events that were waiting for a microtask
|
||||
// to complete.
|
||||
ProcessMetastableStateQueue(aRecursionDepth);
|
||||
@@ -1322,6 +1374,8 @@ CycleCollectedJSRuntime::RunInStableState(already_AddRefed<nsIRunnable>&& aRunna
|
||||
void
|
||||
CycleCollectedJSRuntime::RunInMetastableState(already_AddRefed<nsIRunnable>&& aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
RunInMetastableStateData data;
|
||||
data.mRunnable = aRunnable;
|
||||
|
||||
@@ -1440,6 +1494,8 @@ IncrementalFinalizeRunnable::Run()
|
||||
void
|
||||
CycleCollectedJSRuntime::FinalizeDeferredThings(DeferredFinalizeType aType)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
/*
|
||||
* If the previous GC created a runnable to finalize objects
|
||||
* incrementally, and if it hasn't finished yet, finish it now. We
|
||||
@@ -1478,6 +1534,8 @@ void
|
||||
CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
|
||||
OOMState aNewState)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
*aStatePtr = aNewState;
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporter::AnnotateCrashReport(aStatePtr == &mOutOfMemoryState
|
||||
@@ -1494,9 +1552,12 @@ CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
|
||||
void
|
||||
CycleCollectedJSRuntime::OnGC(JSGCStatus aStatus)
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
switch (aStatus) {
|
||||
case JSGC_BEGIN:
|
||||
nsCycleCollector_prepareForGarbageCollection();
|
||||
mZonesWaitingForGC.Clear();
|
||||
break;
|
||||
case JSGC_END: {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
@@ -1523,6 +1584,8 @@ CycleCollectedJSRuntime::OnGC(JSGCStatus aStatus)
|
||||
void
|
||||
CycleCollectedJSRuntime::OnOutOfMemory()
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
AnnotateAndSetOutOfMemory(&mOutOfMemoryState, OOMState::Reporting);
|
||||
CustomOutOfMemoryCallback();
|
||||
AnnotateAndSetOutOfMemory(&mOutOfMemoryState, OOMState::Reported);
|
||||
@@ -1531,7 +1594,22 @@ CycleCollectedJSRuntime::OnOutOfMemory()
|
||||
void
|
||||
CycleCollectedJSRuntime::OnLargeAllocationFailure()
|
||||
{
|
||||
MOZ_ASSERT(mJSRuntime);
|
||||
|
||||
AnnotateAndSetOutOfMemory(&mLargeAllocationFailureState, OOMState::Reporting);
|
||||
CustomLargeAllocationFailureCallback();
|
||||
AnnotateAndSetOutOfMemory(&mLargeAllocationFailureState, OOMState::Reported);
|
||||
}
|
||||
|
||||
void
|
||||
CycleCollectedJSRuntime::PrepareWaitingZonesForGC()
|
||||
{
|
||||
if (mZonesWaitingForGC.Count() == 0) {
|
||||
JS::PrepareForFullGC(Runtime());
|
||||
} else {
|
||||
for (auto iter = mZonesWaitingForGC.Iter(); !iter.Done(); iter.Next()) {
|
||||
JS::PrepareZoneForGC(iter.Get()->GetKey());
|
||||
}
|
||||
mZonesWaitingForGC.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user