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

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

Issue 145133009: Improve aliasing info for load elimination of array loads. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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
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 // VMOptions=--optimization-counter-threshold=10 6 // VMOptions=--optimization-counter-threshold=10
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import "dart:typed_data"; 9 import "dart:typed_data";
10 10
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 var v; 206 var v;
207 if (f) { 207 if (f) {
208 v = arr[0]; 208 v = arr[0];
209 } else { 209 } else {
210 v = arr[0]; 210 v = arr[0];
211 } 211 }
212 return v + w; 212 return v + w;
213 } 213 }
214 214
215 testIndexedNoAlias(a) {
216 a[0] = 1;
217 a[1] = 2;
218 a[2] = 3;
219 return a[0] + a[1];
220 }
221
222 testIndexedAliasedStore(a, b) {
223 a[0] = 1;
224 a[1] = 2;
225 if (a == b) {
226 b[0] = 3;
227 }
228 return a[0] + a[1];
229 }
230
231 testIndexedAliasedStore1(a, b) {
232 a[0] = 1;
233 a[1] = 2;
234 if (a == b) {
235 b[0] = 3;
236 }
237 return a[0] + a[1];
238 }
239
240 testIndexedAliasedStore2(a, b, i) {
241 a[0] = 1;
242 a[1] = 2;
243 if (a == b) {
244 b[i] = 3;
245 }
246 return a[0] + a[1];
247 }
248 var indices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
215 249
216 main() { 250 main() {
217 final fixed = new List(10); 251 final fixed = new List(10);
218 final growable = []; 252 final growable = [];
219 testImmutableVMFields(fixed, true); 253 testImmutableVMFields(fixed, true);
220 testImmutableVMFields(growable, false); 254 testImmutableVMFields(growable, false);
221 testImmutableVMFields(growable, false); 255 testImmutableVMFields(growable, false);
222 256
223 final f64List = new Float64List(2); 257 final f64List = new Float64List(2);
224 testPhiRepresentation(true, f64List); 258 testPhiRepresentation(true, f64List);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 290
257 for (var i = 0; i < 20; i++) { 291 for (var i = 0; i < 20; i++) {
258 Expect.equals(0.0, testPhiMultipleRepresentations(true, f64List)); 292 Expect.equals(0.0, testPhiMultipleRepresentations(true, f64List));
259 Expect.equals(0, testPhiMultipleRepresentations(false, const [1,2])); 293 Expect.equals(0, testPhiMultipleRepresentations(false, const [1,2]));
260 } 294 }
261 295
262 final escape = new List(1); 296 final escape = new List(1);
263 for (var i = 0; i < 20; i++) { 297 for (var i = 0; i < 20; i++) {
264 fakeAliasing(escape); 298 fakeAliasing(escape);
265 } 299 }
300
301 final array = new List(3);
302 for (var i = 0; i < 20; i++) {
303 Expect.equals(3, testIndexedNoAlias(array));
304 }
305 for (var i = 0; i < 20; i++) {
306 Expect.equals(5, testIndexedAliasedStore1(array, array));
307 }
308 for (var i = 0; i < 20; i++) {
309 Expect.equals(4, testIndexedAliasedStore2(array, array, indices[1]));
310 }
266 } 311 }
OLDNEW
« runtime/vm/flow_graph_optimizer.cc ('K') | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698