Bug 981462 - Save and restore live array buffer lists over minor GC r=terrence

This commit is contained in:
Jon Coppeard 2014-03-20 09:32:37 +00:00
parent 8f185b4070
commit 442972e4d2

View File

@ -304,6 +304,7 @@ class MinorCollectionTracer : public JSTracer
bool savedRuntimeNeedBarrier; bool savedRuntimeNeedBarrier;
AutoDisableProxyCheck disableStrictProxyChecking; AutoDisableProxyCheck disableStrictProxyChecking;
AutoEnterOOMUnsafeRegion oomUnsafeRegion; AutoEnterOOMUnsafeRegion oomUnsafeRegion;
ArrayBufferVector liveArrayBuffers;
/* Insert the given relocation entry into the list of things to visit. */ /* Insert the given relocation entry into the list of things to visit. */
MOZ_ALWAYS_INLINE void insertIntoFixupList(RelocationOverlay *entry) { MOZ_ALWAYS_INLINE void insertIntoFixupList(RelocationOverlay *entry) {
@ -335,10 +336,25 @@ class MinorCollectionTracer : public JSTracer
* GCs between incremental slices will allocate their objects marked. * GCs between incremental slices will allocate their objects marked.
*/ */
rt->setNeedsBarrier(false); rt->setNeedsBarrier(false);
/*
* We use the live array buffer lists to track traced buffers so we can
* sweep their dead views. Incremental collection also use these lists,
* so we may need to save and restore their contents here.
*/
if (rt->gcIncrementalState != NO_INCREMENTAL) {
for (GCCompartmentsIter c(rt); !c.done(); c.next()) {
if (!ArrayBufferObject::saveArrayBufferList(c, liveArrayBuffers))
CrashAtUnhandlableOOM("OOM while saving live array buffers");
ArrayBufferObject::resetArrayBufferList(c);
}
}
} }
~MinorCollectionTracer() { ~MinorCollectionTracer() {
runtime->setNeedsBarrier(savedRuntimeNeedBarrier); runtime->setNeedsBarrier(savedRuntimeNeedBarrier);
if (runtime->gcIncrementalState != NO_INCREMENTAL)
ArrayBufferObject::restoreArrayBufferLists(liveArrayBuffers);
} }
}; };