| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import "package:expect/expect.dart"; |
| 6 |
| 5 // Test optimized constant string and constant array access. | 7 // Test optimized constant string and constant array access. |
| 6 | 8 |
| 7 int testConstantStringAndIndexCodeUnitAt() { | 9 int testConstantStringAndIndexCodeUnitAt() { |
| 8 int test(b) { | 10 int test(b) { |
| 9 if (b) return "hest".codeUnitAt(400); | 11 if (b) return "hest".codeUnitAt(400); |
| 10 return "hest".codeUnitAt(2); | 12 return "hest".codeUnitAt(2); |
| 11 } | 13 } |
| 12 | 14 |
| 13 Expect.throws(() => test(true)); | 15 Expect.throws(() => test(true)); |
| 14 for (int i = 0; i < 10000; i++) test(false); | 16 for (int i = 0; i < 10000; i++) test(false); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 40 for (int i = 0; i < 10000; i++) { foo(1); } | 42 for (int i = 0; i < 10000; i++) { foo(1); } |
| 41 Expect.throws(() => foo(2)); | 43 Expect.throws(() => foo(2)); |
| 42 } | 44 } |
| 43 | 45 |
| 44 | 46 |
| 45 main() { | 47 main() { |
| 46 testConstantStringAndIndexCodeUnitAt(); | 48 testConstantStringAndIndexCodeUnitAt(); |
| 47 testConstantArrayAndIndexAt(); | 49 testConstantArrayAndIndexAt(); |
| 48 testNonSmiIndex(); | 50 testNonSmiIndex(); |
| 49 } | 51 } |
| OLD | NEW |