Bug 1576865 - Add missing call to ReportOutOfMemory in LazyScriptCreationData. r=jwalden
authorTed Campbell <tcampbell@mozilla.com>
Tue, 27 Aug 2019 23:02:37 +0000
changeset 554065 afe2efc57104cd6e1f0188523b9c96390b760c1c
parent 554064 f0237adbd823a9a85ddeabf9eb0e66186d8fd0db
child 554066 d0133dad2708a3291861e9a0dfc75713ff21312a
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1576865
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
js/src/frontend/SharedContext.h
js/src/jit-test/tests/parser/bug-1576865-1.js
js/src/jit-test/tests/parser/bug-1576865-2.js
--- a/js/src/frontend/SharedContext.h
+++ b/js/src/frontend/SharedContext.h
@@ -286,16 +286,17 @@ struct LazyScriptCreationData {
             FunctionBoxVector& innerBoxes, bool isStrict) {
     strict = isStrict;
     // Copy out of the stack allocated vectors.
     if (!innerFunctionBoxes.appendAll(innerBoxes)) {
       return false;
     }
 
     if (!closedOverBindings.appendAll(COB)) {
+      ReportOutOfMemory(cx);  // closedOverBindings uses SystemAllocPolicy.
       return false;
     }
     return true;
   }
 };
 
 class FunctionBox : public ObjectBox, public SharedContext {
   // The parser handles tracing the fields below via the TraceListNode linked
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/parser/bug-1576865-1.js
@@ -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);
+  });
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/parser/bug-1576865-2.js
@@ -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);
+  });