Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, 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=--optimization-counter-threshold=10 | |
| 7 | |
| 8 import "package:expect/expect.dart"; | |
| 9 | |
| 10 class C { | |
|
Vyacheslav Egorov (Google)
2014/05/08 12:53:20
Might be good to have this test cover other types
Florian Schneider
2014/05/08 14:21:43
Done.
| |
| 11 var x; | |
| 12 var y; | |
| 13 final z = 123; | |
| 14 } | |
| 15 | |
| 16 s1(a) { | |
| 17 a.x = 42; | |
| 18 a.x = 43; | |
| 19 return a.x; | |
| 20 } | |
| 21 | |
| 22 void foo(a) { | |
| 23 Expect.equals(42, a.x); | |
| 24 } | |
| 25 | |
| 26 s1a(a) { | |
| 27 a.x = 42; | |
| 28 foo(a); | |
| 29 a.x = 43; | |
| 30 return a.x; | |
| 31 } | |
| 32 | |
| 33 s2() { | |
| 34 var t = new C(); | |
| 35 return t; | |
| 36 } | |
| 37 | |
| 38 s3(a, b) { | |
|
Vyacheslav Egorov (Google)
2014/05/08 12:53:20
You should also have a test where redundant store
Florian Schneider
2014/05/08 14:21:43
Done.
| |
| 39 a.x = b + 1; | |
| 40 if (b % 2 == 0) { | |
| 41 a.x = 0; | |
| 42 } else { | |
| 43 a.x = 0; | |
| 44 } | |
| 45 return a.x; | |
| 46 } | |
| 47 | |
| 48 | |
| 49 main() { | |
| 50 for (var i = 0; i < 20; i++) Expect.equals(43, s1(new C())); | |
| 51 for (var i = 0; i < 20; i++) Expect.equals(43, s1a(new C())); | |
| 52 for (var i = 0; i < 20; i++) Expect.equals(123, s2().z); | |
| 53 for (var i = 0; i < 20; i++) Expect.equals(0, s3(new C(), i)); | |
| 54 } | |
| OLD | NEW |