]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/int32-out-of-bounds.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / int32-out-of-bounds.js
CommitLineData
81345200
A
1function foo(a, i) {
2 return a[i];
3}
4
5noInline(foo);
6
7function test(value) {
8 var result = foo([value], 0);
9 if (result != value)
10 throw "Error: bad result: " + result;
11}
12
13for (var i = 0; i < 100000; ++i)
14 test(42);
15
16var result = foo([42], 1);
17if (result !== void 0)
18 throw "Error: bad result: " + result;
19
20result = foo([42], 100);
21if (result !== void 0)
22 throw "Error: bad result: " + result;
23
24result = foo([42], 10000);
25if (result !== void 0)
26 throw "Error: bad result: " + result;
27
28Array.prototype[10000] = 23;
29result = foo([42], 10000);
30if (result !== 23)
31 throw "Error: bad result: " + result;