Bug 1557928 - Use the UnmarkGray tracekind for AssertNonGrayTracer r=jonco

Differential Revision: https://phabricator.services.mozilla.com/D34673

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Paul Bone 2019-06-12 16:23:08 +00:00
Родитель 3aa08f8bc8
Коммит 109fd59d37
2 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -3504,6 +3504,10 @@ struct AssertNonGrayTracer final : public JS::CallbackTracer {
void onChild(const JS::GCCellPtr& thing) override {
MOZ_ASSERT(!thing.asCell()->isMarkedGray());
}
// This is used by the UnmarkGray tracer only, and needs to report itself
// as the non-gray tracer to not trigger assertions. Do not use it in another
// context without making this more generic.
TracerKind getTracerKind() const override { return TracerKind::UnmarkGray; }
};
#endif

Просмотреть файл

@ -0,0 +1,16 @@
var g = newGlobal({ newCompartment: true });
var dbg = new Debugger;
var gw = dbg.addDebuggee(g);
lfOffThreadGlobal = g;
lfOffThreadGlobal.offThreadCompileScript(`
grayRoot()[0] = "foo";
`);
lfOffThreadGlobal.runOffThreadScript();
var g = newGlobal({newCompartment: true});
var gw = dbg.addDebuggee(g);
lfOffThreadGlobal = null;
gc();
schedulegc(this);
schedulegc('atoms');
gc('zone');