Bug 1255954 - Odin: move asserts so they only run on successful validation (r=bbouvier)
authorLuke Wagner <luke@mozilla.com>
Mon, 14 Mar 2016 10:19:30 -0500
changeset 288548 8d78cce3934e3112a94d78f10ea87e20dd2830c7
parent 288547 f788142ec96fce20c157d4d270794403074422aa
child 288549 77d65c5c24227ef7524552b8559f289b19fdca65
push id73450
push userlwagner@mozilla.com
push dateMon, 14 Mar 2016 15:24:49 +0000
treeherdermozilla-inbound@8d78cce3934e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1255954
milestone48.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 1255954 - Odin: move asserts so they only run on successful validation (r=bbouvier) MozReview-Commit-ID: 9moOBWvSs7b
js/src/asmjs/AsmJS.cpp
js/src/jit-test/tests/asm.js/testBug1255954.js
--- a/js/src/asmjs/AsmJS.cpp
+++ b/js/src/asmjs/AsmJS.cpp
@@ -2625,42 +2625,37 @@ class MOZ_STACK_CLASS FunctionValidator
         fn_(fn),
         locals_(m.cx()),
         breakLabels_(m.cx()),
         continueLabels_(m.cx()),
         blockDepth_(0),
         hasAlreadyReturned_(false)
     {}
 
-    ~FunctionValidator() {
-        if (m_.hasAlreadyFailed())
-            return;
-        MOZ_ASSERT(!blockDepth_);
-        MOZ_ASSERT(breakableStack_.empty());
-        MOZ_ASSERT(continuableStack_.empty());
-        MOZ_ASSERT(breakLabels_.empty());
-        MOZ_ASSERT(continueLabels_.empty());
-    }
-
     ModuleValidator& m() const        { return m_; }
     ExclusiveContext* cx() const      { return m_.cx(); }
     ParseNode* fn() const             { return fn_; }
 
     bool init(PropertyName* name, unsigned line) {
         if (!locals_.init() || !breakLabels_.init() || !continueLabels_.init())
             return false;
 
         if (!m_.mg().startFuncDef(line, &fg_))
             return false;
 
         encoder_.emplace(fg_.bytes());
         return true;
     }
 
     bool finish(uint32_t funcIndex, unsigned generateTime) {
+        MOZ_ASSERT(!blockDepth_);
+        MOZ_ASSERT(breakableStack_.empty());
+        MOZ_ASSERT(continuableStack_.empty());
+        MOZ_ASSERT(breakLabels_.empty());
+        MOZ_ASSERT(continueLabels_.empty());
         return m_.mg().finishFuncDef(funcIndex, generateTime, &fg_);
     }
 
     bool fail(ParseNode* pn, const char* str) {
         return m_.fail(pn, str);
     }
 
     bool failf(ParseNode* pn, const char* fmt, ...) {
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/asm.js/testBug1255954.js
@@ -0,0 +1,10 @@
+const USE_ASM = '"use asm";';
+function asmCompile() {
+    var f = Function.apply(null, arguments);
+}
+oomTest(() => {
+    try {
+        function f(b) {}
+    } catch (exc0) {}
+    f(asmCompile(USE_ASM + "function f() { var i=42; return i|0; for(;1;) {} return 0 } return f"));
+});