blob: 9464545b4f1e08a8f53a402279149f450ed25ed3 [file] [log] [blame]
sbarati@apple.com36c13402015-09-18 23:37:42 +00001"use strict";
2function assert(cond, m) {
3 if (!cond)
4 throw new Error("broke assertion: '" + m + "'");
5}
6noInline(assert);
7
8function baz(b) {
9 if (b)
10 throw new Error("Baz");
11}
12
13function bar(b) {
14 var exception = null;
15 try {
16 baz(b);
17 } catch(e) {
18 exception = e;
19 baz(b);
20 } finally {
21 if (b)
22 assert(exception);
23 }
24}
25
26function foo(b) {
27 var exception = null;
28 try {
29 bar(b);
30 } catch(e) {
31 exception = e;
32 }
33 if (b)
34 assert(exception);
35}
36
37const NUM_LOOPS = 1000;
38for (var i = 0; i < NUM_LOOPS; i++) {
39 foo(i === NUM_LOOPS - 1);
40}