summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/drop.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/tests/wasm/drop.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/wasm/drop.js')
-rw-r--r--js/src/jit-test/tests/wasm/drop.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/drop.js b/js/src/jit-test/tests/wasm/drop.js
new file mode 100644
index 0000000000..3a2bda66e5
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/drop.js
@@ -0,0 +1,45 @@
+for (let type of ['i32', 'f32', 'f64']) {
+ assertEq(wasmEvalText(`
+ (module
+ (func $test (param $p ${type}) (param $p2 ${type}) (result ${type})
+ local.get $p
+ local.get $p2
+ (block)
+ drop
+ )
+ (export "test" (func $test))
+ )
+ `).exports.test(0x1337abc0, 0xffffffff), 0x1337abc0);
+}
+
+assertEq(wasmEvalText(`
+ (module
+ (func $test (param $p i32) (param $p2 f32) (param $p3 f64) (param $p4 i32) (result i32)
+ local.get $p
+ local.get $p2
+ local.get $p3
+ local.get $p4
+ (block)
+ drop
+ (block)
+ (block)
+ drop
+ drop
+ )
+ (export "test" (func $test))
+ )
+`).exports.test(0x1337abc0, 0xffffffff), 0x1337abc0);
+
+wasmAssert(`
+ (module
+ (func $test (param $p i64) (param $p2 i64) (result i64)
+ local.get $p
+ local.get $p2
+ (block)
+ drop
+ )
+ (export "test" (func $test))
+ )
+`, [
+ { type: 'i64', func: '$test', args: ['(i64.const 0x1337abc0)', '(i64.const -1)'], expected: '0x1337abc0' }
+]);