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 // Test correctness of side effects tracking used by load to load forwarding. |
| 5 |
| 6 // VMOptions=--no-use-osr --optimization-counter-threshold=10 --enable-inlining-
annotations |
| 7 |
| 8 import "package:expect/expect.dart"; |
| 9 |
| 10 const alwaysInline = "AlwaysInline"; |
| 11 const noInline = "NeverInline"; |
| 12 |
| 13 B G; |
| 14 |
| 15 @noInline |
| 16 modify() { |
| 17 G.bval = 123; |
| 18 } |
| 19 |
| 20 class B { |
| 21 |
| 22 @alwaysInline |
| 23 poly() { |
| 24 G = this; |
| 25 modify(); |
| 26 return bval; |
| 27 } |
| 28 var bval = -1; |
| 29 } |
| 30 |
| 31 class C { |
| 32 poly() => null; |
| 33 } |
| 34 |
| 35 |
| 36 @alwaysInline |
| 37 foo(obj) => obj.poly(); |
| 38 |
| 39 @noInline |
| 40 test() { |
| 41 var b = new B(); |
| 42 |
| 43 foo(b); |
| 44 return b.bval; |
| 45 } |
| 46 |
| 47 main() { |
| 48 foo(new C()); |
| 49 foo(new B()); |
| 50 for (var i = 0; i < 100; i++) test(); |
| 51 Expect.equals(123, test()); |
| 52 } |
OLD | NEW |