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

Side by Side Diff: vm/flow_graph_builder.cc

Issue 10446116: Add flow graph printing into a .cfg file with flag --print-flow-graph-file. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "vm/ast_printer.h" 7 #include "vm/ast_printer.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2294 variable_count); 2294 variable_count);
2295 // Number blocks in reverse postorder. 2295 // Number blocks in reverse postorder.
2296 intptr_t block_count = postorder_block_entries_.length(); 2296 intptr_t block_count = postorder_block_entries_.length();
2297 for (intptr_t i = 0; i < block_count; ++i) { 2297 for (intptr_t i = 0; i < block_count; ++i) {
2298 postorder_block_entries_[i]->set_block_id(block_count - i - 1); 2298 postorder_block_entries_[i]->set_block_id(block_count - i - 1);
2299 } 2299 }
2300 if (for_optimized) { 2300 if (for_optimized) {
2301 GrowableArray<BitVector*> dominance_frontier; 2301 GrowableArray<BitVector*> dominance_frontier;
2302 ComputeDominators(&preorder_block_entries_, &parent, &dominance_frontier); 2302 ComputeDominators(&preorder_block_entries_, &parent, &dominance_frontier);
2303 } 2303 }
2304 if (FLAG_print_flow_graph) { 2304 if (FLAG_print_flow_graph || (Dart::flow_graph_writer() != NULL)) {
2305 intptr_t length = postorder_block_entries_.length(); 2305 intptr_t length = postorder_block_entries_.length();
2306 GrowableArray<BlockEntryInstr*> reverse_postorder(length); 2306 GrowableArray<BlockEntryInstr*> reverse_postorder(length);
2307 for (intptr_t i = length - 1; i >= 0; --i) { 2307 for (intptr_t i = length - 1; i >= 0; --i) {
2308 reverse_postorder.Add(postorder_block_entries_[i]); 2308 reverse_postorder.Add(postorder_block_entries_[i]);
2309 } 2309 }
2310 FlowGraphPrinter printer(function, reverse_postorder); 2310 if (FLAG_print_flow_graph) {
2311 printer.PrintBlocks(); 2311 // Print flow graph to stdout.
2312 FlowGraphPrinter printer(function, reverse_postorder);
2313 printer.PrintBlocks();
2314 }
2315 if (Dart::flow_graph_writer() != NULL) {
2316 // Write flow graph to file.
2317 FlowGraphVisualizer printer(function, reverse_postorder);
siva 2012/06/04 18:23:57 Over here this appears to be a per isolate object
2318 printer.PrintFunction();
2319 }
2312 } 2320 }
2313 } 2321 }
2314 2322
2315 2323
2316 // Compute immediate dominators and the dominance frontier for each basic 2324 // Compute immediate dominators and the dominance frontier for each basic
2317 // block. As a side effect of the algorithm, sets the immediate dominator 2325 // block. As a side effect of the algorithm, sets the immediate dominator
2318 // of each basic block. 2326 // of each basic block.
2319 // 2327 //
2320 // preorder: an input list of basic block entries in preorder. The 2328 // preorder: an input list of basic block entries in preorder. The
2321 // algorithm relies on the block ordering. 2329 // algorithm relies on the block ordering.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 char* chars = reinterpret_cast<char*>( 2451 char* chars = reinterpret_cast<char*>(
2444 Isolate::Current()->current_zone()->Allocate(len)); 2452 Isolate::Current()->current_zone()->Allocate(len));
2445 OS::SNPrint(chars, len, kFormat, function_name, reason); 2453 OS::SNPrint(chars, len, kFormat, function_name, reason);
2446 const Error& error = Error::Handle( 2454 const Error& error = Error::Handle(
2447 LanguageError::New(String::Handle(String::New(chars)))); 2455 LanguageError::New(String::Handle(String::New(chars))));
2448 Isolate::Current()->long_jump_base()->Jump(1, error); 2456 Isolate::Current()->long_jump_base()->Jump(1, error);
2449 } 2457 }
2450 2458
2451 2459
2452 } // namespace dart 2460 } // namespace dart
OLDNEW
« vm/dart.h ('K') | « vm/dart_api_impl.cc ('k') | vm/il_printer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698