stencil-laziness-validate.js (1234B)
1 // |jit-test| skip-if: isLcovEnabled() 2 3 load(libdir + "asserts.js"); 4 5 const gWithSource = newGlobal({discardSource: false}); 6 const gWithoutSource = newGlobal({discardSource: true}); 7 8 const stencil = compileToStencil(""); 9 10 gWithSource.evalStencil(stencil); 11 assertThrowsInstanceOf(() => gWithoutSource.evalStencil(stencil), gWithoutSource.Error); 12 13 const xdr = compileToStencilXDR(""); 14 gWithSource.evalStencilXDR(xdr); 15 assertThrowsInstanceOf(() => gWithoutSource.evalStencilXDR(xdr), gWithoutSource.Error); 16 17 const code = cacheEntry(""); 18 19 evaluate(code, { global: gWithSource, saveBytecodeWithDelazifications: true}); 20 evaluate(code, { global: gWithSource, loadBytecode: true}); 21 assertThrowsInstanceOf(() => evaluate(code, { global: gWithoutSource, loadBytecode: true}), gWithoutSource.Error); 22 23 const moduleStencil = compileToStencil("", { module: true }); 24 gWithSource.instantiateModuleStencil(moduleStencil); 25 assertThrowsInstanceOf(() => gWithoutSource.instantiateModuleStencil(moduleStencil), gWithoutSource.Error); 26 27 const moduleXDR = compileToStencilXDR("", { module: true }); 28 gWithSource.instantiateModuleStencilXDR(moduleXDR); 29 assertThrowsInstanceOf(() => gWithoutSource.instantiateModuleStencilXDR(moduleXDR), gWithoutSource.Error);