1344334 - Make DoTypeUpdateFallback infallible.

This commit is contained in:
Gaming4JC 2019-07-14 21:41:35 -04:00 committed by Roy Tam
commit 61235c7be1
2 changed files with 22 additions and 1 deletions

View file

@ -0,0 +1,14 @@
if (!('oomTest' in this))
quit();
function f(s) {
s + "x";
s.indexOf("y") === 0;
oomTest(new Function(s));
}
var s = `
class TestClass { constructor() {} }
for (var fun of hasPrototype) {}
`;
if (s.length)
f(s);

View file

@ -323,7 +323,14 @@ DoTypeUpdateFallback(JSContext* cx, BaselineFrame* frame, ICUpdatedStub* stub, H
MOZ_CRASH("Invalid stub");
}
return stub->addUpdateStubForValue(cx, script /* = outerScript */, obj, id, value);
if (!stub->addUpdateStubForValue(cx, script /* = outerScript */, obj, id, value)) {
// The calling JIT code assumes this function is infallible (for
// instance we may reallocate dynamic slots before calling this),
// so ignore OOMs if we failed to attach a stub.
cx->recoverFromOutOfMemory();
}
return true;
}
typedef bool (*DoTypeUpdateFallbackFn)(JSContext*, BaselineFrame*, ICUpdatedStub*, HandleValue,