summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/extended-const/disabled.js
blob: 01e64f6c44a96ab166525455a22f14ac4e429f0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// |jit-test| skip-if: wasmExtendedConstEnabled()

const { CompileError, validate } = WebAssembly;

const DISABLED = /extended constant expressions not enabled|unrecognized opcode/;

let tests = [
    "(module (global i32 i32.const 0 i32.const 0 i32.add))",
    "(module (global i32 i32.const 0 i32.const 0 i32.sub))",
    "(module (global i32 i32.const 0 i32.const 0 i32.mul))",
    "(module (global i64 i64.const 0 i64.const 0 i64.add))",
    "(module (global i64 i64.const 0 i64.const 0 i64.sub))",
    "(module (global i64 i64.const 0 i64.const 0 i64.mul))",
];

// Test that use of extended constants fails when disabled.

for (let src of tests) {
    let bin = wasmTextToBinary(src);
    assertEq(validate(bin), false);
    wasmCompilationShouldFail(bin, DISABLED);
}