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

Quelle  nursery-chars.js

  Sprache: JAVA
 

function TTN() {
    let minors = this.currentgc ? currentgc()?.minorCount : undefined;
    let NB3 = newString("bleaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaggh!!!!! no no no no no no no no no no no no no no no no no", { tenured: false });
    if (this.stringRepresentation) {
        const NB3rep = JSON.parse(stringRepresentation(NB3));
        if (!NB3rep.charsInNursery) {
            printErr("Not testing what it is supposed to be testing");
            dumpStringRepresentation(NB3);
        }
    }
    let TD2 = newDependentString(NB3, 1, { tenured: true });
    let TD1 = newDependentString(TD2, 456, { tenured: true'suppress-contraction'true });
    const TD1rep = this.stringRepresentation ? JSON.parse(stringRepresentation(TD1)) : null;
    NB3 = null;
    let wrong_situation = minors === undefined || currentgc().minorCount > minors;
    minorgc();
    print(TD1);
    assertEq(TD1, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaggh!!!!!");
    // Even with suppress-contraction, TD1 must point directly to NB3 as its base.
    if (wrong_situation) {
        printErr("unexpected minor GC or cannot determine, skipping whitebox tests");
    } else if (TD1rep !== null) {
        assertEq(TD1rep.base.base, undefined);
        assertEq(TD1rep.base.flags.includes("DEPENDED_ON_BIT"), true);
        assertEq(TD1rep.base.flags.includes("DEPENDENT_BIT"), false);
    }
}

TTN();

function TTTN() {
    let ext = newString("leafleafleafleafleafleafleaf", { capacity: 500 });
    let first = ext; // This will end up being the beginning of a long dependent chain.

    // Create a long dependent chain.
    let rope;
    for (let i = 0; i < 10; i++) {
        rope = newRope(ext, "y", { nursery: false });
        ensureLinearString(rope); // ext is now a dependent string pointing at rope
        [ext, rope] = [rope, ext];
    }

    // Add a final terminating link to the chain (the root base), but make it
    // nursery-allocated.
    rope = newRope(ext, "z", { nursery: true });
    ensureLinearString(rope);
    [ext, rope] = [rope, ext]

    // Sadly, the root base is nursery-allocated, but its chars are not. And
    // there is no way to make them nursery-allocated, because the whole
    // chain-making process requires an extensible string, and extensible string
    // data cannot be allocated in the nursery. So this dependent chain cannot
    // be used to try to create a tenured -> tenured -> nursery chars situation.
}

TTTN();

function TTTN2() {
    let s = newString("abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz", { tenured: false });

    let dep = s;
    for (let i = 0; i < 20; i++) {
        dep = dep.match(/.(.*)/)[1];
    }

    // Regexp matches also avoid lengthening the chain, so cannot be used either.
}

TTTN2();

Messung V0.5 in Prozent
C=84 H=89 G=86

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© 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.