Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/gc/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  dedupe.js

  Sprache: JAVA
 

function str(c) {
    let s = c;
    for (let i = 0; i < 30; i++)
        s += c;
    ensureLinearString(s);
    return s;
}

function f() {
  // Create some slots to write into.
  const o = {owner: 'short1', s: 'short2'};

  // Make a tenured rope.
  const r1 = str("a") + str("b");
  gc();

  // Write the first instance of our duplicate string into one of the slots
  // (`owner`). This will be scanned first, and entered into deDupSet when
  // tenured.
  o.owner = ensureLinearString(str("a") + str("b") + str("c"));

  // Make another rope with identical contents, with a tenured subtree.
  const r2 = r1 + str("c");

  // Linearize the new rope, creating a new extensible string and a bunch of
  // dependent strings replacing the rest of the rope nodes.
  ensureLinearString(r2);

  // Write the new rope into a slot, so that it will be scanned next during the
  // minor GC during traceSlots().
  o.s = r2;

  // Do a nursery collection. o.owner will be tenured and inserted into
  // deDupSet. Then o.s aka r2 will be tenured. If things work correctly, r2
  // will be marked non-deduplicatable because it is the base of a tenured
  // string r1. If not, it will be deduplicated to o.owner.
  minorgc();

  // Extract out that r1 child node. If its base was deduplicated, this will
  // assert because its chars have been freed.
  const s1 = r1.substr(031);
}

f();

Messung V0.5 in Prozent
C=92 H=83 G=87

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.