]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/throw-from-ftl.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / throw-from-ftl.js
1 function foo(p) {
2 var o = {f:42};
3 if (p)
4 throw o;
5 return o;
6 }
7
8 noInline(foo);
9
10 for (var i = 0; i < 100000; ++i) {
11 var o = foo(false);
12 if (o.f != 42)
13 throw "Error: bad result: " + o.f;
14 }
15
16 var didThrow = false;
17 try {
18 foo(true);
19 } catch (e) {
20 if (e.f != 42)
21 throw "Error: bad result in catch: " + o.f;
22 didThrow = true;
23 }
24 if (!didThrow)
25 throw "Error: should have thrown but didn't.";