]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/materialize-past-butterfly-allocation.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / materialize-past-butterfly-allocation.js
1 function bar() {
2 return {f:42};
3 }
4
5 noInline(bar);
6
7 function foo0(b) {
8 var o = {f:42};
9 if (b) {
10 var p = bar();
11 p.g = o;
12 return p;
13 }
14 }
15
16 function foo1(b) {
17 var o = {f:42};
18 if (b) {
19 var p = bar();
20 p.f1 = 1;
21 p.g = o;
22 return p;
23 }
24 }
25
26 function foo2(b) {
27 var o = {f:42};
28 if (b) {
29 var p = bar();
30 p.f1 = 1;
31 p.f2 = 2;
32 p.g = o;
33 return p;
34 }
35 }
36
37 function foo3(b) {
38 var o = {f:42};
39 if (b) {
40 var p = bar();
41 p.f1 = 1;
42 p.f2 = 2;
43 p.f3 = 3;
44 p.g = o;
45 return p;
46 }
47 }
48
49 function foo4(b) {
50 var o = {f:42};
51 if (b) {
52 var p = bar();
53 p.f1 = 1;
54 p.f2 = 2;
55 p.f3 = 3;
56 p.f4 = 4;
57 p.g = o;
58 return p;
59 }
60 }
61
62 noInline(foo0);
63 noInline(foo1);
64 noInline(foo2);
65 noInline(foo3);
66 noInline(foo4);
67
68 var array = new Array(1000);
69 for (var i = 0; i < 4000000; ++i) {
70 var o = foo0(true);
71 array[i % array.length] = o;
72 }
73 for (var i = 0; i < 4000000; ++i) {
74 var o = foo1(true);
75 array[i % array.length] = o;
76 }
77 for (var i = 0; i < 4000000; ++i) {
78 var o = foo2(true);
79 array[i % array.length] = o;
80 }
81 for (var i = 0; i < 4000000; ++i) {
82 var o = foo3(true);
83 array[i % array.length] = o;
84 }
85 for (var i = 0; i < 4000000; ++i) {
86 var o = foo4(true);
87 array[i % array.length] = o;
88 }
89