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

Quelle  Environment-gc-02.js

  Sprache: JAVA
 

// A closure's .environment keeps the lexical environment alive even if the closure is destroyed.

var N = 4;
var g = newGlobal({newCompartment: true});
g.eval("function add(a) { return function (b) { return eval('a + b'); }; }");
var dbg = new Debugger;
var gw = dbg.addDebuggee(g);
var aw = gw.getOwnPropertyDescriptor("add").value;

// Create N closures and collect environments.
var arr = [];
for (var i = 0; i < N; i++)
    arr[i] = aw.call(null, i).return.environment;

// Test that they work now.
function check() {
    for (var i = 0; i < N; i++) {
        assertEq(arr[i].find("b"), null);
        assertEq(arr[i].find("a"), arr[i]);
    }
}
check();

// Test that they work after gc.
gc();
gc({});
g.gc(g);
check();

Messung V0.5 in Prozent
C=92 H=92 G=91

¤ Dauer der Verarbeitung: 0.19 Sekunden  (vorverarbeitet am  2026-06-04) ¤

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