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

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

Issue 12321111: Add machine readable markers around code and flow graph output printed for --print-flow-graph and -… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | 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/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/code_generator.h" 10 #include "vm/code_generator.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 Code::Handle(function.CurrentCode()).EntryPoint()); 105 Code::Handle(function.CurrentCode()).EntryPoint());
106 } 106 }
107 function.SwitchToUnoptimizedCode(); 107 function.SwitchToUnoptimizedCode();
108 if (FLAG_trace_compiler) { 108 if (FLAG_trace_compiler) {
109 OS::Print("--> restoring entry at %#"Px"\n", 109 OS::Print("--> restoring entry at %#"Px"\n",
110 Code::Handle(function.unoptimized_code()).EntryPoint()); 110 Code::Handle(function.unoptimized_code()).EntryPoint());
111 } 111 }
112 } 112 }
113 113
114 114
115 static void PrintGraph(const char* phase, FlowGraph* flow_graph) {
116 OS::Print("*** BEGIN CFG\n%s\n", phase);
117 FlowGraphPrinter printer(*flow_graph);
118 printer.PrintBlocks();
119 OS::Print("*** END CFG\n");
120 }
121
122
115 // Return false if bailed out. 123 // Return false if bailed out.
116 static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function, 124 static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
117 bool optimized) { 125 bool optimized) {
118 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); 126 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer);
119 bool is_compiled = false; 127 bool is_compiled = false;
120 Isolate* isolate = Isolate::Current(); 128 Isolate* isolate = Isolate::Current();
121 HANDLESCOPE(isolate); 129 HANDLESCOPE(isolate);
122 ASSERT(isolate->ic_data_array() == Array::null()); // Must be reset to null. 130 ASSERT(isolate->ic_data_array() == Array::null()); // Must be reset to null.
123 const intptr_t prev_deopt_id = isolate->deopt_id(); 131 const intptr_t prev_deopt_id = isolate->deopt_id();
124 isolate->set_deopt_id(0); 132 isolate->set_deopt_id(0);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 TimerScope timer(FLAG_compiler_stats, 165 TimerScope timer(FLAG_compiler_stats,
158 &CompilerStats::ssa_timer, 166 &CompilerStats::ssa_timer,
159 isolate); 167 isolate);
160 // Transform to SSA (virtual register 0 and no inlining arguments). 168 // Transform to SSA (virtual register 0 and no inlining arguments).
161 flow_graph->ComputeSSA(0, NULL); 169 flow_graph->ComputeSSA(0, NULL);
162 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 170 DEBUG_ASSERT(flow_graph->VerifyUseLists());
163 } 171 }
164 172
165 if (FLAG_print_flow_graph || 173 if (FLAG_print_flow_graph ||
166 (optimized && FLAG_print_flow_graph_optimized)) { 174 (optimized && FLAG_print_flow_graph_optimized)) {
167 OS::Print("Before Optimizations\n"); 175 PrintGraph("Before Optimizations", flow_graph);
168 FlowGraphPrinter printer(*flow_graph);
169 printer.PrintBlocks();
170 } 176 }
171 177
172 if (optimized) { 178 if (optimized) {
173 TimerScope timer(FLAG_compiler_stats, 179 TimerScope timer(FLAG_compiler_stats,
174 &CompilerStats::graphoptimizer_timer, 180 &CompilerStats::graphoptimizer_timer,
175 isolate); 181 isolate);
176 182
177 FlowGraphOptimizer optimizer(flow_graph); 183 FlowGraphOptimizer optimizer(flow_graph);
178 optimizer.ApplyICData(); 184 optimizer.ApplyICData();
179 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 185 DEBUG_ASSERT(flow_graph->VerifyUseLists());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 256
251 // The final canonicalization pass before the code generation. 257 // The final canonicalization pass before the code generation.
252 optimizer.Canonicalize(); 258 optimizer.Canonicalize();
253 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 259 DEBUG_ASSERT(flow_graph->VerifyUseLists());
254 260
255 // Perform register allocation on the SSA graph. 261 // Perform register allocation on the SSA graph.
256 FlowGraphAllocator allocator(*flow_graph); 262 FlowGraphAllocator allocator(*flow_graph);
257 allocator.AllocateRegisters(); 263 allocator.AllocateRegisters();
258 264
259 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) { 265 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) {
260 OS::Print("After Optimizations:\n"); 266 PrintGraph("After Optimizations", flow_graph);
261 FlowGraphPrinter printer(*flow_graph);
262 printer.PrintBlocks();
263 } 267 }
264 } 268 }
265 269
266 Assembler assembler; 270 Assembler assembler;
267 FlowGraphCompiler graph_compiler(&assembler, 271 FlowGraphCompiler graph_compiler(&assembler,
268 *flow_graph, 272 *flow_graph,
269 optimized); 273 optimized);
270 { 274 {
271 TimerScope timer(FLAG_compiler_stats, 275 TimerScope timer(FLAG_compiler_stats,
272 &CompilerStats::graphcompiler_timer, 276 &CompilerStats::graphcompiler_timer,
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 Code::Handle(function.CurrentCode()).Size(), 510 Code::Handle(function.CurrentCode()).Size(),
507 per_compile_timer.TotalElapsedTime()); 511 per_compile_timer.TotalElapsedTime());
508 } 512 }
509 513
510 isolate->debugger()->NotifyCompilation(function); 514 isolate->debugger()->NotifyCompilation(function);
511 515
512 if (FLAG_disassemble) { 516 if (FLAG_disassemble) {
513 DisassembleCode(function, optimized); 517 DisassembleCode(function, optimized);
514 } else if (FLAG_disassemble_optimized && optimized) { 518 } else if (FLAG_disassemble_optimized && optimized) {
515 // TODO(fschneider): Print unoptimized code along with the optimized code. 519 // TODO(fschneider): Print unoptimized code along with the optimized code.
520 OS::Print("*** BEGIN CODE\n");
516 DisassembleCode(function, true); 521 DisassembleCode(function, true);
522 OS::Print("*** END CODE\n");
517 } 523 }
518 524
519 isolate->set_long_jump_base(base); 525 isolate->set_long_jump_base(base);
520 return Error::null(); 526 return Error::null();
521 } else { 527 } else {
522 Error& error = Error::Handle(); 528 Error& error = Error::Handle();
523 // We got an error during compilation. 529 // We got an error during compilation.
524 error = isolate->object_store()->sticky_error(); 530 error = isolate->object_store()->sticky_error();
525 isolate->object_store()->clear_sticky_error(); 531 isolate->object_store()->clear_sticky_error();
526 isolate->set_long_jump_base(base); 532 isolate->set_long_jump_base(base);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 Object::Handle(isolate->object_store()->sticky_error()); 654 Object::Handle(isolate->object_store()->sticky_error());
649 isolate->object_store()->clear_sticky_error(); 655 isolate->object_store()->clear_sticky_error();
650 isolate->set_long_jump_base(base); 656 isolate->set_long_jump_base(base);
651 return result.raw(); 657 return result.raw();
652 } 658 }
653 UNREACHABLE(); 659 UNREACHABLE();
654 return Object::null(); 660 return Object::null();
655 } 661 }
656 662
657 } // namespace dart 663 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698