mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-01 05:43:46 +00:00
Bug 942547 - Report all unhandlable OOMs for the fuzzers; r=jonco
--HG-- extra : rebase_source : 9112da0c7b3eee56cbe3370c482ed7b3d17c823c
This commit is contained in:
parent
b585c8be7a
commit
c62eb43ce0
@ -117,6 +117,9 @@ EndVerifyPostBarriers(JSRuntime *rt);
|
||||
void
|
||||
FinishVerifier(JSRuntime *rt);
|
||||
|
||||
void
|
||||
CrashAtUnhandlableOOM(const char *reason);
|
||||
|
||||
class AutoStopVerifyingBarriers
|
||||
{
|
||||
JSRuntime *runtime;
|
||||
|
@ -460,7 +460,7 @@ js::Nursery::moveToTenured(MinorCollectionTracer *trc, JSObject *src)
|
||||
AllocKind dstKind = GetObjectAllocKindForCopy(trc->runtime, src);
|
||||
JSObject *dst = static_cast<JSObject *>(allocateFromTenured(zone, dstKind));
|
||||
if (!dst)
|
||||
MOZ_CRASH();
|
||||
CrashAtUnhandlableOOM("Failed to allocate object while tenuring.");
|
||||
|
||||
trc->tenuredSize += moveObjectToTenured(dst, src, dstKind);
|
||||
|
||||
@ -512,7 +512,7 @@ js::Nursery::moveSlotsToTenured(JSObject *dst, JSObject *src, AllocKind dstKind)
|
||||
size_t count = src->numDynamicSlots();
|
||||
dst->slots = zone->pod_malloc<HeapSlot>(count);
|
||||
if (!dst->slots)
|
||||
MOZ_CRASH();
|
||||
CrashAtUnhandlableOOM("Failed to allocate slots while tenuring.");
|
||||
PodCopy(dst->slots, src->slots, count);
|
||||
setSlotsForwardingPointer(src->slots, dst->slots, count);
|
||||
return count * sizeof(HeapSlot);
|
||||
@ -541,7 +541,7 @@ js::Nursery::moveElementsToTenured(JSObject *dst, JSObject *src, AllocKind dstKi
|
||||
if (src->hasDynamicElements()) {
|
||||
dstHeader = static_cast<ObjectElements *>(zone->malloc_(nbytes));
|
||||
if (!dstHeader)
|
||||
MOZ_CRASH();
|
||||
CrashAtUnhandlableOOM("Failed to allocate array buffer elements while tenuring.");
|
||||
} else {
|
||||
dst->setFixedElements();
|
||||
dstHeader = dst->getElementsHeader();
|
||||
@ -567,7 +567,7 @@ js::Nursery::moveElementsToTenured(JSObject *dst, JSObject *src, AllocKind dstKi
|
||||
size_t nbytes = nslots * sizeof(HeapValue);
|
||||
dstHeader = static_cast<ObjectElements *>(zone->malloc_(nbytes));
|
||||
if (!dstHeader)
|
||||
MOZ_CRASH();
|
||||
CrashAtUnhandlableOOM("Failed to allocate elements while tenuring.");
|
||||
js_memcpy(dstHeader, srcHeader, nslots * sizeof(HeapSlot));
|
||||
setElementsForwardingPointer(srcHeader, dstHeader, nslots);
|
||||
dst->elements = dstHeader->elements();
|
||||
|
@ -143,14 +143,14 @@ StoreBuffer::RelocatableMonoTypeBuffer<T>::compactMoved(StoreBuffer *owner)
|
||||
LifoAlloc &storage = *this->storage_;
|
||||
EdgeSet invalidated;
|
||||
if (!invalidated.init())
|
||||
MOZ_CRASH("RelocatableMonoTypeBuffer::compactMoved: Failed to init table.");
|
||||
CrashAtUnhandlableOOM("RelocatableMonoTypeBuffer::compactMoved: Failed to init table.");
|
||||
|
||||
/* Collect the set of entries which are currently invalid. */
|
||||
for (LifoAlloc::Enum e(storage); !e.empty(); e.popFront<T>()) {
|
||||
T *edge = e.get<T>();
|
||||
if (edge->isTagged()) {
|
||||
if (!invalidated.put(edge->location()))
|
||||
MOZ_CRASH("RelocatableMonoTypeBuffer::compactMoved: Failed to put removal.");
|
||||
CrashAtUnhandlableOOM("RelocatableMonoTypeBuffer::compactMoved: Failed to put removal.");
|
||||
} else {
|
||||
invalidated.remove(edge->location());
|
||||
}
|
||||
|
@ -25,6 +25,9 @@
|
||||
namespace js {
|
||||
namespace gc {
|
||||
|
||||
extern void
|
||||
CrashAtUnhandlableOOM(const char *);
|
||||
|
||||
/*
|
||||
* BufferableRef represents an abstract reference for use in the generational
|
||||
* GC's remembered set. Entries in the store buffer that cannot be represented
|
||||
@ -128,7 +131,7 @@ class StoreBuffer
|
||||
|
||||
T *tp = storage_->new_<T>(t);
|
||||
if (!tp)
|
||||
MOZ_CRASH();
|
||||
CrashAtUnhandlableOOM("Failed to allocate for MonoTypeBuffer::put.");
|
||||
|
||||
if (isAboutToOverflow()) {
|
||||
compact(owner);
|
||||
@ -202,12 +205,12 @@ class StoreBuffer
|
||||
unsigned size = sizeof(T);
|
||||
unsigned *sizep = storage_->newPod<unsigned>();
|
||||
if (!sizep)
|
||||
MOZ_CRASH();
|
||||
CrashAtUnhandlableOOM("Failed to allocate for GenericBuffer::put.");
|
||||
*sizep = size;
|
||||
|
||||
T *tp = storage_->new_<T>(t);
|
||||
if (!tp)
|
||||
MOZ_CRASH();
|
||||
CrashAtUnhandlableOOM("Failed to allocate for GenericBuffer::put.");
|
||||
|
||||
if (isAboutToOverflow())
|
||||
owner->setAboutToOverflow();
|
||||
|
@ -869,4 +869,13 @@ js::gc::FinishVerifier(JSRuntime *rt)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
js::gc::CrashAtUnhandlableOOM(const char *reason)
|
||||
{
|
||||
char msgbuf[1024];
|
||||
JS_snprintf(msgbuf, sizeof(msgbuf), "[unhandlable oom] %s", reason);
|
||||
MOZ_ReportAssertionFailure(msgbuf, __FILE__, __LINE__);
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
#endif /* JS_GC_ZEAL */
|
||||
|
Loading…
Reference in New Issue
Block a user