Debian Codegraph @

js/src/jit-test/tests/basic/offThreadCompileToStencil-01.js

raw
1 // |jit-test| skip-if: helperThreadCount() === 0
2
3 // Any copyright is dedicated to the Public Domain.
4 // http://creativecommons.org/licenses/publicdomain/
5
6 // Test off-thread parsing.
7
8 load(libdir + 'asserts.js');
9
10 offThreadCompileToStencil('Math.sin(Math.PI/2)');
11 var stencil = finishOffThreadStencil();
12 assertEq(evalStencil(stencil), 1);
13
14 offThreadCompileToStencil('a string which cannot be reduced to the start symbol');
15 assertThrowsInstanceOf(() => {
16 var stencil = finishOffThreadStencil();
17 evalStencil(stencil);
18 }, SyntaxError);
19
20 offThreadCompileToStencil('smerg;');
21 assertThrowsInstanceOf(() => {
22 var stencil = finishOffThreadStencil();
23 evalStencil(stencil);
24 }, ReferenceError);
25
26 offThreadCompileToStencil('throw "blerg";');
27 assertThrowsValue(() => {
28 var stencil = finishOffThreadStencil();
29 evalStencil(stencil);
30 }, 'blerg');