OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013, 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 correct handling of phis with only environment uses that were inserted |
| 5 // by store to load forwarding. |
| 6 // VMOptions=--optimization_counter_threshold=10 |
| 7 |
| 8 import "package:expect/expect.dart"; |
| 9 |
| 10 class A { |
| 11 var foo; |
| 12 } |
| 13 |
| 14 class B { |
| 15 get foo => null; |
| 16 } |
| 17 |
| 18 test(obj) => obj.foo == null ? "null" : "other"; |
| 19 |
| 20 main() { |
| 21 var a = new A(); |
| 22 var b = new B(); |
| 23 // Trigger optimization of test with a polymorphic load. |
| 24 // The guarded type of foo is null. |
| 25 test(a); |
| 26 test(b); |
| 27 for (var i = 0; i < 20; ++i) test(a); |
| 28 Expect.equals("null", test(a)); |
| 29 Expect.equals("null", test(b)); |
| 30 |
| 31 // Store a non-null object into foo to trigger deoptimization of test. |
| 32 a.foo = 123; |
| 33 Expect.equals("other", test(a)); |
| 34 Expect.equals("null", test(b)); |
| 35 } |
OLD | NEW |