OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 correct handling of phis with only environment uses that were inserted | 4 // Test correct handling of phis with only environment uses that were inserted |
5 // by store to load forwarding. | 5 // by store to load forwarding. |
6 // VMOptions=--optimization_counter_threshold=100 | 6 // VMOptions=--optimization_counter_threshold=100 |
7 | 7 |
8 library store_to_load_forwarding_phis_vm_test; | 8 library store_to_load_forwarding_phis_vm_test; |
9 | 9 |
10 import 'dart:async'; | 10 import 'dart:async'; |
11 | 11 |
12 class A { | 12 class A { |
13 var _foo; | 13 var _foo; |
14 | 14 |
15 get foo { | 15 get foo { |
16 if (_foo == null) { | 16 if (_foo == null) { |
17 _foo = new A(); | 17 _foo = new A(); |
18 } | 18 } |
19 return _foo; | 19 return _foo; |
20 } | 20 } |
21 } | 21 } |
22 | 22 |
23 foo(obj) { | 23 foo(obj) { |
24 var a = obj.foo; | 24 var a = obj.foo; |
25 return new Future.immediate(null).then((val) { }); | 25 return new Future.value().then((val) { }); |
26 } | 26 } |
27 | 27 |
28 main() { | 28 main() { |
29 final obj = new A(); | 29 final obj = new A(); |
30 for (var i = 0; i < 200; i++) { | 30 for (var i = 0; i < 200; i++) { |
31 foo(obj); | 31 foo(obj); |
32 } | 32 } |
33 } | 33 } |
OLD | NEW |