]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/prune-multi-put-by-offset-replace-or-transition-variant.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / prune-multi-put-by-offset-replace-or-transition-variant.js
1 function foo(o) {
2 o.f = 1;
3 }
4
5 function fu(o) {
6 o.e = 2;
7 }
8
9 function bar(f, o) {
10 f(o);
11 }
12
13 function baz(f, o) {
14 f(o);
15 }
16
17 for (var i = 0; i < 100; ++i) {
18 foo({f:1, e:2});
19 foo({e:1, f:2});
20 foo({e:1});
21 foo({d:1, e:2, f:3});
22 fu({f:1, e:2});
23 fu({e:1, f:2});
24 fu({e:1, f:2, g:3});
25 fu({d:1, e:2, f:3, g:4});
26 }
27
28 for (var i = 0; i < 100; ++i) {
29 bar(foo, {f:1});
30 bar(function() { }, null);
31 bar(function() { return 42; }, null);
32 baz(fu, {e:1});
33 baz(function() { }, null);
34 baz(function() { return 42; }, null);
35 }
36
37 (function(f, g, o, p) {
38 var result = 0;
39 var n = 1000000;
40 for (var i = 0; i < n; ++i) {
41 var q;
42 if (i == n - 1)
43 q = p;
44 else
45 q = o;
46 baz(g, q);
47 bar(f, q);
48 }
49 if (o.e != 2)
50 throw "Error: bad value in o.e: " + o.e;
51 if (o.f != 1)
52 throw "Error: bad value in o.f: " + o.f;
53 if (p.e != 2)
54 throw "Error: bad value in p.e: " + p.e;
55 if (p.f != 1)
56 throw "Error: bad value in p.f: " + p.f;
57 })(foo, fu, {e:42, f:2}, {e:12, f:13, g:14});
58