diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/lib/codegen-arm64-test.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/lib/codegen-arm64-test.js')
-rw-r--r-- | js/src/jit-test/lib/codegen-arm64-test.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/js/src/jit-test/lib/codegen-arm64-test.js b/js/src/jit-test/lib/codegen-arm64-test.js new file mode 100644 index 0000000000..542f34f826 --- /dev/null +++ b/js/src/jit-test/lib/codegen-arm64-test.js @@ -0,0 +1,40 @@ +// Scaffolding for testing arm64 Ion code generation patterns . See +// codegen-x64-test.js in this directory for more information. + +load(libdir + "codegen-test-common.js"); + +// End of prologue +var arm64_prefix = ` +910003fd mov x29, sp +910003fc mov x28, sp +`; + +// Start of epilogue +var arm64_suffix = ` +f94003fd ldr x29, \\[sp\\] +`; + +// For when nothing else applies: `module_text` is the complete source text of +// the module, `export_name` is the name of the function to be tested, +// `expected` is the non-preprocessed pattern, and options is an options bag, +// described above. +function codegenTestARM64_adhoc(module_text, export_name, expected, options = {}) { + assertEq(hasDisassembler(), true); + + let ins = wasmEvalText(module_text, {}, options.features); + if (options.instanceBox) + options.instanceBox.value = ins; + let output = wasmDis(ins.exports[export_name], {tier:"ion", asString:true}); + if (!options.no_prefix) + expected = arm64_prefix + '\n' + expected; + if (!options.no_suffix) + expected = expected + '\n' + arm64_suffix; + expected = fixlines(expected); + if (options.log) { + print(module_text); + print(output); + print(expected); + } + assertEq(output.match(new RegExp(expected)) != null, true); +} + |