1344334 - Make DoTypeUpdateFallback infallible.

master
Fedor 2019-09-05 20:07:18 +03:00
parent 32bc386753
commit 08f2c13914
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,