From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../tests/wasm/regress/bug1777604/directives.txt | 1 + .../jit-test/tests/wasm/regress/bug1777604/test.js | 35 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 js/src/jit-test/tests/wasm/regress/bug1777604/directives.txt create mode 100644 js/src/jit-test/tests/wasm/regress/bug1777604/test.js (limited to 'js/src/jit-test/tests/wasm/regress/bug1777604') diff --git a/js/src/jit-test/tests/wasm/regress/bug1777604/directives.txt b/js/src/jit-test/tests/wasm/regress/bug1777604/directives.txt new file mode 100644 index 0000000000..e627a21880 --- /dev/null +++ b/js/src/jit-test/tests/wasm/regress/bug1777604/directives.txt @@ -0,0 +1 @@ +|jit-test| --ion-offthread-compile=off; --ion-eager; include:wasm.js diff --git a/js/src/jit-test/tests/wasm/regress/bug1777604/test.js b/js/src/jit-test/tests/wasm/regress/bug1777604/test.js new file mode 100644 index 0000000000..5accdbdd14 --- /dev/null +++ b/js/src/jit-test/tests/wasm/regress/bug1777604/test.js @@ -0,0 +1,35 @@ +// |jit-test| skip-if: !wasmStreamingEnabled() + +const { Instance, compile, compileStreaming } = WebAssembly; + +for (let i = 0; i < 200; i++) { + // Possibly free code from a previous iteration, increasing probability + // new code will be allocated in a location previous code was. + gc(undefined, "shrinking"); + + function compileAndRun(x, g) { + var cache = streamCacheEntry(wasmTextToBinary(x)); + + compileStreaming(cache).then(function (m) { + g(new Instance(m, undefined)); + return compileStreaming(cache); + }).then(function (m) { + g(new Instance(m, undefined)); + }); + + // Serialize the promise execution at this point + drainJobQueue(); + } + + // Compile two different modules to increase probability that a module is + // is compiled to a page that a different module resided in previously. + compileAndRun('(module \ + (func $test (param i64) (result f64) local.get 0 f64.convert_i64_u )\ + (func (export "run") (result i32) i64.const 1 call $test f64.const 1 f64.eq )\ + )', function (i) {}); + compileAndRun('(module \ + (func (export "run") (result i64) (i64.const 1))\ + )', function (i) { + i.exports.run(); + }); +} -- cgit v1.2.3