Bug 1576865 - Add missing call to ReportOutOfMemory in LazyScriptCreationData. r=jwalden

The closedOverBinding set uses the SystemAllocPolicy so we must manually
raise OOM exceptions.

Differential Revision: https://phabricator.services.mozilla.com/D43650

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ted Campbell 2019-08-27 23:02:37 +00:00
parent 95a283d459
commit 9e850c74a6
3 changed files with 94 additions and 0 deletions

View File

@ -291,6 +291,7 @@ struct LazyScriptCreationData {
}
if (!closedOverBindings.appendAll(COB)) {
ReportOutOfMemory(cx); // closedOverBindings uses SystemAllocPolicy.
return false;
}
return true;

View File

@ -0,0 +1,49 @@
// |jit-test| skip-if: !('oomTest' in this)
var sourceText = `
function Outer() {
var X00, X01, X02, X03, X04, X05, X06, X07;
var X08, X09, X10, X11, X12, X13, X14, X15;
var X16, X17, X18, X19, X20, X21, X22, X23;
var X24, X25, X26, X27, X28, X29, X30, X31;
function LazyFunction() {
// Lots of closed-over bindings.
{ X00 = true; };
{ X01 = true; };
{ X02 = true; };
{ X03 = true; };
{ X04 = true; };
{ X05 = true; };
{ X06 = true; };
{ X07 = true; };
{ X08 = true; };
{ X09 = true; };
{ X10 = true; };
{ X11 = true; };
{ X12 = true; };
{ X13 = true; };
{ X14 = true; };
{ X15 = true; };
{ X16 = true; };
{ X17 = true; };
{ X18 = true; };
{ X19 = true; };
{ X20 = true; };
{ X21 = true; };
{ X22 = true; };
{ X23 = true; };
{ X24 = true; };
{ X25 = true; };
{ X26 = true; };
{ X27 = true; };
{ X28 = true; };
{ X29 = true; };
{ X30 = true; };
{ X31 = true; };
}
}
`;
oomTest(function() {
evaluate(sourceText);
});

View File

@ -0,0 +1,44 @@
// |jit-test| skip-if: !('oomTest' in this)
var sourceText = `
function Outer() {
function LazyFunction() {
// Lots of inner functions.
function F00() { }
function F01() { }
function F02() { }
function F03() { }
function F04() { }
function F05() { }
function F06() { }
function F07() { }
function F08() { }
function F09() { }
function F10() { }
function F11() { }
function F12() { }
function F13() { }
function F14() { }
function F15() { }
function F16() { }
function F17() { }
function F18() { }
function F19() { }
function F20() { }
function F21() { }
function F22() { }
function F23() { }
function F24() { }
function F25() { }
function F26() { }
function F27() { }
function F28() { }
function F29() { }
function F30() { }
function F31() { }
}
}
`;
oomTest(function() {
evaluate(sourceText);
});