forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1856635: Speed up wasm/gc/limits.js test. r=bvisness
Differential Revision: https://phabricator.services.mozilla.com/D190503
- Loading branch information
Showing
27 changed files
with
368 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// |jit-test| --setpref=wasm_gc; include:wasm.js; | ||
|
||
// array.new_fixed has limit of 10_000 operands | ||
wasmFailValidateText(`(module | ||
(type $a (array i32)) | ||
(func | ||
array.new_fixed $a 10001 | ||
) | ||
)`, /too many/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Files for some of these tests are pre-generated and located in js/src/jit-test/lib/gen. | ||
// There you will also find the script to update these files. | ||
function loadMod(name) { | ||
return decompressLZ4(os.file.readFile(libdir + "gen/" + name, "binary").buffer) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// |jit-test| --setpref=wasm_gc; include:wasm.js; | ||
|
||
loadRelativeToScript("load-mod.js"); | ||
|
||
// Limit of 1 million recursion groups | ||
wasmValidateBinary(loadMod("wasm-gc-limits-r1M-t1.wasm")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// |jit-test| --setpref=wasm_gc; include:wasm.js; | ||
|
||
loadRelativeToScript("load-mod.js"); | ||
|
||
// Limit of 1 million recursion groups | ||
wasmFailValidateBinary(loadMod("wasm-gc-limits-r1M1-t1.wasm"), /too many/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// |jit-test| --setpref=wasm_gc; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; include:wasm.js; | ||
|
||
loadRelativeToScript("load-mod.js"); | ||
|
||
// Limit of 10_000 struct fields | ||
wasmFailValidateBinary(loadMod("wasm-gc-limits-s10K1.wasm"), /too many/); | ||
{ | ||
let {makeLargeStructDefault, makeLargeStruct} = wasmEvalBinary(loadMod("wasm-gc-limits-s10K.wasm")).exports; | ||
let largeStructDefault = makeLargeStructDefault(); | ||
let largeStruct = makeLargeStruct(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// |jit-test| --setpref=wasm_gc; include:wasm.js; | ||
|
||
loadRelativeToScript("load-mod.js"); | ||
|
||
// Limit of 1 million types (across all recursion groups) | ||
wasmValidateBinary(loadMod("wasm-gc-limits-r1-t1M.wasm")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// |jit-test| --setpref=wasm_gc; include:wasm.js; | ||
|
||
loadRelativeToScript("load-mod.js"); | ||
|
||
// Limit of 1 million types (across all recursion groups) | ||
wasmValidateBinary(loadMod("wasm-gc-limits-r2-t500K.wasm")); |
Oops, something went wrong.