Verified Commit 1f8edb3c authored by Jon Coppeard's avatar Jon Coppeard Committed by Pier Angelo Vendrame
Browse files

Bug 1904011 - Ignore finalized scripts when iterating code covarage tables r=iain

parent 72bb13d7
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -906,7 +906,13 @@ void Zone::clearScriptCounts(Realm* realm) {
  // Clear all hasScriptCounts_ flags of BaseScript, in order to release all
  // ScriptCounts entries of the given realm.
  for (auto i = scriptCountsMap->modIter(); !i.done(); i.next()) {
    BaseScript* script = i.get().key();
    const HeapPtr<BaseScript*>& script = i.get().key();
    if (IsAboutToBeFinalized(script)) {
      // Dead scripts may be present during incremental GC until script
      // finalizers have been run.
      continue;
    }

    if (script->realm() != realm) {
      continue;
    }
@@ -927,7 +933,13 @@ void Zone::clearScriptLCov(Realm* realm) {
  }

  for (auto i = scriptLCovMap->modIter(); !i.done(); i.next()) {
    BaseScript* script = i.get().key();
    const HeapPtr<BaseScript*>& script = i.get().key();
    if (IsAboutToBeFinalized(script)) {
      // Dead scripts may be present during incremental GC until script
      // finalizers have been run.
      continue;
    }

    if (script->realm() == realm) {
      i.remove();
    }
+15 −0
Original line number Diff line number Diff line
// |jit-test| --fuzzing-safe; --ion-offthread-compile=off
gczeal(0);

let g = newGlobal({newCompartment: true});
let dbg = new Debugger(g);

dbg.collectCoverageInfo = true;
g.eval("0");

// Start a GC in the debugger's zone and yield after sweeping objects.
schedulezone(g);
gczeal(22);
startgc(100);

dbg.collectCoverageInfo = false;