OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 var myString; | 7 var myString; |
8 | 8 |
9 String ifBailout(test) { | 9 String ifBailout(test) { |
10 if (test) { | 10 if (test) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 if (false) o[0] = 2; | 124 if (false) o[0] = 2; |
125 print(o[0]); | 125 print(o[0]); |
126 } | 126 } |
127 return a; | 127 return a; |
128 } | 128 } |
129 | 129 |
130 void ifPhiBailout1(int bailout) { | 130 void ifPhiBailout1(int bailout) { |
131 var a = 0; | 131 var a = 0; |
132 var c = 0; | 132 var c = 0; |
133 | 133 |
134 if (a == 0) c = a++; | 134 if (a == 0) |
135 else c = a--; | 135 c = a++; |
| 136 else |
| 137 c = a--; |
136 | 138 |
137 if (bailout == 1) { | 139 if (bailout == 1) { |
138 var o = myString; | 140 var o = myString; |
139 if (false) o[0] = 2; | 141 if (false) o[0] = 2; |
140 print(o[0]); | 142 print(o[0]); |
141 } | 143 } |
142 | 144 |
143 Expect.equals(1, a); | 145 Expect.equals(1, a); |
144 Expect.equals(0, c); | 146 Expect.equals(0, c); |
145 | 147 |
146 if (a == 0) c = a++; | 148 if (a == 0) |
147 else c = a--; | 149 c = a++; |
| 150 else |
| 151 c = a--; |
148 | 152 |
149 if (bailout == 2) { | 153 if (bailout == 2) { |
150 var o = myString; | 154 var o = myString; |
151 if (false) o[0] = 2; | 155 if (false) o[0] = 2; |
152 print(o[0]); | 156 print(o[0]); |
153 } | 157 } |
154 | 158 |
155 Expect.equals(0, a); | 159 Expect.equals(0, a); |
156 Expect.equals(1, c); | 160 Expect.equals(1, c); |
157 } | 161 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 Expect.equals('1234', doWhileBailout()); | 216 Expect.equals('1234', doWhileBailout()); |
213 | 217 |
214 Expect.equals(102334155, fibonacci(40)); | 218 Expect.equals(102334155, fibonacci(40)); |
215 | 219 |
216 phiBailout(); | 220 phiBailout(); |
217 ifPhiBailout1(1); | 221 ifPhiBailout1(1); |
218 ifPhiBailout1(2); | 222 ifPhiBailout1(2); |
219 ifPhiBailout2(1); | 223 ifPhiBailout2(1); |
220 ifPhiBailout2(2); | 224 ifPhiBailout2(2); |
221 } | 225 } |
OLD | NEW |