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

Side by Side Diff: tests/language/load_to_load_forwarding_vm_test.dart

Issue 17577007: Ensure that allocation sinking candidates are classified as not-aliased before final load forwardin… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"; 6 import "package:expect/expect.dart";
7 import "dart:typed_data"; 7 import "dart:typed_data";
8 8
9 class A { 9 class A {
10 var x, y; 10 var x, y;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 testPhiConvertions(f, arr) { 65 testPhiConvertions(f, arr) {
66 if (f) { 66 if (f) {
67 arr[0] = arr[1]; 67 arr[0] = arr[1];
68 } else { 68 } else {
69 arr[0] = arr[2]; 69 arr[0] = arr[2];
70 } 70 }
71 return arr[0]; 71 return arr[0];
72 } 72 }
73 73
74 class M {
75 var x;
76 M(this.x);
77 }
78
79 fakeAliasing(arr) {
80 var a = new M(10);
81 var b = new M(10);
82 var c = arr.length;
83
84 if (c * c != c * c) {
85 arr[0] = a; // Escape.
86 arr[0] = b;
87 }
88
89 return c * c; // Deopt point.
90 }
91
74 main() { 92 main() {
75 final fixed = new List(10); 93 final fixed = new List(10);
76 final growable = []; 94 final growable = [];
77 testImmutableVMFields(fixed, true); 95 testImmutableVMFields(fixed, true);
78 testImmutableVMFields(growable, false); 96 testImmutableVMFields(growable, false);
79 testImmutableVMFields(growable, false); 97 testImmutableVMFields(growable, false);
80 98
81 final f64List = new Float64List(2); 99 final f64List = new Float64List(2);
82 testPhiRepresentation(true, f64List); 100 testPhiRepresentation(true, f64List);
83 testPhiRepresentation(false, f64List); 101 testPhiRepresentation(false, f64List);
84 102
85 for (var i = 0; i < 2000; i++) { 103 for (var i = 0; i < 2000; i++) {
86 Expect.listEquals([0x02010000, 0x03020100], foo(new A(0, 0))); 104 Expect.listEquals([0x02010000, 0x03020100], foo(new A(0, 0)));
87 Expect.listEquals([0x02010000, 0x03020100], bar(new A(0, 0), false)); 105 Expect.listEquals([0x02010000, 0x03020100], bar(new A(0, 0), false));
88 Expect.listEquals([0x04020000, 0x03020100], bar(new A(0, 0), true)); 106 Expect.listEquals([0x04020000, 0x03020100], bar(new A(0, 0), true));
89 testImmutableVMFields(fixed, true); 107 testImmutableVMFields(fixed, true);
90 testPhiRepresentation(true, f64List); 108 testPhiRepresentation(true, f64List);
91 } 109 }
92 110
93 Expect.equals(1, testImmutableVMFields([], false)); 111 Expect.equals(1, testImmutableVMFields([], false));
94 Expect.equals(2, testImmutableVMFields([1], false)); 112 Expect.equals(2, testImmutableVMFields([1], false));
95 Expect.equals(2, testImmutableVMFields([1, 2], false)); 113 Expect.equals(2, testImmutableVMFields([1, 2], false));
96 Expect.equals(3, testImmutableVMFields([1, 2, 3], false)); 114 Expect.equals(3, testImmutableVMFields([1, 2, 3], false));
97 115
98 final u32List = new Uint32List(3); 116 final u32List = new Uint32List(3);
99 u32List[0] = 0; 117 u32List[0] = 0;
100 u32List[1] = 0x3FFFFFFF; 118 u32List[1] = 0x3FFFFFFF;
101 u32List[2] = 0x7FFFFFFF; 119 u32List[2] = 0x7FFFFFFF;
102 120
103 for (var i = 0; i < 4000; i++) { 121 for (var i = 0; i < 4000; i++) {
104 testPhiConvertions(true, u32List); 122 testPhiConvertions(true, u32List);
105 testPhiConvertions(false, u32List); 123 testPhiConvertions(false, u32List);
106 } 124 }
125
126 final escape = new List(1);
127 for (var i = 0; i < 10000; i++) {
128 fakeAliasing(escape);
129 }
107 } 130 }
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698