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

Side by Side Diff: vm/intermediate_language.cc

Issue 10407031: Add IR printing into a supplied buffer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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
« vm/il_printer.h ('K') | « vm/intermediate_language.h ('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 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/flow_graph_builder.h"
8 #include "vm/object.h" 9 #include "vm/object.h"
9 #include "vm/os.h" 10 #include "vm/os.h"
10 #include "vm/scopes.h" 11 #include "vm/scopes.h"
11 12
12 namespace dart { 13 namespace dart {
13 14
14 // ==== Support for visiting flow graphs. 15 // ==== Support for visiting flow graphs.
15 #define DEFINE_ACCEPT(ShortName, ClassName) \ 16 #define DEFINE_ACCEPT(ShortName, ClassName) \
16 void ClassName::Accept(FlowGraphVisitor* visitor) { \ 17 void ClassName::Accept(FlowGraphVisitor* visitor) { \
17 visitor->Visit##ShortName(this); \ 18 visitor->Visit##ShortName(this); \
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 set_preorder_number(0); 188 set_preorder_number(0);
188 preorder->Add(this); 189 preorder->Add(this);
189 BitVector* vars = 190 BitVector* vars =
190 (variable_count == 0) ? NULL : new BitVector(variable_count); 191 (variable_count == 0) ? NULL : new BitVector(variable_count);
191 assigned_vars->Add(vars); 192 assigned_vars->Add(vars);
192 193
193 // Iteratively traverse all successors. In the unoptimized code, we will 194 // Iteratively traverse all successors. In the unoptimized code, we will
194 // enter the function at the first successor in reverse postorder, so we 195 // enter the function at the first successor in reverse postorder, so we
195 // must visit the normal entry last. 196 // must visit the normal entry last.
196 for (intptr_t i = catch_entries_.length() - 1; i >= 0; --i) { 197 for (intptr_t i = catch_entries_.length() - 1; i >= 0; --i) {
197 catch_entries_[i]->DiscoverBlocks(this, preorder, postorder, parent, 198 catch_entries_[i]->DiscoverBlocks(this, preorder, postorder,
198 assigned_vars, variable_count); 199 parent, assigned_vars, variable_count);
199 } 200 }
200 normal_entry_->DiscoverBlocks(this, preorder, postorder, parent, 201 normal_entry_->DiscoverBlocks(this, preorder, postorder,
201 assigned_vars, variable_count); 202 parent, assigned_vars, variable_count);
202 203
203 // Assign postorder number. 204 // Assign postorder number.
204 set_postorder_number(postorder->length()); 205 set_postorder_number(postorder->length());
205 postorder->Add(this); 206 postorder->Add(this);
206 } 207 }
207 208
208 209
209 // Base class implementation used for JoinEntry and TargetEntry. 210 // Base class implementation used for JoinEntry and TargetEntry.
210 void BlockEntryInstr::DiscoverBlocks( 211 void BlockEntryInstr::DiscoverBlocks(
211 BlockEntryInstr* current_block, 212 BlockEntryInstr* current_block,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 if (next->IsBlockEntry()) { 252 if (next->IsBlockEntry()) {
252 set_last_instruction(this); 253 set_last_instruction(this);
253 } else { 254 } else {
254 while ((next != NULL) && !next->IsBlockEntry() && !next->IsBranch()) { 255 while ((next != NULL) && !next->IsBlockEntry() && !next->IsBranch()) {
255 if (vars != NULL) next->RecordAssignedVars(vars); 256 if (vars != NULL) next->RecordAssignedVars(vars);
256 set_last_instruction(next); 257 set_last_instruction(next);
257 next = next->StraightLineSuccessor(); 258 next = next->StraightLineSuccessor();
258 } 259 }
259 } 260 }
260 if (next != NULL) { 261 if (next != NULL) {
261 next->DiscoverBlocks(this, preorder, postorder, parent, assigned_vars, 262 next->DiscoverBlocks(this, preorder, postorder,
262 variable_count); 263 parent, assigned_vars, variable_count);
263 } 264 }
264 265
265 // 6. Assign postorder number and add the block entry to the list. 266 // 6. Assign postorder number and add the block entry to the list.
266 set_postorder_number(postorder->length()); 267 set_postorder_number(postorder->length());
267 postorder->Add(this); 268 postorder->Add(this);
268 } 269 }
269 270
270 271
271 void BranchInstr::DiscoverBlocks( 272 void BranchInstr::DiscoverBlocks(
272 BlockEntryInstr* current_block, 273 BlockEntryInstr* current_block,
273 GrowableArray<BlockEntryInstr*>* preorder, 274 GrowableArray<BlockEntryInstr*>* preorder,
274 GrowableArray<BlockEntryInstr*>* postorder, 275 GrowableArray<BlockEntryInstr*>* postorder,
275 GrowableArray<intptr_t>* parent, 276 GrowableArray<intptr_t>* parent,
276 GrowableArray<BitVector*>* assigned_vars, 277 GrowableArray<BitVector*>* assigned_vars,
277 intptr_t variable_count) { 278 intptr_t variable_count) {
278 current_block->set_last_instruction(this); 279 current_block->set_last_instruction(this);
279 // Visit the false successor before the true successor so they appear in 280 // Visit the false successor before the true successor so they appear in
280 // true/false order in reverse postorder used as the block ordering in the 281 // true/false order in reverse postorder used as the block ordering in the
281 // nonoptimizing compiler. 282 // nonoptimizing compiler.
282 ASSERT(true_successor_ != NULL); 283 ASSERT(true_successor_ != NULL);
283 ASSERT(false_successor_ != NULL); 284 ASSERT(false_successor_ != NULL);
284 false_successor_->DiscoverBlocks(current_block, preorder, postorder, parent, 285 false_successor_->DiscoverBlocks(current_block, preorder, postorder,
285 assigned_vars, variable_count); 286 parent, assigned_vars, variable_count);
286 true_successor_->DiscoverBlocks(current_block, preorder, postorder, parent, 287 true_successor_->DiscoverBlocks(current_block, preorder, postorder,
287 assigned_vars, variable_count); 288 parent, assigned_vars, variable_count);
288 } 289 }
289 290
290 291
291 // ==== Support for propagating static type. 292 // ==== Support for propagating static type.
292 RawAbstractType* ConstantVal::StaticType() const { 293 RawAbstractType* ConstantVal::StaticType() const {
293 if (value().IsInstance()) { 294 if (value().IsInstance()) {
294 Instance& instance = Instance::Handle(); 295 Instance& instance = Instance::Handle();
295 instance ^= value().raw(); 296 instance ^= value().raw();
296 return instance.GetType(); 297 return instance.GetType();
297 } else { 298 } else {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 } 542 }
542 543
543 544
544 RawAbstractType* CatchEntryComp::StaticType() const { 545 RawAbstractType* CatchEntryComp::StaticType() const {
545 UNREACHABLE(); 546 UNREACHABLE();
546 return AbstractType::null(); 547 return AbstractType::null();
547 } 548 }
548 549
549 550
550 } // namespace dart 551 } // namespace dart
OLDNEW
« vm/il_printer.h ('K') | « vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698