mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 1130475 - Part 1: Move last-ditch IGC heap overflow trigger to CheckAllocatorState; r=sfink
--HG-- extra : rebase_source : e6a5ac26fe8a747c22cc39314909f56740d48c14
This commit is contained in:
parent
b555b1ca9c
commit
88fdd783d6
@ -59,6 +59,7 @@ namespace JS {
|
||||
D(FULL_STORE_BUFFER) \
|
||||
D(SHARED_MEMORY_LIMIT) \
|
||||
D(PERIODIC_FULL_GC) \
|
||||
D(INCREMENTAL_TOO_SLOW) \
|
||||
\
|
||||
/* These are reserved for future use. */ \
|
||||
D(RESERVED0) \
|
||||
@ -78,7 +79,6 @@ namespace JS {
|
||||
D(RESERVED14) \
|
||||
D(RESERVED15) \
|
||||
D(RESERVED16) \
|
||||
D(RESERVED17) \
|
||||
\
|
||||
/* Reasons from Firefox */ \
|
||||
D(DOM_WINDOW_UTILS) \
|
||||
|
@ -2953,22 +2953,14 @@ GCRuntime::refillFreeListFromMainThread(JSContext *cx, AllocKind thingKind)
|
||||
ArenaLists *arenas = cx->arenas();
|
||||
Zone *zone = cx->zone();
|
||||
|
||||
// If we have grown past our GC heap threshold while in the middle of an
|
||||
// incremental GC, we're growing faster than we're GCing, so stop the world
|
||||
// and do a full, non-incremental GC right now, if possible.
|
||||
const bool mustCollectNow = allowGC && rt->gc.isIncrementalGCInProgress() &&
|
||||
zone->usage.gcBytes() > zone->threshold.gcTriggerBytes();
|
||||
|
||||
bool outOfMemory = false; // Set true if we fail to allocate.
|
||||
bool ranGC = false; // Once we've GC'd and still cannot allocate, report.
|
||||
do {
|
||||
if (MOZ_UNLIKELY(mustCollectNow || outOfMemory)) {
|
||||
if (MOZ_UNLIKELY(outOfMemory)) {
|
||||
// If we are doing a fallible allocation, percolate up the OOM
|
||||
// instead of reporting it.
|
||||
if (!allowGC) {
|
||||
MOZ_ASSERT(!mustCollectNow);
|
||||
if (!allowGC)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (void *thing = RunLastDitchGC(cx, zone, thingKind))
|
||||
return thing;
|
||||
|
@ -452,6 +452,17 @@ CheckAllocatorState(ExclusiveContext *cx, AllocKind kind)
|
||||
// handle that here. Just check in case we need to collect instead.
|
||||
rt->gc.gcIfRequested(ncx);
|
||||
}
|
||||
|
||||
// If we have grown past our GC heap threshold while in the middle of
|
||||
// an incremental GC, we're growing faster than we're GCing, so stop
|
||||
// the world and do a full, non-incremental GC right now, if possible.
|
||||
if (rt->gc.isIncrementalGCInProgress() &&
|
||||
ncx->zone()->usage.gcBytes() > ncx->zone()->threshold.gcTriggerBytes())
|
||||
{
|
||||
PrepareZoneForGC(ncx->zone());
|
||||
AutoKeepAtoms keepAtoms(cx->perThreadData);
|
||||
rt->gc.gc(GC_NORMAL, JS::gcreason::INCREMENTAL_TOO_SLOW);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user