OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, 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 // Test various optimizations and deoptimizations of optimizing compiler.. |
| 5 // VMOptions=--enable-inlining-annotations --no-background-compilation --optimiz
ation-counter-threshold=1000 |
| 6 |
| 7 import "package:expect/expect.dart"; |
| 8 import "dart:typed_data"; |
| 9 |
| 10 const noInline = "NeverInline"; |
| 11 const alwaysInline = "AlwaysInline"; |
| 12 |
| 13 var list = new Uint32List(1); |
| 14 |
| 15 @noInline |
| 16 testuint32(bool b) { |
| 17 var t; |
| 18 if (b) { |
| 19 t = list[0]; |
| 20 } |
| 21 if (t != null) { |
| 22 return t & 0x7fffffff; |
| 23 } |
| 24 return -1; |
| 25 } |
| 26 |
| 27 main() { |
| 28 var s = 0; |
| 29 testuint32(true); |
| 30 testuint32(false); |
| 31 for (int i = 0; i < 10000; ++i) { |
| 32 testuint32(true); |
| 33 } |
| 34 Expect.equals(0, testuint32(true)); |
| 35 Expect.equals(-1, testuint32(false)); |
| 36 } |
OLD | NEW |