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

Unified Diff: tests/language/allocation_sinking_vm_test.dart

Issue 18055004: Fix a bug in allocation sinking and load elimination. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: improved unit test 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 side-by-side diff with in-line comments
Download patch
« runtime/vm/flow_graph_optimizer.cc ('K') | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/allocation_sinking_vm_test.dart
===================================================================
--- tests/language/allocation_sinking_vm_test.dart (revision 24512)
+++ tests/language/allocation_sinking_vm_test.dart (working copy)
@@ -103,6 +103,41 @@
return a.x - a.y;
}
+class WithFinal {
+ final _x;
+ WithFinal(this._x);
+}
+
+testInitialValueForFinalField(x) {
+ new WithFinal(x);
+}
+
+testFinalField() {
+ for (var i = 0; i < 10000; i++) {
+ testInitialValueForFinalField(1);
+ }
+}
+
+class V {
+ var x = 0;
+}
+
+test_vm_field() {
+ var obj;
+ inner() => obj.x = 42;
+ var a = new V();
+ obj = a;
+ var t1 = a.x;
+ var t2 = inner();
+ return a.x + t1 + t2;
+}
+
+testVMField() {
+ Expect.equals(84, test_vm_field());
+ for (var i=0; i<15000; i++) test_vm_field();
+ Expect.equals(84, test_vm_field());
+}
+
main() {
var c = new C(new Point(0.1, 0.2));
@@ -147,4 +182,7 @@
final z2 = testIdentity(new F(c.p));
Expect.equals(z0, z1);
Expect.equals(z0, z2);
+
+ testFinalField();
+ testVMField();
}
« 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