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

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

Issue 17101028: Refactor load forwarding pass to use a Place abstraction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 #include "vm/parser.h" 9 #include "vm/parser.h"
10 10
(...skipping 19 matching lines...) Expand all
30 position_ += (available <= written) ? available : written; 30 position_ += (available <= written) ? available : written;
31 } 31 }
32 } 32 }
33 33
34 34
35 void FlowGraphPrinter::PrintGraph(const char* phase, FlowGraph* flow_graph) { 35 void FlowGraphPrinter::PrintGraph(const char* phase, FlowGraph* flow_graph) {
36 OS::Print("*** BEGIN CFG\n%s\n", phase); 36 OS::Print("*** BEGIN CFG\n%s\n", phase);
37 FlowGraphPrinter printer(*flow_graph); 37 FlowGraphPrinter printer(*flow_graph);
38 printer.PrintBlocks(); 38 printer.PrintBlocks();
39 OS::Print("*** END CFG\n"); 39 OS::Print("*** END CFG\n");
40 fflush(stdout);
40 } 41 }
41 42
42 43
43 void FlowGraphPrinter::PrintBlock(BlockEntryInstr* block, 44 void FlowGraphPrinter::PrintBlock(BlockEntryInstr* block,
44 bool print_locations) { 45 bool print_locations) {
45 // Print the block entry. 46 // Print the block entry.
46 PrintOneInstruction(block, print_locations); 47 PrintOneInstruction(block, print_locations);
47 OS::Print("\n"); 48 OS::Print("\n");
48 // And all the successors in the block. 49 // And all the successors in the block.
49 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { 50 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 125
125 126
126 const char* CompileType::ToCString() const { 127 const char* CompileType::ToCString() const {
127 char buffer[1024]; 128 char buffer[1024];
128 BufferFormatter f(buffer, sizeof(buffer)); 129 BufferFormatter f(buffer, sizeof(buffer));
129 PrintTo(&f); 130 PrintTo(&f);
130 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); 131 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer);
131 } 132 }
132 133
133 134
134
135
136 static void PrintICData(BufferFormatter* f, const ICData& ic_data) { 135 static void PrintICData(BufferFormatter* f, const ICData& ic_data) {
137 f->Print(" IC[%"Pd": ", ic_data.NumberOfChecks()); 136 f->Print(" IC[%"Pd": ", ic_data.NumberOfChecks());
138 Function& target = Function::Handle(); 137 Function& target = Function::Handle();
139 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { 138 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) {
140 GrowableArray<intptr_t> class_ids; 139 GrowableArray<intptr_t> class_ids;
141 ic_data.GetCheckAt(i, &class_ids, &target); 140 ic_data.GetCheckAt(i, &class_ids, &target);
142 const intptr_t count = ic_data.GetCountAt(i); 141 const intptr_t count = ic_data.GetCountAt(i);
143 if (i > 0) { 142 if (i > 0) {
144 f->Print(" | "); 143 f->Print(" | ");
145 } 144 }
(...skipping 18 matching lines...) Expand all
164 if (definition.is_used()) { 163 if (definition.is_used()) {
165 if (definition.HasSSATemp()) { 164 if (definition.HasSSATemp()) {
166 f->Print("v%"Pd, definition.ssa_temp_index()); 165 f->Print("v%"Pd, definition.ssa_temp_index());
167 } else if (definition.temp_index() != -1) { 166 } else if (definition.temp_index() != -1) {
168 f->Print("t%"Pd, definition.temp_index()); 167 f->Print("t%"Pd, definition.temp_index());
169 } 168 }
170 } 169 }
171 } 170 }
172 171
173 172
173 const char* Instruction::ToCString() const {
174 char buffer[1024];
175 BufferFormatter f(buffer, sizeof(buffer));
176 PrintTo(&f);
177 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer);
178 }
179
180
174 void Instruction::PrintTo(BufferFormatter* f) const { 181 void Instruction::PrintTo(BufferFormatter* f) const {
175 if (GetDeoptId() != Isolate::kNoDeoptId) { 182 if (GetDeoptId() != Isolate::kNoDeoptId) {
176 f->Print("%s:%"Pd"(", DebugName(), GetDeoptId()); 183 f->Print("%s:%"Pd"(", DebugName(), GetDeoptId());
177 } else { 184 } else {
178 f->Print("%s(", DebugName()); 185 f->Print("%s(", DebugName());
179 } 186 }
180 PrintOperandsTo(f); 187 PrintOperandsTo(f);
181 f->Print(")"); 188 f->Print(")");
182 } 189 }
183 190
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 f->Print(" ["); 955 f->Print(" [");
949 locations_[i].PrintTo(f); 956 locations_[i].PrintTo(f);
950 f->Print("]"); 957 f->Print("]");
951 } 958 }
952 } 959 }
953 f->Print(" }"); 960 f->Print(" }");
954 if (outer_ != NULL) outer_->PrintTo(f); 961 if (outer_ != NULL) outer_->PrintTo(f);
955 } 962 }
956 963
957 } // namespace dart 964 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698