| 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 // | |
| 5 // Dart Mint representations and type propagation issue. | |
| 6 // Testing Int32List and Uint32List loads. | |
| 7 // | |
| 8 // VMOptions=--optimization-counter-threshold=5 --no-use-osr --no-background-com
pilation | |
| 9 | |
| 10 import 'dart:typed_data'; | |
| 11 import "package:expect/expect.dart"; | |
| 12 | |
| 13 main() { | |
| 14 var a = new Uint32List(100); | |
| 15 a[2] = 3; | |
| 16 var res = sumIt1(a, 2); | |
| 17 Expect.equals(3 * 10, res); | |
| 18 res = sumIt1(a, 2); | |
| 19 Expect.equals(3 * 10, res); | |
| 20 a = new Int32List(100); | |
| 21 a[2] = 3; | |
| 22 res = sumIt2(a, 2); | |
| 23 Expect.equals(3 * 10, res); | |
| 24 res = sumIt2(a, 2); | |
| 25 Expect.equals(3 * 10, res); | |
| 26 } | |
| 27 | |
| 28 sumIt1(Uint32List a, int n) { | |
| 29 var sum = 0; | |
| 30 for (int i = 0; i < 10; i++) { | |
| 31 sum += a[n]; | |
| 32 } | |
| 33 return sum; | |
| 34 } | |
| 35 | |
| 36 sumIt2(Int32List a, int n) { | |
| 37 var sum = 0; | |
| 38 for (int i = 0; i < 10; i++) { | |
| 39 sum += a[n]; | |
| 40 } | |
| 41 return sum; | |
| 42 } | |
| OLD | NEW |