| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2016, 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 // VMOptions=--enable-inlining-annotations --optimization-counter-threshold=10 -
-no-background-compilation | |
| 6 | |
| 7 const AlwaysInline = "AlwaysInline"; | |
| 8 const NeverInline = "NeverInline"; | |
| 9 | |
| 10 abstract class A<T extends A<T>> { | |
| 11 @AlwaysInline | |
| 12 f(x) => new R<T>(x); | |
| 13 } | |
| 14 | |
| 15 class B extends A<B> {} | |
| 16 | |
| 17 class R<T> { | |
| 18 @AlwaysInline | |
| 19 R(T field); | |
| 20 } | |
| 21 | |
| 22 class C extends B {} | |
| 23 | |
| 24 class D extends C {} | |
| 25 | |
| 26 // f will be inlined and T=B will be forwarded to AssertAssignable in the | |
| 27 // R. However B will be wrapped in the TypeRef which breaks runtime TypeCheck | |
| 28 // function (Instance::IsInstanceOf does not work for TypeRefs). | |
| 29 @NeverInline | |
| 30 f(o) => new B().f(o); | |
| 31 | |
| 32 main() { | |
| 33 final o = new D(); | |
| 34 for (var i = 0; i < 10; i++) { | |
| 35 f(o); | |
| 36 } | |
| 37 } | |
| OLD | NEW |