| 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 // Test program for correct optimizations related to types fo allocated lists. | 4 // Test program for correct optimizations related to types fo allocated lists. |
| 5 // VMOptions=--optimization-counter-threshold=10 --no-use-osr |
| 5 | 6 |
| 6 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 7 | 8 |
| 8 // Classes to induce polymorphism of degree 10. | 9 // Classes to induce polymorphism of degree 10. |
| 9 class A0 { | 10 class A0 { |
| 10 test() => 0; | 11 test() => 0; |
| 11 } | 12 } |
| 12 | 13 |
| 13 class A1 { | 14 class A1 { |
| 14 test() => 1; | 15 test() => 1; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 43 } | 44 } |
| 44 | 45 |
| 45 class A9 { | 46 class A9 { |
| 46 test() => 9; | 47 test() => 9; |
| 47 } | 48 } |
| 48 | 49 |
| 49 // Class with no test method. | 50 // Class with no test method. |
| 50 class B { } | 51 class B { } |
| 51 | 52 |
| 52 test(obj) { | 53 test(obj) { |
| 53 return obj.test(); | 54 return obj.test(); |
| 54 } | 55 } |
| 55 | 56 |
| 56 main() { | 57 main() { |
| 57 // Trigger optimization of 'test' function. | 58 // Trigger optimization of 'test' function. |
| 58 List list = [new A0(), new A1(), new A2(), new A3(), new A4(), | 59 List list = [new A0(), new A1(), new A2(), new A3(), new A4(), |
| 59 new A5(), new A6(), new A7(), new A8(), new A9()]; | 60 new A5(), new A6(), new A7(), new A8(), new A9()]; |
| 60 for (int i = 0; i < 1000; i++) { | 61 for (int i = 0; i < 20; i++) { |
| 61 for (var obj in list) { | 62 for (var obj in list) { |
| 62 test(obj); | 63 test(obj); |
| 63 } | 64 } |
| 64 } | 65 } |
| 65 Expect.throws(() => test(new B()), (e) => e is NoSuchMethodError); | 66 Expect.throws(() => test(new B()), (e) => e is NoSuchMethodError); |
| 66 } | 67 } |
| OLD | NEW |