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

Side by Side Diff: vm/il_printer.cc

Issue 10692107: Add forward iterator to iterate instructions inside a basic block. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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/il_printer.h" 5 #include "vm/il_printer.h"
6 6
7 #include "vm/intermediate_language.h" 7 #include "vm/intermediate_language.h"
8 #include "vm/os.h" 8 #include "vm/os.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 21 matching lines...) Expand all
32 32
33 33
34 void FlowGraphPrinter::PrintBlocks() { 34 void FlowGraphPrinter::PrintBlocks() {
35 if (!function_.IsNull()) { 35 if (!function_.IsNull()) {
36 OS::Print("==== %s\n", function_.ToFullyQualifiedCString()); 36 OS::Print("==== %s\n", function_.ToFullyQualifiedCString());
37 } 37 }
38 38
39 for (intptr_t i = 0; i < block_order_.length(); ++i) { 39 for (intptr_t i = 0; i < block_order_.length(); ++i) {
40 // Print the block entry. 40 // Print the block entry.
41 PrintInstruction(block_order_[i]); 41 PrintInstruction(block_order_[i]);
42 Instruction* current = block_order_[i]->successor();
43 // And all the successors until an exit, branch, or a block entry. 42 // And all the successors until an exit, branch, or a block entry.
44 while ((current != NULL) && !current->IsBlockEntry()) { 43 ForwardInstructionIterator it(block_order_[i]);
Kevin Millikin (Google) 2012/07/06 11:58:42 I'm a bit uncomfortable with calling Current() on
Florian Schneider 2012/07/06 12:31:51 Done.
44 for (; !it.Done(); it.Advance()) {
45 Instruction* current = it.Current();
45 OS::Print("\n"); 46 OS::Print("\n");
46 PrintInstruction(current); 47 PrintInstruction(current);
47 current = current->successor();
48 } 48 }
49 BlockEntryInstr* successor = 49 BlockEntryInstr* successor =
50 (current == NULL) ? NULL : current->AsBlockEntry(); 50 (it.Current() == NULL) ? NULL : it.Current()->AsBlockEntry();
51 if (successor != NULL) { 51 if (successor != NULL) {
52 OS::Print(" goto %d", successor->block_id()); 52 OS::Print(" goto %d", successor->block_id());
53 } 53 }
54 OS::Print("\n"); 54 OS::Print("\n");
55 } 55 }
56 } 56 }
57 57
58 58
59 void FlowGraphPrinter::PrintInstruction(Instruction* instr) { 59 void FlowGraphPrinter::PrintInstruction(Instruction* instr) {
60 char str[1000]; 60 char str[1000];
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 void Environment::PrintTo(BufferFormatter* f) const { 664 void Environment::PrintTo(BufferFormatter* f) const {
665 f->Print(" env={ "); 665 f->Print(" env={ ");
666 for (intptr_t i = 0; i < values_.length(); ++i) { 666 for (intptr_t i = 0; i < values_.length(); ++i) {
667 if (i > 0) f->Print(", "); 667 if (i > 0) f->Print(", ");
668 values_[i]->PrintTo(f); 668 values_[i]->PrintTo(f);
669 } 669 }
670 f->Print(" }"); 670 f->Print(" }");
671 } 671 }
672 672
673 } // namespace dart 673 } // namespace dart
OLDNEW
« no previous file with comments | « vm/flow_graph_builder.cc ('k') | vm/intermediate_language.h » ('j') | vm/intermediate_language.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698