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

Quelle  generator-telemetry.js

  Sprache: JAVA
 

// |jit-test| skip-if: !getJitCompilerOptions()['ion.enable']; --ion-eager

// Test the telemetry added in Bug 1944683.

// The nested loop satisfies YieldAnalyzer (js/src/jit/BytecodeAnalysis.cpp)
// which only allows Ion compilation of a yielding loop when it contains an
// inner loop or sufficient bytecode.
function* gen() {
  for (let i = 0; i < 1; i++) {
    for (let j = 0; j < 0; j++) {}
    yield i;
  }
}
async function* asyncGen() {
  for (let i = 0; i < 1; i++) {
    for (let j = 0; j < 0; j++) {}
    yield i;
  }
}

let useCounters = getUseCounterResults();
assertEq(useCounters.GeneratorFunctionCreated, 0);
assertEq(useCounters.AsyncGeneratorFunctionCreated, 0);
assertEq(useCounters.GeneratorFunctionIonEligible, 0);
assertEq(useCounters.AsyncGeneratorFunctionIonEligible, 0);

gen();
asyncGen();
useCounters = getUseCounterResults();
assertEq(useCounters.GeneratorFunctionCreated, 1);
assertEq(useCounters.AsyncGeneratorFunctionCreated, 1);

gen();
useCounters = getUseCounterResults();
assertEq(useCounters.GeneratorFunctionCreated, 2);
assertEq(useCounters.AsyncGeneratorFunctionCreated, 1);

const GeneratorFunction = function*(){}.constructor;
const AsyncGeneratorFunction = async function*(){}.constructor;
GeneratorFunction("yield 1;")();
AsyncGeneratorFunction("yield 1;")();
useCounters = getUseCounterResults();
assertEq(useCounters.GeneratorFunctionCreated, 3);
assertEq(useCounters.AsyncGeneratorFunctionCreated, 2);

for (let i = 0; i < 10; i++) {
  gen().next();
}
useCounters = getUseCounterResults();

// Use-counters deduplicate per-document in product code, so we only
// check that the counter has fired.
assertEq(useCounters.GeneratorFunctionIonEligible >= 1true);

for (let i = 0; i < 10; i++) {
  asyncGen().next();
}
useCounters = getUseCounterResults();
assertEq(useCounters.AsyncGeneratorFunctionIonEligible >= 1true);

Messung V0.5 in Prozent
C=89 H=15 G=63

¤ Dauer der Verarbeitung: 0.17 Sekunden  (vorverarbeitet am  2026-08-25) ¤

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