diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /js/src/jit-test/lib/gen/wasm-gc-limits-gen.js | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/lib/gen/wasm-gc-limits-gen.js')
-rw-r--r-- | js/src/jit-test/lib/gen/wasm-gc-limits-gen.js | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/js/src/jit-test/lib/gen/wasm-gc-limits-gen.js b/js/src/jit-test/lib/gen/wasm-gc-limits-gen.js new file mode 100644 index 0000000000..01fd527cc3 --- /dev/null +++ b/js/src/jit-test/lib/gen/wasm-gc-limits-gen.js @@ -0,0 +1,71 @@ +// Generates large .wasm files for use in ../limits.js. +// Make sure you are running this script from a release build or you will be sad. + +loadRelativeToScript("../wasm-binary.js"); + +function moduleNRecGroupNTypes(numRecs, numTypes) { + let types = []; + for (let i = 0; i < numTypes; i++) { + types.push({ kind: FuncCode, args: [], ret: [] }); + } + let recs = []; + for (let i = 0; i < numRecs; i++) { + recs.push(recGroup(types)); + } + return new Uint8Array(compressLZ4(new Uint8Array(moduleWithSections([typeSection(recs)])).buffer)); +} + +os.file.writeTypedArrayToFile("wasm-gc-limits-r1M-t1.wasm", moduleNRecGroupNTypes(1_000_000, 1)); +os.file.writeTypedArrayToFile("wasm-gc-limits-r1M1-t1.wasm", moduleNRecGroupNTypes(1_000_001, 1)); +os.file.writeTypedArrayToFile("wasm-gc-limits-r1-t1M.wasm", moduleNRecGroupNTypes(1, 1_000_000)); +os.file.writeTypedArrayToFile("wasm-gc-limits-r1-t1M1.wasm", moduleNRecGroupNTypes(1, 1_000_001)); +os.file.writeTypedArrayToFile("wasm-gc-limits-r2-t500K.wasm", moduleNRecGroupNTypes(2, 500_000)); +os.file.writeTypedArrayToFile("wasm-gc-limits-r2-t500K1.wasm", moduleNRecGroupNTypes(2, 500_001)); + +function moduleLargeStruct(size) { + let structInitializer = []; + for (let i = 0; i < size; i++) { + structInitializer.push(I64ConstCode); + structInitializer.push(...varU32(0)); + } + return new Uint8Array(compressLZ4(new Uint8Array(moduleWithSections([ + typeSection([ + { + kind: StructCode, + fields: Array(size).fill(I64Code) + }, + { + kind: FuncCode, + args: [], + ret: [AnyRefCode] + } + ]), + declSection([1, 1]), + exportSection([ + {name: "makeLargeStructDefault", funcIndex: 0}, + {name: "makeLargeStruct", funcIndex: 1} + ]), + bodySection([ + funcBody({ + locals: [], + body: [ + GcPrefix, + StructNewDefault, + ...varU32(0) + ], + }), + funcBody({ + locals: [], + body: [ + ...structInitializer, + GcPrefix, + StructNew, + ...varU32(0) + ], + }), + ]), + ])).buffer)); +} + +os.file.writeTypedArrayToFile("wasm-gc-limits-s10K.wasm", moduleLargeStruct(10_000)); +os.file.writeTypedArrayToFile("wasm-gc-limits-s10K1.wasm", moduleLargeStruct(10_001)); |