Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1762)

Unified Diff: tests/language/vm/load_to_load_forwarding_vm_test.dart

Issue 395943003: Support allocation sinking for compound objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: improve tests Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/language/vm/allocation_sinking_vm_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/vm/load_to_load_forwarding_vm_test.dart
diff --git a/tests/language/vm/load_to_load_forwarding_vm_test.dart b/tests/language/vm/load_to_load_forwarding_vm_test.dart
index 5926305c36f8c7f76ddb37fcaba08d85e3d3fbf0..86c5de7771be51d267fd1ee3569a8f81470b9d64 100644
--- a/tests/language/vm/load_to_load_forwarding_vm_test.dart
+++ b/tests/language/vm/load_to_load_forwarding_vm_test.dart
@@ -240,49 +240,217 @@ testIndexedNoAlias(a) {
return a[0] + a[1];
}
-testIndexedAliasedStore(a, b) {
- a[0] = 1;
- a[1] = 2;
- if (a == b) {
- b[0] = 3;
- }
- return a[0] + a[1];
+//
+// Tests for indexed store aliases were autogenerated to have extensive
+// coverage for all interesting aliasing combinations within the alias
+// lattice (*[*], *[C], X[*], X[C])
+//
+
+testIndexedAliasedStore1(i) {
+ var a = new List(2);
+ a[0] = 1; // X[C]
+ a[i] = 2; // X[*]
+ return a[0];
}
-testIndexedAliasedStore1(a, b) {
- a[0] = 1;
- a[1] = 2;
- if (a == b) {
- b[0] = 3;
- }
- return a[0] + a[1];
+testIndexedAliasedStore2(f, c) {
+ var a = new List(2);
+ var d = f ? a : c;
+ a[0] = 1; // X[C]
+ d[0] = 2; // *[C]
+ return a[0];
}
-testIndexedAliasedStore2(a, b, i) {
- a[0] = 1;
- a[1] = 2;
- if (a == b) {
- b[i] = 3;
- }
- return a[0] + a[1];
+testIndexedAliasedStore3(f, c, i) {
+ var a = new List(2);
+ var d = f ? a : c;
+ a[0] = 1; // X[C]
+ d[i] = 2; // *[*]
+ return a[0];
}
+testIndexedAliasedStore4(i) {
+ var a = new List(2);
+ a[i] = 1; // X[*]
+ a[0] = 2; // X[C]
+ return a[i];
+}
-testIndexedAliasedStore3(i) {
+testIndexedAliasedStore5(i, j) {
var a = new List(2);
- a[0] = 1;
- a[i] = 3;
- return a[0];
+ a[i] = 1; // X[*]
+ a[j] = 2; // X[*]
+ return a[i];
}
+testIndexedAliasedStore6(i, f, c) {
+ var a = new List(2);
+ var d = f ? a : c;
+ a[i] = 1; // X[*]
+ d[0] = 2; // *[C]
+ return a[i];
+}
-testIndexedAliasedStore4(b) {
+testIndexedAliasedStore7(i, f, c) {
var a = new List(2);
- a[0] = 1;
- b[0] = 3;
- return a[0];
+ var d = f ? a : c;
+ a[i] = 1; // X[*]
+ d[i] = 2; // *[*]
+ return a[i];
+}
+
+testIndexedAliasedStore8(c, i) {
+ c[0] = 1; // *[C]
+ c[i] = 2; // *[*]
+ return c[0];
+}
+
+testIndexedAliasedStore9(c, f) {
+ var a = new List(2);
+ var d = f ? a : c;
+ c[0] = 1; // *[C]
+ d[0] = 2; // *[C]
+ return c[0];
+}
+
+testIndexedAliasedStore10(c, i) {
+ c[i] = 1; // *[*]
+ c[0] = 2; // *[C]
+ return c[i];
}
+testIndexedAliasedStore11(c, i, j) {
+ c[i] = 1; // *[*]
+ c[j] = 2; // *[*]
+ return c[i];
+}
+
+testIndexedAliasedStore12(f, c) {
+ var a = new List(2);
+ var d = f ? a : c;
+ d[0] = 1; // *[C]
+ a[0] = 2; // X[C]
+ return d[0];
+}
+
+testIndexedAliasedStore13(f, c, i) {
+ var a = new List(2);
+ var d = f ? a : c;
+ d[0] = 1; // *[C]
+ a[i] = 2; // X[*]
+ return d[0];
+}
+
+testIndexedAliasedStore14(f, c, i) {
+ var a = new List(2);
+ var d = f ? a : c;
+ d[i] = 1; // *[*]
+ a[0] = 2; // X[C]
+ return d[i];
+}
+
+testIndexedAliasedStore15(f, c, i) {
+ var a = new List(2);
+ var d = f ? a : c;
+ d[i] = 1; // *[*]
+ a[i] = 2; // X[*]
+ return d[i];
+}
+
+testIndexedAliasedStores() {
+ var arr = new List(2);
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(2, testIndexedAliasedStore1(0));
+ Expect.equals(1, testIndexedAliasedStore1(1));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(1, testIndexedAliasedStore2(false, arr));
+ Expect.equals(2, testIndexedAliasedStore2(true, arr));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(1, testIndexedAliasedStore3(false, arr, 0));
+ Expect.equals(1, testIndexedAliasedStore3(false, arr, 1));
+ Expect.equals(2, testIndexedAliasedStore3(true, arr, 0));
+ Expect.equals(1, testIndexedAliasedStore3(true, arr, 1));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(2, testIndexedAliasedStore4(0));
+ Expect.equals(1, testIndexedAliasedStore4(1));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(2, testIndexedAliasedStore5(0, 0));
+ Expect.equals(1, testIndexedAliasedStore5(0, 1));
+ Expect.equals(1, testIndexedAliasedStore5(1, 0));
+ Expect.equals(2, testIndexedAliasedStore5(1, 1));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(1, testIndexedAliasedStore6(0, false, arr));
+ Expect.equals(2, testIndexedAliasedStore6(0, true, arr));
+ Expect.equals(1, testIndexedAliasedStore6(1, false, arr));
+ Expect.equals(1, testIndexedAliasedStore6(1, true, arr));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(1, testIndexedAliasedStore7(0, false, arr));
+ Expect.equals(2, testIndexedAliasedStore7(0, true, arr));
+ Expect.equals(1, testIndexedAliasedStore7(1, false, arr));
+ Expect.equals(2, testIndexedAliasedStore7(1, true, arr));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(2, testIndexedAliasedStore8(arr, 0));
+ Expect.equals(1, testIndexedAliasedStore8(arr, 1));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(2, testIndexedAliasedStore9(arr, false));
+ Expect.equals(1, testIndexedAliasedStore9(arr, true));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(2, testIndexedAliasedStore10(arr, 0));
+ Expect.equals(1, testIndexedAliasedStore10(arr, 1));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(2, testIndexedAliasedStore11(arr, 0, 0));
+ Expect.equals(1, testIndexedAliasedStore11(arr, 0, 1));
+ Expect.equals(1, testIndexedAliasedStore11(arr, 1, 0));
+ Expect.equals(2, testIndexedAliasedStore11(arr, 1, 1));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(1, testIndexedAliasedStore12(false, arr));
+ Expect.equals(2, testIndexedAliasedStore12(true, arr));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(1, testIndexedAliasedStore13(false, arr, 0));
+ Expect.equals(1, testIndexedAliasedStore13(false, arr, 1));
+ Expect.equals(2, testIndexedAliasedStore13(true, arr, 0));
+ Expect.equals(1, testIndexedAliasedStore13(true, arr, 1));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(1, testIndexedAliasedStore14(false, arr, 0));
+ Expect.equals(1, testIndexedAliasedStore14(false, arr, 1));
+ Expect.equals(2, testIndexedAliasedStore14(true, arr, 0));
+ Expect.equals(1, testIndexedAliasedStore14(true, arr, 1));
+ }
+
+ for (var i = 0; i < 50; i++) {
+ Expect.equals(1, testIndexedAliasedStore15(false, arr, 0));
+ Expect.equals(1, testIndexedAliasedStore15(false, arr, 1));
+ Expect.equals(2, testIndexedAliasedStore15(true, arr, 0));
+ Expect.equals(2, testIndexedAliasedStore15(true, arr, 1));
+ }
+}
var indices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
@@ -316,7 +484,7 @@ main() {
final obj = new X(new X(new X(null)));
- final cs = new C(0, new C(1, new C(2, null)));
+ final cs = new C(0, new C(1, new C(2, null)));
for (var i = 0; i < 20; i++) {
Expect.listEquals([0x02010000, 0x03020100], foo(new A(0, 0)));
@@ -361,22 +529,8 @@ main() {
for (var i = 0; i < 20; i++) {
Expect.equals(3, testIndexedNoAlias(array));
}
- for (var i = 0; i < 20; i++) {
- Expect.equals(5, testIndexedAliasedStore1(array, array));
- }
- for (var i = 0; i < 20; i++) {
- Expect.equals(4, testIndexedAliasedStore2(array, array, indices[1]));
- }
- for (var i = 0; i < 20; i++) {
- Expect.equals(3, testIndexedAliasedStore3(indices[0]));
- }
- for (var i = 0; i < 20; i++) {
- Expect.equals(1, testIndexedAliasedStore3(indices[1]));
- }
- for (var i = 0; i < 20; i++) {
- Expect.equals(1, testIndexedAliasedStore4(array));
- }
+ testIndexedAliasedStores();
var test_array = new List(1);
for (var i = 0; i < 20; i++) {
« no previous file with comments | « tests/language/vm/allocation_sinking_vm_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698