Bug 730697 - Add missing OOM checks in JS type inference code. r=bhackett

--HG--
extra : rebase_source : 00e7f02d87f51a2cc2a4955de30c6f3f6c9b21ca
This commit is contained in:
Christian Holler 2012-02-27 13:43:48 -08:00
parent b3d0051497
commit 2bdd8d6d14

View File

@ -2412,6 +2412,11 @@ ScriptAnalysis::addTypeBarrier(JSContext *cx, const jsbytecode *pc, TypeSet *tar
barrier = cx->typeLifoAlloc().new_<TypeBarrier>(target, type, (JSObject *) NULL, JSID_VOID);
if (!barrier) {
cx->compartment->types.setPendingNukeTypes(cx);
return;
}
barrier->next = code.typeBarriers;
code.typeBarriers = barrier;
}
@ -2438,6 +2443,11 @@ ScriptAnalysis::addSingletonTypeBarrier(JSContext *cx, const jsbytecode *pc, Typ
TypeBarrier *barrier = cx->typeLifoAlloc().new_<TypeBarrier>(target, Type::UndefinedType(),
singleton, singletonId);
if (!barrier) {
cx->compartment->types.setPendingNukeTypes(cx);
return;
}
barrier->next = code.typeBarriers;
code.typeBarriers = barrier;
}