diff --git a/js/src/gc/GC.h b/js/src/gc/GC.h index 20501e1f13fb..3f800b10e5d4 100644 --- a/js/src/gc/GC.h +++ b/js/src/gc/GC.h @@ -111,7 +111,8 @@ IterateHeapUnbarrieredForZone(JSContext* cx, JS::Zone* zone, void* data, extern void IterateChunks(JSContext* cx, void* data, IterateChunkCallback chunkCallback); -typedef void (*IterateScriptCallback)(JSRuntime* rt, void* data, JSScript* script); +typedef void (*IterateScriptCallback)(JSRuntime* rt, void* data, JSScript* script, + const JS::AutoRequireNoGC& nogc); /* * Invoke scriptCallback on every in-use script for diff --git a/js/src/gc/PublicIterators.cpp b/js/src/gc/PublicIterators.cpp index d44ef53357f5..554aebb7bfe7 100644 --- a/js/src/gc/PublicIterators.cpp +++ b/js/src/gc/PublicIterators.cpp @@ -86,17 +86,18 @@ js::IterateScripts(JSContext* cx, JSCompartment* compartment, MOZ_ASSERT(!cx->suppressGC); AutoEmptyNursery empty(cx); AutoPrepareForTracing prep(cx); + JS::AutoSuppressGCAnalysis nogc; if (compartment) { Zone* zone = compartment->zone(); for (auto script = zone->cellIter(empty); !script.done(); script.next()) { if (script->compartment() == compartment) - scriptCallback(cx->runtime(), data, script); + scriptCallback(cx->runtime(), data, script, nogc); } } else { for (ZonesIter zone(cx->runtime(), SkipAtoms); !zone.done(); zone.next()) { for (auto script = zone->cellIter(empty); !script.done(); script.next()) - scriptCallback(cx->runtime(), data, script); + scriptCallback(cx->runtime(), data, script, nogc); } } } diff --git a/js/src/jsapi-tests/testPreserveJitCode.cpp b/js/src/jsapi-tests/testPreserveJitCode.cpp index d6ade165491b..49b2a3843bb1 100644 --- a/js/src/jsapi-tests/testPreserveJitCode.cpp +++ b/js/src/jsapi-tests/testPreserveJitCode.cpp @@ -10,7 +10,7 @@ using namespace JS; static void -ScriptCallback(JSRuntime* rt, void* data, JSScript* script) +ScriptCallback(JSRuntime* rt, void* data, JSScript* script, const JS::AutoRequireNoGC& nogc) { unsigned& count = *static_cast(data); if (script->hasIonScript()) diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 13c40f55a2ef..815f247901e2 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -4589,9 +4589,10 @@ class MOZ_STACK_CLASS Debugger::ScriptQuery return true; } - static void considerScript(JSRuntime* rt, void* data, JSScript* script) { + static void considerScript(JSRuntime* rt, void* data, JSScript* script, + const JS::AutoRequireNoGC& nogc) { ScriptQuery* self = static_cast(data); - self->consider(script); + self->consider(script, nogc); } /* @@ -4599,7 +4600,7 @@ class MOZ_STACK_CLASS Debugger::ScriptQuery * |innermostForCompartment|, as appropriate. Set |oom| if an out of memory * condition occurred. */ - void consider(JSScript* script) { + void consider(JSScript* script, const JS::AutoRequireNoGC& nogc) { // We check for presence of script->code() because it is possible that // the script was created and thus exposed to GC, but *not* fully // initialized from fullyInit{FromEmitter,Trivial} due to errors.