OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Dart Mint representations and type propagation issue. | 5 // Dart Mint representations and type propagation issue. |
6 // Testing Int32List and Uint32List loads. | 6 // Testing Int32List and Uint32List loads. |
7 // | 7 // |
8 // VMOptions=--optimization-counter-threshold=5 --no-use-osr | 8 // VMOptions=--optimization-counter-threshold=5 --no-use-osr --no-background-com
pilation |
9 | 9 |
10 import 'dart:typed_data'; | 10 import 'dart:typed_data'; |
11 import "package:expect/expect.dart"; | 11 import "package:expect/expect.dart"; |
12 | 12 |
13 main() { | 13 main() { |
14 var a = new Uint32List(100); | 14 var a = new Uint32List(100); |
15 a[2] = 3; | 15 a[2] = 3; |
16 var res = sumIt1(a, 2); | 16 var res = sumIt1(a, 2); |
17 Expect.equals(3 * 10, res); | 17 Expect.equals(3 * 10, res); |
18 res = sumIt1(a, 2); | 18 res = sumIt1(a, 2); |
(...skipping 14 matching lines...) Expand all Loading... |
33 return sum; | 33 return sum; |
34 } | 34 } |
35 | 35 |
36 sumIt2(Int32List a, int n) { | 36 sumIt2(Int32List a, int n) { |
37 var sum = 0; | 37 var sum = 0; |
38 for (int i = 0; i < 10; i++) { | 38 for (int i = 0; i < 10; i++) { |
39 sum += a[n]; | 39 sum += a[n]; |
40 } | 40 } |
41 return sum; | 41 return sum; |
42 } | 42 } |
OLD | NEW |