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 // Tests correct handling of redefinitions in aliasing computation. |
| 9 |
| 10 import "package:expect/expect.dart"; |
| 11 |
| 12 const alwaysInline = "AlwaysInline"; |
| 13 const noInline = "NeverInline"; |
| 14 |
| 15 B G; |
| 16 |
| 17 class A { |
| 18 int val = -1; |
| 19 |
| 20 @alwaysInline |
| 21 poly(p) { |
| 22 p.aa = this; |
| 23 } |
| 24 } |
| 25 |
| 26 |
| 27 @noInline |
| 28 modify() { |
| 29 G.aa.val = 123; |
| 30 } |
| 31 |
| 32 class B { |
| 33 A aa; |
| 34 |
| 35 @alwaysInline |
| 36 poly(p) { |
| 37 G = this; |
| 38 foo2(p, this); |
| 39 modify(); |
| 40 } |
| 41 } |
| 42 |
| 43 @alwaysInline |
| 44 foo(obj, p) => obj.poly(p); |
| 45 |
| 46 @alwaysInline |
| 47 foo2(obj, p) => obj.poly(p); |
| 48 |
| 49 @noInline |
| 50 testfunc() { |
| 51 var a = new A(); |
| 52 var b = new B(); |
| 53 foo(b, a); |
| 54 return a.val; |
| 55 } |
| 56 |
| 57 main() { |
| 58 foo(new B(), new A()); |
| 59 foo(new A(), new B()); |
| 60 foo2(new B(), new A()); |
| 61 foo2(new A(), new B()); |
| 62 for (var i = 0; i < 100; i++) testfunc(); |
| 63 Expect.equals(123, testfunc()); |
| 64 } |
OLD | NEW |