| 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 |
| 7 main() { | 9 main() { |
| 8 checkshiftAnd32(); | 10 checkshiftAnd32(); |
| 9 checkShiftAnd64(); | 11 checkShiftAnd64(); |
| 10 // Optimize shiftAnd32. | 12 // Optimize shiftAnd32. |
| 11 for (int i = 0; i < 10000; i++) { | 13 for (int i = 0; i < 10000; i++) { |
| 12 A.shiftAnd32(12, 17); | 14 A.shiftAnd32(12, 17); |
| 13 A.shiftAnd64(12, 17); | 15 A.shiftAnd64(12, 17); |
| 14 Expect.equals(72, A.multipleConstantUses(3, 4)); | 16 Expect.equals(72, A.multipleConstantUses(3, 4)); |
| 15 Expect.equals(34493956096, A.multipleShiftUse(134742016, 8)); | 17 Expect.equals(34493956096, A.multipleShiftUse(134742016, 8)); |
| 16 } | 18 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 68 } |
| 67 | 69 |
| 68 foo(x) { return x & 0xf; } | 70 foo(x) { return x & 0xf; } |
| 69 } | 71 } |
| 70 | 72 |
| 71 class B { foo(x) { return x; } } | 73 class B { foo(x) { return x; } } |
| 72 | 74 |
| 73 bar (o) { | 75 bar (o) { |
| 74 return o.foo(1 << 32); | 76 return o.foo(1 << 32); |
| 75 } | 77 } |
| OLD | NEW |