Bug 914614 - Handle OOM in the barrier verifiers; r=billm

--HG--
extra : rebase_source : d3b50ff7e5ca5d7dd44b7df22d4791e07c7c9d9b
This commit is contained in:
Terrence Cole 2013-09-12 10:50:32 -07:00
parent ea1a1fd9ac
commit 75baed05ac
4 changed files with 32 additions and 1 deletions

View File

@ -232,6 +232,7 @@ class MinorCollectionTracer : public JSTracer
/* Save and restore all of the runtime state we use during MinorGC. */
bool savedRuntimeNeedBarrier;
AutoDisableProxyCheck disableStrictProxyChecking;
AutoEnterOOMUnsafeRegion oomUnsafeRegion;
/* Insert the given relocation entry into the list of things to visit. */
JS_ALWAYS_INLINE void insertIntoFixupList(RelocationOverlay *entry) {
@ -494,6 +495,8 @@ js::Nursery::moveSlotsToTenured(JSObject *dst, JSObject *src, AllocKind dstKind)
Zone *zone = src->zone();
size_t count = src->numDynamicSlots();
dst->slots = zone->pod_malloc<HeapSlot>(count);
if (!dst->slots)
MOZ_CRASH();
PodCopy(dst->slots, src->slots, count);
setSlotsForwardingPointer(src->slots, dst->slots, count);
return count * sizeof(HeapSlot);

View File

@ -456,6 +456,8 @@ gc::StartVerifyPreBarriers(JSRuntime *rt)
r.front()->bitmap.clear();
VerifyPreTracer *trc = js_new<VerifyPreTracer>();
if (!trc)
return;
rt->gcNumber++;
trc->number = rt->gcNumber;
@ -658,6 +660,9 @@ gc::StartVerifyPostBarriers(JSRuntime *rt)
MinorGC(rt, JS::gcreason::API);
VerifyPostTracer *trc = js_new<VerifyPostTracer>();
if (!trc)
return;
rt->gcVerifyPostData = trc;
rt->gcNumber++;
trc->number = rt->gcNumber;

View File

@ -0,0 +1,6 @@
// |jit-test| allow-oom
if (typeof oomAfterAllocations == 'function') {
gczeal(4);
oomAfterAllocations(1);
var s = new Set;
}

View File

@ -882,7 +882,6 @@ class GCHelperThread {
}
};
struct GCChunkHasher {
typedef gc::Chunk *Lookup;
@ -1409,6 +1408,24 @@ class AutoSuppressGC
}
};
#ifdef DEBUG
/* Disable OOM testing in sections which are not OOM safe. */
class AutoEnterOOMUnsafeRegion
{
uint32_t saved_;
public:
AutoEnterOOMUnsafeRegion() : saved_(OOM_maxAllocations) {
OOM_maxAllocations = UINT32_MAX;
}
~AutoEnterOOMUnsafeRegion() {
OOM_maxAllocations = saved_;
}
};
#else
class AutoEnterOOMUnsafeRegion {};
#endif /* DEBUG */
} /* namespace gc */
#ifdef DEBUG