diff --git a/js/src/asmjs/AsmJS.cpp b/js/src/asmjs/AsmJS.cpp index f81894041258..652d0859c950 100644 --- a/js/src/asmjs/AsmJS.cpp +++ b/js/src/asmjs/AsmJS.cpp @@ -2630,16 +2630,6 @@ class MOZ_STACK_CLASS FunctionValidator 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_; } @@ -2656,6 +2646,11 @@ class MOZ_STACK_CLASS FunctionValidator } 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_); } diff --git a/js/src/jit-test/tests/asm.js/testBug1255954.js b/js/src/jit-test/tests/asm.js/testBug1255954.js new file mode 100644 index 000000000000..7379a9b8aefe --- /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")); +});