]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/arrayify-structure-bad-test.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / arrayify-structure-bad-test.js
1 function foo(a, b) {
2 var x = b.f;
3 x += a[0];
4 return x + b.f;
5 }
6
7 noInline(foo);
8
9 function test(a, b, c) {
10 var result = foo(a, b);
11 if (result != c)
12 throw new Error("bad result: expected " + c + " but got: " + result);
13 }
14
15 var p = {f:42};
16 p[0] = 5;
17 for (var i = 0; i < 100000; ++i) {
18 test([4], p, 88);
19 test([4.5], p, 88.5);
20 }
21
22 test(p, p, 89);