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/tests/xdr/stencil-can-lazily-parse-mismatch.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/tests/xdr/stencil-can-lazily-parse-mismatch.js')
-rw-r--r-- | js/src/jit-test/tests/xdr/stencil-can-lazily-parse-mismatch.js | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/xdr/stencil-can-lazily-parse-mismatch.js b/js/src/jit-test/tests/xdr/stencil-can-lazily-parse-mismatch.js new file mode 100644 index 0000000000..351dbc9648 --- /dev/null +++ b/js/src/jit-test/tests/xdr/stencil-can-lazily-parse-mismatch.js @@ -0,0 +1,71 @@ +// |jit-test| skip-if: isLcovEnabled() +// Code coverage forces full-parse. + +load(libdir + 'asserts.js'); + +const code = `var a = 10;`; + +function testCompile(sourceIsLazy1, sourceIsLazy2, + forceFullParse1, forceFullParse2) { + const stencil = compileToStencil(code, { sourceIsLazy: sourceIsLazy1, + forceFullParse: forceFullParse1 }); + // The laziness options are ignored for instantiation, and no error is thrown. + evalStencil(stencil, { sourceIsLazy: sourceIsLazy2, + forceFullParse: forceFullParse2 }); +} + +function testOffThreadCompile(sourceIsLazy1, sourceIsLazy2, + forceFullParse1, forceFullParse2) { + offThreadCompileToStencil(code, { sourceIsLazy: sourceIsLazy1, + forceFullParse: forceFullParse1 }); + const stencil = finishOffThreadStencil(); + // The laziness options are ignored for instantiation, and no error is thrown. + evalStencil(stencil, { sourceIsLazy: sourceIsLazy2, + forceFullParse: forceFullParse2 }); +} + +function testXDR(sourceIsLazy1, sourceIsLazy2, + forceFullParse1, forceFullParse2) { + const xdr = compileToStencilXDR(code, { sourceIsLazy: sourceIsLazy1, + forceFullParse: forceFullParse1 }); + // The compile options are ignored when decoding, and no error is thrown. + evalStencilXDR(xdr, { sourceIsLazy: sourceIsLazy2, + forceFullParse: forceFullParse2 }); +} + +function testOffThreadXDR(sourceIsLazy1, sourceIsLazy2, + forceFullParse1, forceFullParse2) { + const t = cacheEntry(code); + evaluate(t, { sourceIsLazy: sourceIsLazy1, + forceFullParse: forceFullParse1, + saveIncrementalBytecode: true }); + + // The compile options are ignored when decoding, and no error is thrown. + offThreadDecodeStencil(t, { sourceIsLazy: sourceIsLazy2, + forceFullParse: forceFullParse2 }); + const stencil = finishOffThreadStencil(); + + // The laziness options are ignored for instantiation, and no error is thrown. + evalStencil(stencil, { sourceIsLazy: sourceIsLazy2, + forceFullParse: forceFullParse2 }); +} + +const optionsList = [ + [true, false, false, false], + [false, true, false, false], + [false, false, true, false], + [false, false, false, true], + [true, false, true, false], + [false, true, false, true], +]; + +for (const options of optionsList) { + testCompile(...options); + if (helperThreadCount() > 0) { + testOffThreadCompile(...options); + } + testXDR(...options); + if (helperThreadCount() > 0) { + testOffThreadXDR(...options); + } +} |