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

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

Issue 868283002: Fix LoadOptimizer's handling of load/stores with constant indices for TypedData. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
« runtime/vm/flow_graph_optimizer.cc ('K') | « runtime/vm/locations.h ('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 // 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 479
480 testAliasesRefinement() { 480 testAliasesRefinement() {
481 zz = new ZZ(); 481 zz = new ZZ();
482 var b = zz; 482 var b = zz;
483 if (b.f == null) { 483 if (b.f == null) {
484 b.f = f0; 484 b.f = f0;
485 } 485 }
486 return b.f; 486 return b.f;
487 } 487 }
488 488
489 testViewAliasing1() {
490 final f64 = new Float64List(1);
491 final f32 = new Float32List.view(f64.buffer);
492 f64[0] = 1.0; // lower 32bits are all 0s
Florian Schneider 2015/01/26 13:30:39 Comment: Should not be forwarded.
Vyacheslav Egorov (Google) 2015/01/26 14:57:16 Done.
493 f32[1] = 2.0; // upper 32bits for 2.0f and 2.0 are the same
494 return f64[0];
495 }
496
497 testViewAliasing2() {
498 final f64 = new Float64List(2);
499 final f64v = new Float64List.view(f64.buffer, Float64List.BYTES_PER_ELEMENT);
500 f64[1] = 1.0;
Florian Schneider 2015/01/26 13:30:39 Comment: Should be forwarded.
Vyacheslav Egorov (Google) 2015/01/26 14:57:16 Should *not* be forwarded.
501 f64v[0] = 2.0;
502 return f64[1];
503 }
504
505 testViewAliasing3() {
506 final u8 = new Uint8List(Float64List.BYTES_PER_ELEMENT * 2);
507 final f64 = new Float64List.view(u8.buffer, Float64List.BYTES_PER_ELEMENT);
508 f64[0] = 1.0;
Florian Schneider 2015/01/26 13:30:39 Comment: Should be forwarded, [0,7] and [14], [15]
Vyacheslav Egorov (Google) 2015/01/26 14:57:16 note: view starts at 8 - means f64[0] is bytes 8-1
509 u8[15] = 0x40;
510 u8[14] = 0x00;
511 return f64[0];
512 }
513
514 testViewAliasing4() {
515 final u8 = new Uint8List(Float64List.BYTES_PER_ELEMENT * 2);
516 final f64 = new Float64List.view(u8.buffer, Float64List.BYTES_PER_ELEMENT);
517 f64[0] = 2.0; // Not aliased: should be forwarded.
Florian Schneider 2015/01/26 13:30:39 This should not be forwarded, since f64[0] writes
Vyacheslav Egorov (Google) 2015/01/26 14:57:16 note: view starts at 8 like about. should *be* for
518 u8[0] = 0x40;
519 u8[1] = 0x00;
520 return f64[0];
521 }
522
489 main() { 523 main() {
490 final fixed = new List(10); 524 final fixed = new List(10);
491 final growable = []; 525 final growable = [];
492 testImmutableVMFields(fixed, true); 526 testImmutableVMFields(fixed, true);
493 testImmutableVMFields(growable, false); 527 testImmutableVMFields(growable, false);
494 testImmutableVMFields(growable, false); 528 testImmutableVMFields(growable, false);
495 529
496 final f64List = new Float64List(2); 530 final f64List = new Float64List(2);
497 testPhiRepresentation(true, f64List); 531 testPhiRepresentation(true, f64List);
498 testPhiRepresentation(false, f64List); 532 testPhiRepresentation(false, f64List);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 for (var i = 0; i < 20; i++) { 579 for (var i = 0; i < 20; i++) {
546 Expect.equals(3, testIndexedNoAlias(array)); 580 Expect.equals(3, testIndexedNoAlias(array));
547 } 581 }
548 582
549 testIndexedAliasedStores(); 583 testIndexedAliasedStores();
550 584
551 var test_array = new List(1); 585 var test_array = new List(1);
552 for (var i = 0; i < 20; i++) { 586 for (var i = 0; i < 20; i++) {
553 Expect.equals(43, testAliasingStoreIndexed(global_array)); 587 Expect.equals(43, testAliasingStoreIndexed(global_array));
554 } 588 }
589
590 for (var i = 0; i < 20; i++) {
591 Expect.equals(2.0, testViewAliasing1());
592 Expect.equals(2.0, testViewAliasing2());
593 Expect.equals(2.0, testViewAliasing3());
594 Expect.equals(2.0, testViewAliasing4());
595 }
555 } 596 }
OLDNEW
« runtime/vm/flow_graph_optimizer.cc ('K') | « runtime/vm/locations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698