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

Side by Side Diff: vm/flow_graph_builder.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
« no previous file with comments | « no previous file | vm/flow_graph_compiler_x64.h » ('j') | vm/il_printer.h » ('J')
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/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 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 parsed_function_.copied_parameter_count() + 2158 parsed_function_.copied_parameter_count() +
2159 parsed_function_.stack_local_count(); 2159 parsed_function_.stack_local_count();
2160 // Perform a depth-first traversal of the graph to build preorder and 2160 // Perform a depth-first traversal of the graph to build preorder and
2161 // postorder block orders. 2161 // postorder block orders.
2162 graph_entry_->DiscoverBlocks(NULL, // Entry block predecessor. 2162 graph_entry_->DiscoverBlocks(NULL, // Entry block predecessor.
2163 &preorder_block_entries_, 2163 &preorder_block_entries_,
2164 &postorder_block_entries_, 2164 &postorder_block_entries_,
2165 &parent, 2165 &parent,
2166 &assigned_vars, 2166 &assigned_vars,
2167 variable_count); 2167 variable_count);
2168 // Number blocks in reverse postorder.
2169 intptr_t block_count = postorder_block_entries_.length();
2170 for (intptr_t i = 0; i < block_count; ++i) {
2171 postorder_block_entries_[i]->set_block_id(block_count - i - 1);
2172 }
2168 if (for_optimized) { 2173 if (for_optimized) {
2169 GrowableArray<BitVector*> dominance_frontier; 2174 GrowableArray<BitVector*> dominance_frontier;
2170 ComputeDominators(&preorder_block_entries_, &parent, &dominance_frontier); 2175 ComputeDominators(&preorder_block_entries_, &parent, &dominance_frontier);
2171 } 2176 }
2172 isolate->set_computation_id(prev_cid); 2177 isolate->set_computation_id(prev_cid);
2173 if (FLAG_print_flow_graph) { 2178 if (FLAG_print_flow_graph) {
2174 intptr_t length = postorder_block_entries_.length(); 2179 intptr_t length = postorder_block_entries_.length();
2175 GrowableArray<BlockEntryInstr*> reverse_postorder(length); 2180 GrowableArray<BlockEntryInstr*> reverse_postorder(length);
2176 for (intptr_t i = length - 1; i >= 0; --i) { 2181 for (intptr_t i = length - 1; i >= 0; --i) {
2177 reverse_postorder.Add(postorder_block_entries_[i]); 2182 reverse_postorder.Add(postorder_block_entries_[i]);
2178 } 2183 }
2179 FlowGraphPrinter printer(function, reverse_postorder); 2184 FlowGraphPrinter printer(function, reverse_postorder);
2180 printer.VisitBlocks(); 2185 printer.PrintBlocks();
2181 } 2186 }
2182 } 2187 }
2183 2188
2184 2189
2185 // Compute immediate dominators and the dominance frontier for each basic 2190 // Compute immediate dominators and the dominance frontier for each basic
2186 // block. As a side effect of the algorithm, sets the immediate dominator 2191 // block. As a side effect of the algorithm, sets the immediate dominator
2187 // of each basic block. 2192 // of each basic block.
2188 // 2193 //
2189 // preorder: an input list of basic block entries in preorder. The 2194 // preorder: an input list of basic block entries in preorder. The
2190 // algorithm relies on the block ordering. 2195 // algorithm relies on the block ordering.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 char* chars = reinterpret_cast<char*>( 2317 char* chars = reinterpret_cast<char*>(
2313 Isolate::Current()->current_zone()->Allocate(len)); 2318 Isolate::Current()->current_zone()->Allocate(len));
2314 OS::SNPrint(chars, len, kFormat, function_name, reason); 2319 OS::SNPrint(chars, len, kFormat, function_name, reason);
2315 const Error& error = Error::Handle( 2320 const Error& error = Error::Handle(
2316 LanguageError::New(String::Handle(String::New(chars)))); 2321 LanguageError::New(String::Handle(String::New(chars))));
2317 Isolate::Current()->long_jump_base()->Jump(1, error); 2322 Isolate::Current()->long_jump_base()->Jump(1, error);
2318 } 2323 }
2319 2324
2320 2325
2321 } // namespace dart 2326 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | vm/flow_graph_compiler_x64.h » ('j') | vm/il_printer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698