mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 06:35:42 +00:00
Bug 914614 - Handle OOM in the barrier verifiers; r=billm
--HG-- extra : rebase_source : d3b50ff7e5ca5d7dd44b7df22d4791e07c7c9d9b
This commit is contained in:
parent
ea1a1fd9ac
commit
75baed05ac
@ -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);
|
||||
|
@ -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;
|
||||
|
6
js/src/jit-test/tests/gc/bug-914614.js
Normal file
6
js/src/jit-test/tests/gc/bug-914614.js
Normal file
@ -0,0 +1,6 @@
|
||||
// |jit-test| allow-oom
|
||||
if (typeof oomAfterAllocations == 'function') {
|
||||
gczeal(4);
|
||||
oomAfterAllocations(1);
|
||||
var s = new Set;
|
||||
}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user