]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/float32-array-out-of-bounds.js
JavaScriptCore-7600.1.4.16.1.tar.gz
[apple/javascriptcore.git] / tests / stress / float32-array-out-of-bounds.js
1 function foo(a) {
2 return a[42];
3 }
4
5 noInline(foo);
6
7 var shortArray = new Float32Array(10);
8 var longArray = new Float32Array(100);
9
10 function test(array, expected) {
11 var result = foo(array);
12 if (result != expected)
13 throw new Error("bad result: " + result);
14 }
15
16 for (var i = 0; i < 1000; ++i)
17 test(shortArray, void 0);
18
19 for (var i = 0; i < 100000; ++i)
20 test(longArray, 0);
21
22 test(shortArray, void 0);
23