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