]> git.saurik.com Git - apple/javascriptcore.git/blame_incremental - tests/stress/for-in-proxy-target-changed-structure.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / for-in-proxy-target-changed-structure.js
... / ...
CommitLineData
1var theO;
2
3function 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
16function 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
26noInline(foo);
27
28for (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}