]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/for-in-proxy-target-changed-structure.js
5c9d76f822742c6024937b45a16fec3ba7262f33
[apple/javascriptcore.git] / tests / stress / for-in-proxy-target-changed-structure.js
1 var theO;
2
3 function deleteAll() {
4 delete theO.a;
5 delete theO.b;
6 delete theO.c;
7 delete theO.d;
8 for (var i = 0; i < 10; ++i)
9 theO["i" + i] = 42;
10 theO.a = 11;
11 theO.b = 12;
12 theO.c = 13;
13 theO.d = 14;
14 }
15
16 function foo(o_) {
17 var o = o_;
18 var result = 0;
19 for (var s in o) {
20 result += o[s];
21 deleteAll();
22 }
23 return result;
24 }
25
26 noInline(foo);
27
28 for (var i = 0; i < 10000; ++i) {
29 var result = foo(createProxy(theO = {a:1, b:2, c:3, d:4}));
30 if (result != 1 + 12 + 13 + 14)
31 throw "Error: bad result: " + result;
32 }