]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/arrayify-fires-watchpoint.js
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / tests / stress / arrayify-fires-watchpoint.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 function makeObjectArray(value) {
16 var result = {};
17 result[0] = value;
18 return result;
19 }
20
21 var p = {f:42};
22 p[0] = 5;
23 for (var i = 0; i < 100000; ++i) {
24 test(makeObjectArray(4), p, 88);
25 test(makeObjectArray(4.5), p, 88.5);
26 }
27
28 test(p, p, 89);