| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 // VMOptions=--optimization_counter_threshold=10 |
| 5 |
| 6 // Test branch optimization for TestSmiInstr |
| 7 |
| 8 import "package:expect/expect.dart"; |
| 9 |
| 10 test(bool b) { |
| 11 var a = 0; |
| 12 if (b) { |
| 13 a++; |
| 14 } else { |
| 15 a += 2; |
| 16 } |
| 17 if (a & 1 == 0) { |
| 18 return "even"; |
| 19 } |
| 20 return "odd"; |
| 21 } |
| 22 |
| 23 main() { |
| 24 Expect.equals("odd", test(true)); |
| 25 Expect.equals("even", test(false)); |
| 26 for (var i=0; i<20; i++) test(false); |
| 27 Expect.equals("odd", test(true)); |
| 28 Expect.equals("even", test(false)); |
| 29 } |
| 30 |
| OLD | NEW |