]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/ftl-library-inlining-exceptions-dataview.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / ftl-library-inlining-exceptions-dataview.js
1 function foo(d){
2 return d.getInt8(42);
3 }
4
5 noInline(foo);
6
7 var d = new DataView(new ArrayBuffer(43));
8 d.setInt8(42, 43);
9 for (var i = 0; i < 100000; ++i) {
10 var result = foo(d);
11 if (result != 43)
12 throw "Error: bad result: " + result;
13 }
14
15 for (var i = 0; i < 10; ++i) {
16 var didThrow = false;
17 try {
18 foo(new DataView(new ArrayBuffer(42)));
19 } catch (e) {
20 didThrow = true;
21 if (e.message.indexOf("Out of bounds") < 0)
22 throw "Error: bad exception: " + e.message;
23 }
24 if (!didThrow)
25 throw "Error: did not throw";
26 }