diff --git a/js/src/jit/AsmJS.cpp b/js/src/jit/AsmJS.cpp index 266fc85028e..0ceb7b4cef4 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 c03c06db796..eaf52494124 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -5150,6 +5150,12 @@ AutoMaybeTouchDeadZones::~AutoMaybeTouchDeadZones() runtime->gcManipulatingDeadZones = manipulatingDeadZones; } +AutoSuppressGC::AutoSuppressGC(JSRuntime *rt) + : suppressGC_(rt->mainThread.suppressGC) +{ + suppressGC_++; +} + AutoSuppressGC::AutoSuppressGC(ExclusiveContext *cx) : suppressGC_(cx->perThreadData->suppressGC) { diff --git a/js/src/jsgc.h b/js/src/jsgc.h index e38b603d12e..de9921f0c85 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(ExclusiveContext *cx); AutoSuppressGC(JSCompartment *comp);