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

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

Issue 774763002: Cleanups. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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 | « runtime/vm/block_scheduler.cc ('k') | runtime/vm/flow_graph.h » ('j') | 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/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 // Allocate variables now that we know the number of locals. 132 // Allocate variables now that we know the number of locals.
133 parsed_function->AllocateIrregexpVariables(result.num_stack_locals); 133 parsed_function->AllocateIrregexpVariables(result.num_stack_locals);
134 134
135 // Build the flow graph. 135 // Build the flow graph.
136 FlowGraphBuilder builder(parsed_function, 136 FlowGraphBuilder builder(parsed_function,
137 ic_data_array, 137 ic_data_array,
138 NULL, // NULL = not inlining. 138 NULL, // NULL = not inlining.
139 osr_id); 139 osr_id);
140 140
141 return new(isolate_) FlowGraph(builder, 141 return new(isolate_) FlowGraph(parsed_function,
142 result.graph_entry, 142 result.graph_entry,
143 result.num_blocks); 143 result.num_blocks);
144 } 144 }
145 145
146 virtual void FinalizeCompilation() { 146 virtual void FinalizeCompilation() {
147 backtrack_goto_->ComputeOffsetTable(isolate_); 147 backtrack_goto_->ComputeOffsetTable(isolate_);
148 } 148 }
149 149
150 private: 150 private:
151 IndirectGotoInstr* backtrack_goto_; 151 IndirectGotoInstr* backtrack_goto_;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 418 }
419 } 419 }
420 } 420 }
421 } 421 }
422 422
423 flow_graph = pipeline->BuildFlowGraph(parsed_function, 423 flow_graph = pipeline->BuildFlowGraph(parsed_function,
424 *ic_data_array, 424 *ic_data_array,
425 osr_id); 425 osr_id);
426 } 426 }
427 427
428 if (FLAG_print_flow_graph || 428 const bool print_flow_graph =
429 (optimized && FLAG_print_flow_graph_optimized)) { 429 FLAG_print_flow_graph ||
430 (optimized && FLAG_print_flow_graph_optimized);
431
432 if (print_flow_graph) {
430 if (osr_id == Isolate::kNoDeoptId) { 433 if (osr_id == Isolate::kNoDeoptId) {
431 FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph); 434 FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph);
432 } else { 435 } else {
433 FlowGraphPrinter::PrintGraph("For OSR", flow_graph); 436 FlowGraphPrinter::PrintGraph("For OSR", flow_graph);
434 } 437 }
435 } 438 }
436 439
437 BlockScheduler block_scheduler(flow_graph); 440 BlockScheduler block_scheduler(flow_graph);
438 const bool reorder_blocks = 441 const bool reorder_blocks =
439 FlowGraph::ShouldReorderBlocks(function, optimized); 442 FlowGraph::ShouldReorderBlocks(function, optimized);
440 if (reorder_blocks) { 443 if (reorder_blocks) {
441 block_scheduler.AssignEdgeWeights(); 444 block_scheduler.AssignEdgeWeights();
442 } 445 }
443 446
444 if (optimized) { 447 if (optimized) {
445 TimerScope timer(FLAG_compiler_stats, 448 TimerScope timer(FLAG_compiler_stats,
446 &CompilerStats::ssa_timer, 449 &CompilerStats::ssa_timer,
447 isolate); 450 isolate);
448 // Transform to SSA (virtual register 0 and no inlining arguments). 451 // Transform to SSA (virtual register 0 and no inlining arguments).
449 flow_graph->ComputeSSA(0, NULL); 452 flow_graph->ComputeSSA(0, NULL);
450 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 453 DEBUG_ASSERT(flow_graph->VerifyUseLists());
451 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) { 454 if (print_flow_graph) {
452 FlowGraphPrinter::PrintGraph("After SSA", flow_graph); 455 FlowGraphPrinter::PrintGraph("After SSA", flow_graph);
453 } 456 }
454 } 457 }
455 458
456 // Collect all instance fields that are loaded in the graph and 459 // Collect all instance fields that are loaded in the graph and
457 // have non-generic type feedback attached to them that can 460 // have non-generic type feedback attached to them that can
458 // potentially affect optimizations. 461 // potentially affect optimizations.
459 if (optimized) { 462 if (optimized) {
460 TimerScope timer(FLAG_compiler_stats, 463 TimerScope timer(FLAG_compiler_stats,
461 &CompilerStats::graphoptimizer_timer, 464 &CompilerStats::graphoptimizer_timer,
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 663
661 // Compute and store graph informations (call & instruction counts) 664 // Compute and store graph informations (call & instruction counts)
662 // to be later used by the inliner. 665 // to be later used by the inliner.
663 FlowGraphInliner::CollectGraphInfo(flow_graph, true); 666 FlowGraphInliner::CollectGraphInfo(flow_graph, true);
664 667
665 // Perform register allocation on the SSA graph. 668 // Perform register allocation on the SSA graph.
666 FlowGraphAllocator allocator(*flow_graph); 669 FlowGraphAllocator allocator(*flow_graph);
667 allocator.AllocateRegisters(); 670 allocator.AllocateRegisters();
668 if (reorder_blocks) block_scheduler.ReorderBlocks(); 671 if (reorder_blocks) block_scheduler.ReorderBlocks();
669 672
670 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) { 673 if (print_flow_graph) {
671 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph); 674 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph);
672 } 675 }
673 } 676 }
674 677
675 Assembler assembler(use_far_branches); 678 Assembler assembler(use_far_branches);
676 FlowGraphCompiler graph_compiler(&assembler, flow_graph, optimized); 679 FlowGraphCompiler graph_compiler(&assembler, flow_graph, optimized);
677 { 680 {
678 TimerScope timer(FLAG_compiler_stats, 681 TimerScope timer(FLAG_compiler_stats,
679 &CompilerStats::graphcompiler_timer, 682 &CompilerStats::graphcompiler_timer,
680 isolate); 683 isolate);
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 const Object& result = 1178 const Object& result =
1176 PassiveObject::Handle(isolate->object_store()->sticky_error()); 1179 PassiveObject::Handle(isolate->object_store()->sticky_error());
1177 isolate->object_store()->clear_sticky_error(); 1180 isolate->object_store()->clear_sticky_error();
1178 return result.raw(); 1181 return result.raw();
1179 } 1182 }
1180 UNREACHABLE(); 1183 UNREACHABLE();
1181 return Object::null(); 1184 return Object::null();
1182 } 1185 }
1183 1186
1184 } // namespace dart 1187 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/block_scheduler.cc ('k') | runtime/vm/flow_graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698