Bug 1212430 - Remove CrashAtUnhandlableOOM() and replace with AutoEnterOOMUnsafeRegion r=jandem

This commit is contained in:
Jon Coppeard 2015-10-08 10:49:49 +01:00
parent 0ae0f8e41a
commit 93caf76aac
5 changed files with 9 additions and 12 deletions

View File

@ -181,15 +181,10 @@ static inline bool ShouldFailWithOOM() { return false; }
namespace js {
MOZ_NORETURN MOZ_COLD void
CrashAtUnhandlableOOM(const char* reason);
/* Disable OOM testing in sections which are not OOM safe. */
struct MOZ_RAII AutoEnterOOMUnsafeRegion
{
void crash(const char* reason) {
CrashAtUnhandlableOOM(reason);
}
MOZ_NORETURN MOZ_COLD void crash(const char* reason);
#if defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
AutoEnterOOMUnsafeRegion()

View File

@ -952,7 +952,7 @@ Statistics::beginSlice(const ZoneGCStats& zoneStats, JSGCInvocationKind gckind,
SliceData data(budget, reason, PRMJ_Now(), JS_GetCurrentEmbedderTime(), GetPageFaultCount());
if (!slices.append(data)) {
// OOM testing fails if we CrashAtUnhandlableOOM here.
// OOM testing fails if we crash here, so set a flag instead.
aborted = true;
return;
}

View File

@ -2031,7 +2031,7 @@ SnapshotIterator::maybeRead(const RValueAllocation& a, MaybeReadFallback& fallba
if (fallback.canRecoverResults()) {
if (!initInstructionResults(fallback))
js::CrashAtUnhandlableOOM("Unable to recover allocations.");
MOZ_CRASH("Unable to recover allocations.");
if (allocationReadable(a))
return allocationValue(a);

View File

@ -993,7 +993,7 @@ class BOffImm
{
MOZ_ASSERT((offset & 0x3) == 0);
if (!IsInRange(offset))
CrashAtUnhandlableOOM("BOffImm");
MOZ_CRASH("BOffImm offset out of range");
}
explicit BOffImm()

View File

@ -1199,13 +1199,15 @@ JS::AutoCheckRequestDepth::~AutoCheckRequestDepth()
#endif
#ifdef JS_CRASH_DIAGNOSTICS
void CompartmentChecker::check(InterpreterFrame* fp)
void
CompartmentChecker::check(InterpreterFrame* fp)
{
if (fp)
check(fp->scopeChain());
}
void CompartmentChecker::check(AbstractFramePtr frame)
void
CompartmentChecker::check(AbstractFramePtr frame)
{
if (frame)
check(frame.scopeChain());
@ -1213,7 +1215,7 @@ void CompartmentChecker::check(AbstractFramePtr frame)
#endif
void
js::CrashAtUnhandlableOOM(const char* reason)
AutoEnterOOMUnsafeRegion::crash(const char* reason)
{
char msgbuf[1024];
JS_snprintf(msgbuf, sizeof(msgbuf), "[unhandlable oom] %s", reason);