summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/unreachable.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/wasm/unreachable.js')
-rw-r--r--js/src/jit-test/tests/wasm/unreachable.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/unreachable.js b/js/src/jit-test/tests/wasm/unreachable.js
new file mode 100644
index 000000000..0bfd90d7e
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/unreachable.js
@@ -0,0 +1,30 @@
+load(libdir + "wasm.js");
+
+// In unreachable code, the current design is that validation is disabled,
+// meaning we have to have a special mode in the decoder for decoding code
+// that won't actually run.
+
+wasmFullPass(`(module
+ (func (result i32)
+ (return (i32.const 42))
+ (i32.add (f64.const 1.0) (f32.const 0.0))
+ (return (f64.const 2.0))
+ (if (f32.const 3.0) (i64.const 2) (i32.const 1))
+ (select (f64.const -5.0) (f32.const 2.3) (f64.const 8.9))
+ )
+ (export "run" 0)
+)`, 42);
+
+wasmFullPass(`(module
+ (func (result i32) (param i32)
+ (block
+ (br_if 1 (i32.const 41) (get_local 0))
+ (br 1 (i32.const 42))
+ )
+ (i32.add (f32.const 0.0) (f64.const 1.0))
+ (return (f64.const 2.0))
+ (if (f32.const 3.0) (i64.const 2) (i32.const 1))
+ (select (f64.const -5.0) (f32.const 2.3) (f64.const 8.9))
+ )
+ (export "run" 0)
+)`, 42, {}, 0);