| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Tests optimizing (a << b) & c if c is a Smi constant. | 5 // Tests optimizing (a << b) & c if c is a Smi constant. |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | |
| 8 | |
| 9 main() { | 7 main() { |
| 10 checkshiftAnd32(); | 8 checkshiftAnd32(); |
| 11 checkShiftAnd64(); | 9 checkShiftAnd64(); |
| 12 // Optimize shiftAnd32. | 10 // Optimize shiftAnd32. |
| 13 for (int i = 0; i < 10000; i++) { | 11 for (int i = 0; i < 10000; i++) { |
| 14 A.shiftAnd32(12, 17); | 12 A.shiftAnd32(12, 17); |
| 15 A.shiftAnd64(12, 17); | 13 A.shiftAnd64(12, 17); |
| 16 Expect.equals(72, A.multipleConstantUses(3, 4)); | 14 Expect.equals(72, A.multipleConstantUses(3, 4)); |
| 17 Expect.equals(34493956096, A.multipleShiftUse(134742016, 8)); | 15 Expect.equals(34493956096, A.multipleShiftUse(134742016, 8)); |
| 18 } | 16 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 66 } |
| 69 | 67 |
| 70 foo(x) { return x & 0xf; } | 68 foo(x) { return x & 0xf; } |
| 71 } | 69 } |
| 72 | 70 |
| 73 class B { foo(x) { return x; } } | 71 class B { foo(x) { return x; } } |
| 74 | 72 |
| 75 bar (o) { | 73 bar (o) { |
| 76 return o.foo(1 << 32); | 74 return o.foo(1 << 32); |
| 77 } | 75 } |
| OLD | NEW |