diff --git a/js/src/jit/AsmJS.cpp b/js/src/jit/AsmJS.cpp index 2a17102b3bdd..41ce90d5d6fa 100644 --- a/js/src/jit/AsmJS.cpp +++ b/js/src/jit/AsmJS.cpp @@ -1276,6 +1276,8 @@ class MOZ_STACK_CLASS ModuleCompiler } bool failName(ParseNode *pn, const char *fmt, PropertyName *name) { + // This function is invoked without the caller properly rooting its locals. + gc::AutoSuppressGC suppress(name->runtimeFromMainThread()); JSAutoByteString bytes; if (AtomToPrintableString(cx_, name, &bytes)) failf(pn, fmt, bytes.ptr()); diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 26dd00fe2a7b..1cd354ca73e1 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -5140,6 +5140,12 @@ AutoMaybeTouchDeadZones::~AutoMaybeTouchDeadZones() runtime->gcManipulatingDeadZones = manipulatingDeadZones; } +AutoSuppressGC::AutoSuppressGC(JSRuntime *rt) + : suppressGC_(rt->mainThread.suppressGC) +{ + suppressGC_++; +} + AutoSuppressGC::AutoSuppressGC(JSContext *cx) : suppressGC_(cx->runtime()->mainThread.suppressGC) { diff --git a/js/src/jsgc.h b/js/src/jsgc.h index 220d7bc92ceb..0c66cd98b18f 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -1400,6 +1400,7 @@ class AutoSuppressGC int32_t &suppressGC_; public: + AutoSuppressGC(JSRuntime *rt); AutoSuppressGC(JSContext *cx); AutoSuppressGC(JSCompartment *comp);