summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/offThreadCompileToStencil-01.js
blob: 461af865117120564c1f98785a3df16665753f60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// |jit-test| skip-if: helperThreadCount() === 0

// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/

// Test off-thread parsing.

load(libdir + 'asserts.js');

offThreadCompileToStencil('Math.sin(Math.PI/2)');
var stencil = finishOffThreadStencil();
assertEq(evalStencil(stencil), 1);

offThreadCompileToStencil('a string which cannot be reduced to the start symbol');
assertThrowsInstanceOf(() => {
  var stencil = finishOffThreadStencil();
  evalStencil(stencil);
}, SyntaxError);

offThreadCompileToStencil('smerg;');
assertThrowsInstanceOf(() => {
  var stencil = finishOffThreadStencil();
  evalStencil(stencil);
}, ReferenceError);

offThreadCompileToStencil('throw "blerg";');
assertThrowsValue(() => {
  var stencil = finishOffThreadStencil();
  evalStencil(stencil);
}, 'blerg');