OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 correctness of side effects tracking used by load to load forwarding. | 4 // Test correctness of side effects tracking used by load to load forwarding. |
5 | 5 |
| 6 import "package:expect/expect.dart"; |
| 7 |
6 class A { | 8 class A { |
7 var x, y; | 9 var x, y; |
8 A(this.x, this.y); | 10 A(this.x, this.y); |
9 } | 11 } |
10 | 12 |
11 foo(a) { | 13 foo(a) { |
12 var value1 = a.x; | 14 var value1 = a.x; |
13 var value2 = a.y; | 15 var value2 = a.y; |
14 for (var j = 1; j < 4; j++) { | 16 for (var j = 1; j < 4; j++) { |
15 value1 |= a.x << (j * 8); | 17 value1 |= a.x << (j * 8); |
(...skipping 17 matching lines...) Expand all Loading... |
33 return [value1, value2]; | 35 return [value1, value2]; |
34 } | 36 } |
35 | 37 |
36 main() { | 38 main() { |
37 for (var i = 0; i < 2000; i++) { | 39 for (var i = 0; i < 2000; i++) { |
38 Expect.listEquals([0x02010000, 0x03020100], foo(new A(0, 0))); | 40 Expect.listEquals([0x02010000, 0x03020100], foo(new A(0, 0))); |
39 Expect.listEquals([0x02010000, 0x03020100], bar(new A(0, 0), false)); | 41 Expect.listEquals([0x02010000, 0x03020100], bar(new A(0, 0), false)); |
40 Expect.listEquals([0x04020000, 0x03020100], bar(new A(0, 0), true)); | 42 Expect.listEquals([0x04020000, 0x03020100], bar(new A(0, 0), true)); |
41 } | 43 } |
42 } | 44 } |
OLD | NEW |