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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language.cc ('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 4
5 #include "vm/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 #include "vm/unit_test.h" 6 #include "vm/unit_test.h"
7 7
8 namespace dart { 8 namespace dart {
9 9
10 TEST_CASE(InstructionTests) { 10 TEST_CASE(InstructionTests) {
(...skipping 29 matching lines...) Expand all
40 bind->RemoveInputUses(); 40 bind->RemoveInputUses();
41 EXPECT(def1->use_list() == NULL); 41 EXPECT(def1->use_list() == NULL);
42 // Test replacing with a definition without uses. 42 // Test replacing with a definition without uses.
43 UseVal* use4 = new UseVal(def2); 43 UseVal* use4 = new UseVal(def2);
44 def2->ReplaceUsesWith(def1); 44 def2->ReplaceUsesWith(def1);
45 EXPECT(def1->use_list() == use4); 45 EXPECT(def1->use_list() == use4);
46 EXPECT(def2->use_list() == NULL); 46 EXPECT(def2->use_list() == NULL);
47 EXPECT(use4->definition() == def1); 47 EXPECT(use4->definition() == def1);
48 } 48 }
49 49
50 TEST_CASE(OptimizationTests) {
51 Definition* def1 = new PhiInstr(0);
52 Definition* def2 = new PhiInstr(0);
53 UseVal* use1a = new UseVal(def1);
54 UseVal* use1b = new UseVal(def1);
55 EXPECT(use1a->Equals(use1b));
56 EXPECT(use1a->Hashcode() == use1b->Hashcode());
57 UseVal* use2 = new UseVal(def2);
58 EXPECT(!use2->Equals(use1a));
59
60 ConstantVal* c1 = new ConstantVal(Bool::ZoneHandle(Bool::True()));
61 ConstantVal* c2 = new ConstantVal(Bool::ZoneHandle(Bool::True()));
62 EXPECT(c1->Equals(c2));
63 ConstantVal* c3 = new ConstantVal(Object::ZoneHandle());
64 ConstantVal* c4 = new ConstantVal(Object::ZoneHandle());
65 EXPECT(c3->Equals(c4));
66 EXPECT(!c3->Equals(c1));
67 }
68
50 } // namespace dart 69 } // namespace dart
OLDNEW
« 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