diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /js/src/jit-test/tests/wasm/gc/bug-1879096.js | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/wasm/gc/bug-1879096.js')
-rw-r--r-- | js/src/jit-test/tests/wasm/gc/bug-1879096.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/gc/bug-1879096.js b/js/src/jit-test/tests/wasm/gc/bug-1879096.js new file mode 100644 index 0000000000..e71d2bac27 --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/bug-1879096.js @@ -0,0 +1,65 @@ +// |jit-test| test-also=--setpref=wasm_test_serialization; skip-if: !wasmGcEnabled() + +// Conditional branch instructions need to rewrite their stack types according +// to the destination label types. This loses information but is mandated by +// the spec. + +// br_if +wasmFailValidateText(`(module + (func (result anyref) + ref.null array ;; stack: [arrayref] + ref.null struct ;; stack: [arrayref structref] + i32.const 0 ;; stack: [arrayref structref i32] + br_if 0 ;; stack: [arrayref anyref] + ref.eq ;; should fail (anyref is not eq) + unreachable + ) +)`, /type mismatch: expression has type anyref but expected eqref/); + +// br_on_null +wasmFailValidateText(`(module + (func (param externref) (result anyref) + ref.null array ;; stack: [arrayref] + local.get 0 ;; stack: [arrayref externref] + br_on_null 0 ;; stack: [anyref (ref extern)] + drop ;; stack: [anyref] + array.len ;; should fail + unreachable + ) +)`, /type mismatch: expression has type anyref but expected arrayref/); + +// br_on_non_null +wasmFailValidateText(`(module + (func (param externref) (result anyref (ref extern)) + ref.null array ;; stack: [arrayref] + ref.null struct ;; stack: [arrayref structref] + local.get 0 ;; stack: [arrayref structref externref] + br_on_non_null 0 ;; stack: [arrayref anyref] + ref.eq ;; should fail (anyref is not eq) + unreachable + ) +)`, /type mismatch: expression has type anyref but expected eqref/); + +// br_on_cast +wasmFailValidateText(`(module + (type $s (struct)) + (func (result anyref (ref $s)) + ref.null array ;; stack: [arrayref] + ref.null struct ;; stack: [arrayref structref] + br_on_cast 0 structref (ref $s) ;; stack: [anyref structref] + ref.eq ;; should fail (anyref is not eq) + unreachable + ) +)`, /type mismatch: expression has type anyref but expected eqref/); + +// br_on_cast_fail +wasmFailValidateText(`(module + (type $s (struct)) + (func (result anyref anyref) + ref.null array ;; stack: [arrayref] + ref.null struct ;; stack: [arrayref structref] + br_on_cast_fail 0 structref (ref $s) ;; stack: [anyref (ref $s)] + ref.eq ;; should fail (anyref is not eq) + unreachable + ) +)`, /type mismatch: expression has type anyref but expected eqref/); |