Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/xpconnect/tests/unit/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 3 kB image not shown  

Quelle  test_wasm_jspi_profiler.js

  Sprache: JAVA
 

Services.prefs.setBoolPref("javascript.options.wasm_js_promise_integration"true);
registerCleanupFunction(() => {
  Services.prefs.clearUserPref("javascript.options.wasm_js_promise_integration");
});

// The tests runs code in tight loop with the profiler enabled. It is testing
// behavior of JS PI specific methods and generated code.
// It is not guarantee 100% hit since the profiler probes stacks every 1ms,
// but it will happen often enough.
add_task(async () => {
  if (!WebAssembly.promising) {
    return;
  }

  await Services.profiler.StartProfiler(101, ["js"], ["GeckoMain"]);
  Assert.ok(Services.profiler.IsActive());

/* Wasm module that is tested:
(module
  (import "js" "compute_delta"
    (func $compute_delta (param i32) (result f64)))

  (func (export "update_state_export") (param i32) (result f64)
     (call $compute_delta (local.get 0))
  )
)
*/


  var compute_delta = (i) => i / 100;
  const b = new Uint8Array([
    0971151091000161961127112422012106,
    11513991111091121171161019510010110811697,
    0032107231191171121009711610195115116,
    97116101951011201121111141160110816032,
    016011023411097109101116101399111109,
    1121171161019510010110811697
  ]);
  const ins = new WebAssembly.Instance(new WebAssembly.Module(b), {
    js: { compute_delta, },
  });
  var update_state = WebAssembly.promising(
    ins.exports.update_state_export
  );

  for (var i = 0; i < 1000; i++) {
    var r = await update_state(4);
    if (i % 222 == 0) {
      Assert.equal(r, .04);
    }
  }

  Assert.ok(true"Done");
  await Services.profiler.StopProfiler();
});

add_task(async () => {
  if (!WebAssembly.promising) {
    return;
  }

  await Services.profiler.StartProfiler(101, ["js"], ["GeckoMain"]);
  Assert.ok(Services.profiler.IsActive());

/* Wasm module that is tested:
(module
  (import "js" "compute_delta"
    (func $compute_delta (param i32) (result f64)))

  (func (export "update_state_export") (param i32) (result f64)
    (call $compute_delta (local.get 0))
  )
)
*/


  var compute_delta = async (i) => i / 100;
  var suspending_compute_delta = new WebAssembly.Suspending(
    compute_delta
  );
  const b = new Uint8Array([
    0971151091000161961127112422012106,
    115139911110911211711610195100101108116970,
    03210723119117112100971161019511511697,
    1161019510112011211111411601108160320,
    16011023411097109101116101399111109112,
    1171161019510010110811697
  ]);
  const ins = new WebAssembly.Instance(new WebAssembly.Module(b), {
    js: { compute_delta: suspending_compute_delta, },
  });
  var update_state = WebAssembly.promising(
    ins.exports.update_state_export
  );

  for (var i = 0; i < 1000; i++) {
    var r = await update_state(4);
    if (i % 222 == 0) {
      Assert.equal(r, .04);
    }
  }

  Assert.ok(true"Done");
  await Services.profiler.StopProfiler();
});

/**
 * All the tests are implemented with add_task, this starts them automatically.
 */

function run_test() {
  do_get_profile();
  run_next_test();
}

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

¤ Dauer der Verarbeitung: 0.12 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.