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

Quelle  gc.js   Sprache: JAVA

 
// Test if we can trace roots on the alternative stack.

let i = 0;
function js_import() {
  return Promise.resolve({i: ++i});
};
let wasm_js_import = new WebAssembly.Suspending(js_import);

let wasm_gc_import = new WebAssembly.Suspending(
    async () => { gc(); }
);

var ins = wasmEvalText(`(module
  (import "m" "import" (func (result externref)))
  (import "m" "gc" (func))
  (import "m" "conv" (func (param externref) (result i32)))

    (global (export "g") (mut i32) (i32.const 0))

    (func (export "test")
      (local i32)
      i32.const 5
      local.set 0
      loop
        call 0
        call 1
        call 2
        global.get 0
        i32.add
        global.set 0
        local.get 0
        i32.const 1
        i32.sub
        local.tee 0
        br_if 0
      end
    )

)`, {
  m: {
    import: wasm_js_import,
    gc: wasm_gc_import,
    conv: ({i}) => i,
  },
});


let wrapped_export = WebAssembly.promising(ins.exports.test);

let export_promise = wrapped_export();
assertEq(0, ins.exports.g.value);
assertEq(true, export_promise instanceof Promise);
export_promise.then(() =>
  assertEq(15, ins.exports.g.value)
);

Messung V0.5
C=96 H=98 G=96

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.