OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, 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 import 'package:expect/expect.dart'; |
| 7 |
| 8 trunc(x) => x & 0xFFFFFFFF; |
| 9 |
| 10 f(t, x) => t(x) + 1; |
| 11 |
| 12 g(t, x) => t(x + 1); |
| 13 |
| 14 // Foo should be entirely replaced by Uint32 operations. Running with |
| 15 // --trace-integer-ir-selection should result in: |
| 16 // CheckStackOverflow:4() |
| 17 // v22 <- UnboxUint32:14(v2) |
| 18 // v24 <- UnboxUint32:14(v3) |
| 19 // v6 <- BinaryUint32Op:14(+, v22 , v24 ) |
| 20 // v26 <- UnboxUint32:22(v4) |
| 21 // v8 <- BinaryUint32Op:22(+, v6 , v26 ) |
| 22 // v28 <- UnboxUint32:30(v5) |
| 23 // v10 <- BinaryUint32Op:30(+, v8 , v28 ) |
| 24 // v30 <- UnboxUint32:14(v21) |
| 25 // v19 <- BinaryUint32Op:14(&, v10 , v30 ) |
| 26 // v32 <- BoxUint32:90(v19 ) |
| 27 // Return:38(v32 ) |
| 28 foo(a, b, c, i) { |
| 29 return trunc(a + b + c + i); |
| 30 } |
| 31 |
| 32 main() { |
| 33 for (var i = 0; i < 20000; i++) { |
| 34 Expect.equals(0x100000000, f(trunc, 0xFFFFFFFF)); |
| 35 Expect.equals(0x0, g(trunc, 0xFFFFFFFF)); |
| 36 } |
| 37 |
| 38 var a = 0xFFFFFFFF; |
| 39 var b = 0xCCCCCCCC; |
| 40 var c = 0x33333335; |
| 41 |
| 42 for (var i = 0; i < 20000; i++) { |
| 43 Expect.equals(i, foo(a, b, c, i)); |
| 44 } |
| 45 } |
| 46 |
OLD | NEW |