Bug 1323868: Report object allocation failure when running off-main-thread

Issue #77
[Depends on] Bug 1192038: RegExp.prototype should be an ordinary object
This commit is contained in:
janekptacijarabaci 2018-03-19 10:25:44 +01:00 committed by Roy Tam
commit 49ce6a7928
2 changed files with 11 additions and 2 deletions

View file

@ -39,8 +39,12 @@ js::Allocate(ExclusiveContext* cx, AllocKind kind, size_t nDynamicSlots, Initial
MOZ_ASSERT_IF(nDynamicSlots != 0, clasp->isNative() || clasp->isProxy());
// Off-main-thread alloc cannot trigger GC or make runtime assertions.
if (!cx->isJSContext())
return GCRuntime::tryNewTenuredObject<NoGC>(cx, kind, thingSize, nDynamicSlots);
if (!cx->isJSContext()) {
JSObject* obj = GCRuntime::tryNewTenuredObject<NoGC>(cx, kind, thingSize, nDynamicSlots);
if (MOZ_UNLIKELY(allowGC && !obj))
ReportOutOfMemory(cx);
return obj;
}
JSContext* ncx = cx->asJSContext();
JSRuntime* rt = ncx->runtime();

View file

@ -0,0 +1,5 @@
if (helperThreadCount() == 0)
quit();
startgc(8301);
offThreadCompileScript("(({a,b,c}))");
gcparam("maxBytes", gcparam("gcBytes"));