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

Side by Side Diff: runtime/vm/intermediate_language.cc

Issue 9454012: Add type testing and casting support. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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
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 6
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/os.h" 8 #include "vm/os.h"
9 #include "vm/scopes.h" 9 #include "vm/scopes.h"
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 Instruction* ReturnInstr::Print() const { 77 Instruction* ReturnInstr::Print() const {
78 OS::Print(" return "); 78 OS::Print(" return ");
79 value_->Print(); 79 value_->Print();
80 return NULL; 80 return NULL;
81 } 81 }
82 82
83 83
84 Instruction* BranchInstr::Print() const { 84 Instruction* BranchInstr::Print() const {
85 OS::Print(" if "); 85 OS::Print(" if ");
86 value_->Print(); 86 value_->Print();
87 OS::Print(" goto(%d, %d)", true_successor_->GetBlockNumber(), 87 OS::Print(" goto(%d, %d)", true_successor_->block_number(),
88 false_successor_->GetBlockNumber()); 88 false_successor_->block_number());
89 return NULL; 89 return NULL;
90 } 90 }
91 91
92 92
93 Instruction* JoinEntryInstr::Print() const { 93 Instruction* JoinEntryInstr::Print() const {
94 OS::Print("%2d: [join]", block_number_); 94 OS::Print("%2d: [join]", block_number());
95 return successor_; 95 return successor_;
96 } 96 }
97 97
98 98
99 Instruction* TargetEntryInstr::Print() const { 99 Instruction* TargetEntryInstr::Print() const {
100 OS::Print("%2d: [target]", block_number_); 100 OS::Print("%2d: [target]", block_number_);
101 return successor_; 101 return successor_;
102 } 102 }
103 103
104 104
105 void DoInstr::Postorder(GrowableArray<Instruction*>* block_entries) { 105 void DoInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) {
106 flip_mark(); 106 flip_mark();
107 if (successor_->mark() != mark()) successor_->Postorder(block_entries); 107 if (successor_->mark() != mark()) successor_->Postorder(block_entries);
108 } 108 }
109 109
110 110
111 void BindInstr::Postorder(GrowableArray<Instruction*>* block_entries) { 111 void BindInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) {
112 flip_mark(); 112 flip_mark();
113 if (successor_->mark() != mark()) successor_->Postorder(block_entries); 113 if (successor_->mark() != mark()) successor_->Postorder(block_entries);
114 } 114 }
115 115
116 116
117 void ReturnInstr::Postorder(GrowableArray<Instruction*>* block_entries) { 117 void ReturnInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) {
118 flip_mark(); 118 flip_mark();
119 } 119 }
120 120
121 121
122 void BranchInstr::Postorder(GrowableArray<Instruction*>* block_entries) { 122 void BranchInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) {
123 flip_mark(); 123 flip_mark();
124 // Visit the false successor before the true successor so they appear in 124 // Visit the false successor before the true successor so they appear in
125 // true/false order in reverse postorder. 125 // true/false order in reverse postorder.
126 if (false_successor_->mark() != mark()) { 126 if (false_successor_->mark() != mark()) {
127 false_successor_->Postorder(block_entries); 127 false_successor_->Postorder(block_entries);
128 } 128 }
129 if (true_successor_->mark() != mark()) { 129 if (true_successor_->mark() != mark()) {
130 true_successor_->Postorder(block_entries); 130 true_successor_->Postorder(block_entries);
131 } 131 }
132 } 132 }
133 133
134 134
135 void JoinEntryInstr::Postorder(GrowableArray<Instruction*>* block_entries) { 135 void JoinEntryInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) {
136 flip_mark(); 136 flip_mark();
137 if (successor_->mark() != mark()) successor_->Postorder(block_entries); 137 if (successor_->mark() != mark()) successor_->Postorder(block_entries);
138 block_entries->Add(this); 138 block_entries->Add(this);
139 } 139 }
140 140
141 141
142 void TargetEntryInstr::Postorder(GrowableArray<Instruction*>* block_entries) { 142 void TargetEntryInstr::Postorder(
143 GrowableArray<BlockEntryInstr*>* block_entries) {
143 flip_mark(); 144 flip_mark();
144 if (successor_->mark() != mark()) successor_->Postorder(block_entries); 145 if (successor_->mark() != mark()) successor_->Postorder(block_entries);
145 block_entries->Add(this); 146 block_entries->Add(this);
146 } 147 }
147 148
148 149
149 } // namespace dart 150 } // namespace dart
OLDNEW
« runtime/vm/intermediate_language.h ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698