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

Unified Diff: runtime/vm/intermediate_language_test.cc

Issue 10828414: Fix a bug in Equals for UseVal and ConstantVal. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_test.cc
===================================================================
--- runtime/vm/intermediate_language_test.cc (revision 11030)
+++ runtime/vm/intermediate_language_test.cc (working copy)
@@ -47,4 +47,23 @@
EXPECT(use4->definition() == def1);
}
+TEST_CASE(OptimizationTests) {
+ Definition* def1 = new PhiInstr(0);
+ Definition* def2 = new PhiInstr(0);
+ UseVal* use1a = new UseVal(def1);
+ UseVal* use1b = new UseVal(def1);
+ EXPECT(use1a->Equals(use1b));
+ EXPECT(use1a->Hashcode() == use1b->Hashcode());
+ UseVal* use2 = new UseVal(def2);
+ EXPECT(!use2->Equals(use1a));
+
+ ConstantVal* c1 = new ConstantVal(Bool::ZoneHandle(Bool::True()));
+ ConstantVal* c2 = new ConstantVal(Bool::ZoneHandle(Bool::True()));
+ EXPECT(c1->Equals(c2));
+ ConstantVal* c3 = new ConstantVal(Object::ZoneHandle());
+ ConstantVal* c4 = new ConstantVal(Object::ZoneHandle());
+ EXPECT(c3->Equals(c4));
+ EXPECT(!c3->Equals(c1));
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698