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

Unified Diff: tests/language/allocation_sinking_vm_test.dart

Issue 16799003: Support type arguments for allocation sinking in certain conditions. (Closed) Base URL: http://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 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 23902)
+++ tests/language/allocation_sinking_vm_test.dart (working copy)
@@ -87,6 +87,22 @@
foo2() => new PointP<int>(1, 3) * new PointP<num>(5, 6);
+class A<T> {
+ var x, y;
+}
+
+foo3(x) {
+ // Test materialization of type arguments.
+ var a = new A<int>();
+ a.x = x;
+ a.y = x;
+ if (x is int) return a.x + a.y;
+ Expect.isFalse(a is A<double>);
+ Expect.isTrue(a is A<int>);
+ Expect.isTrue(a is A);
+ return a.x - a.y;
+}
+
main() {
var c = new C(new Point(0.1, 0.2));
@@ -101,7 +117,9 @@
testForwardingThroughEffects(c, i.toDouble(), i.toDouble());
testIdentity(c.p);
foo2();
+ Expect.equals(10, foo3(5));
}
+ Expect.equals(0.0, foo3(0.5));
// Test returned value after optimization.
final x1 = test1(c, 11.11, 22.22);
@@ -129,4 +147,4 @@
final z2 = testIdentity(new F(c.p));
Expect.equals(z0, z1);
Expect.equals(z0, z2);
-}
+}
« 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