summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/import-export-sigs.js
blob: 8765d56b156e8fed3eb85508fe05a526f6543821 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// |jit-test| skip-if: fuzzingSafe()

// Tests that function imports and function exports descriptors have
// signatures, in the test mode only, for fuzzers.

var module = new WebAssembly.Module(wasmTextToBinary(`(module
  (import "env" "v_v" (func $vv))
  (export "v_v" (func $vv))

  (import "env" "v_i" (func $vi (param i32)))
  (export "v_i" (func $vi))

  (import "env" "v_I" (func $vI (param i64)))
  (export "v_I" (func $vI))

  (import "env" "v_f" (func $vf (param f32)))
  (export "v_f" (func $vf))

  (import "env" "memory" (memory $mem 0))
  (export "mem" (memory $mem))

  (import "env" "v_d" (func $vd (param f64)))
  (export "v_d" (func $vd))

  (import "env" "v_fd" (func $vfd (param f32) (param f64)))
  (export "v_fd" (func $vfd))

  (import "env" "v_Ififd" (func $vIfifd (param i64) (param f32) (param i32) (param f32) (param f64)))
  (export "v_Ififd" (func $vIfifd))

  (import "env" "i_v" (func $iv (result i32)))
  (export "i_v" (func $iv))

  (import "env" "I_i" (func $Ii (param i32) (result i64)))
  (export "I_i" (func $Ii))

  (import "env" "table" (table $table 0 funcref))
  (export "table" (table $table))

  (import "env" "f_d" (func $fd (param f64) (result f32)))
  (export "f_d" (func $fd))

  (import "env" "d_ffd" (func $dffd (param f32) (param f32) (param f64) (result f64)))
  (export "d_ffd" (func $dffd))
)`));

for (let desc of WebAssembly.Module.imports(module)) {
    assertEq(typeof desc.signature, 'undefined');
}
for (let desc of WebAssembly.Module.exports(module)) {
    assertEq(typeof desc.signature, 'undefined');
}