diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 108fe4f6349a..1b2678954acc 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -471,6 +471,9 @@ FunctionBox::FunctionBox(ExclusiveContext *cx, ObjectBox* traceListHead, JSFunct usesApply(false), funCxFlags() { + // Functions created at parse time may be set singleton after parsing and + // baked into JIT code, so they must be allocated tenured. They are held by + // the JSScript so cannot be collected during a minor GC anyway. JS_ASSERT(fun->isTenured()); if (!outerpc) { diff --git a/js/src/ion/AsmJS.cpp b/js/src/ion/AsmJS.cpp index 536218aa1ddc..e0b7bec06ec8 100644 --- a/js/src/ion/AsmJS.cpp +++ b/js/src/ion/AsmJS.cpp @@ -4664,9 +4664,10 @@ ParseFunction(ModuleCompiler &m, ParseNode **fnOut) if (!fn) return false; + // This flows into FunctionBox, so must be tenured. RootedFunction fun(m.cx(), NewFunction(m.cx(), NullPtr(), NULL, 0, JSFunction::INTERPRETED, m.cx()->global(), name, JSFunction::FinalizeKind, - GenericObject)); + TenuredObject)); if (!fun) return false;