]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/constant-folding-osr-exit.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / constant-folding-osr-exit.js
1 var foo = [
2 function(o) {
3 var x = true;
4 o.f.f;
5 if (x)
6 return;
7 throw new Error();
8 },
9 function(o) {
10 var x = true;
11 o.f.f;
12 if (!x)
13 throw new Error();
14 return;
15 },
16 function(o) {
17 var x = 0;
18 var y = 1;
19 o.f.f;
20 if (x < y)
21 return;
22 throw new Error();
23 },
24 function(o) {
25 var x = 1;
26 var y = 0;
27 o.f.f;
28 if (x > y)
29 return;
30 throw new Error();
31 },
32 function(o) {
33 var x = 0;
34 var y = 1;
35 o.f.f;
36 if (x <= y)
37 return;
38 throw new Error();
39 },
40 function(o) {
41 var x = 1;
42 var y = 0;
43 o.f.f;
44 if (x >= y)
45 return;
46 throw new Error();
47 },
48 function(o) {
49 var x = 0;
50 var y = 1;
51 o.f.f;
52 if (x >= y)
53 throw new Error();
54 return;
55 },
56 function(o) {
57 var x = 1;
58 var y = 0;
59 o.f.f;
60 if (x <= y)
61 throw new Error();
62 return;
63 },
64 function(o) {
65 var x = 0;
66 var y = 1;
67 o.f.f;
68 if (x > y)
69 throw new Error();
70 return;
71 },
72 function(o) {
73 var x = 1;
74 var y = 0;
75 o.f.f;
76 if (x < y)
77 throw new Error();
78 return;
79 },
80 function(o) {
81 var x = 42;
82 o.f.f;
83 if (x == 42)
84 return;
85 throw new Error();
86 },
87 function(o) {
88 var x = 42;
89 o.f.f;
90 if (x != 42)
91 throw new Error();
92 return;
93 },
94 function(o) {
95 var x = 42;
96 o.f.f;
97 if (x === 42)
98 return;
99 throw new Error();
100 },
101 function(o) {
102 var x = 42;
103 o.f.f;
104 if (x !== 42)
105 throw new Error();
106 return;
107 },
108 ];
109 for (var i = 0; i < foo.length; ++i)
110 noInline(foo[i]);
111
112 function test(o) {
113 var failed = [];
114 for (var i = 0; i < foo.length; ++i) {
115 try {
116 foo[i](o);
117 } catch (e) {
118 failed.push("Failed " + foo[i] + " with " + e);
119 }
120 }
121 if (failed.length)
122 throw failed;
123 }
124
125 var object = {f:{f:42}};
126
127 for (var i = 0; i < 10000; ++i) {
128 test(object);
129 }
130
131 test({f:{g:43}});
132