summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/gc/limits/subtyping-depth.js
blob: 2d70215ee9c07df602c7d47030e7ac433a1a6ab5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// |jit-test| --setpref=wasm_gc; include:wasm.js; include: wasm-binary.js;

// Limit of subtyping hierarchy 63 deep
function moduleSubtypingDepth(depth) {
  let types = [];
  types.push({final: false, kind: FuncCode, args: [], ret: []});
  for (let i = 1; i <= depth; i++) {
    types.push({final: false, sub: i - 1, kind: FuncCode, args: [], ret: []});
  }
  return moduleWithSections([typeSection(types)]);
}
wasmValidateBinary(moduleSubtypingDepth(63));
wasmFailValidateBinary(moduleSubtypingDepth(64), /too deep/);