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

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

Issue 878243002: Cleanup: use const reference for ParsedFunction where possible. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 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 | « 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 virtual void ParseFunction(ParsedFunction* parsed_function) { 89 virtual void ParseFunction(ParsedFunction* parsed_function) {
90 Parser::ParseFunction(parsed_function); 90 Parser::ParseFunction(parsed_function);
91 parsed_function->AllocateVariables(); 91 parsed_function->AllocateVariables();
92 } 92 }
93 93
94 virtual FlowGraph* BuildFlowGraph( 94 virtual FlowGraph* BuildFlowGraph(
95 ParsedFunction* parsed_function, 95 ParsedFunction* parsed_function,
96 const ZoneGrowableArray<const ICData*>& ic_data_array, 96 const ZoneGrowableArray<const ICData*>& ic_data_array,
97 intptr_t osr_id) { 97 intptr_t osr_id) {
98 // Build the flow graph. 98 // Build the flow graph.
99 FlowGraphBuilder builder(parsed_function, 99 FlowGraphBuilder builder(*parsed_function,
100 ic_data_array, 100 ic_data_array,
101 NULL, // NULL = not inlining. 101 NULL, // NULL = not inlining.
102 osr_id); 102 osr_id);
103 103
104 return builder.BuildGraph(); 104 return builder.BuildGraph();
105 } 105 }
106 106
107 virtual void FinalizeCompilation() { } 107 virtual void FinalizeCompilation() { }
108 }; 108 };
109 109
(...skipping 17 matching lines...) Expand all
127 RegExpEngine::CompilationResult result = 127 RegExpEngine::CompilationResult result =
128 RegExpEngine::Compile(parsed_function->regexp_compile_data(), 128 RegExpEngine::Compile(parsed_function->regexp_compile_data(),
129 parsed_function, 129 parsed_function,
130 ic_data_array); 130 ic_data_array);
131 backtrack_goto_ = result.backtrack_goto; 131 backtrack_goto_ = result.backtrack_goto;
132 132
133 // Allocate variables now that we know the number of locals. 133 // Allocate variables now that we know the number of locals.
134 parsed_function->AllocateIrregexpVariables(result.num_stack_locals); 134 parsed_function->AllocateIrregexpVariables(result.num_stack_locals);
135 135
136 // Build the flow graph. 136 // Build the flow graph.
137 FlowGraphBuilder builder(parsed_function, 137 FlowGraphBuilder builder(*parsed_function,
138 ic_data_array, 138 ic_data_array,
139 NULL, // NULL = not inlining. 139 NULL, // NULL = not inlining.
140 osr_id); 140 osr_id);
141 141
142 return new(isolate_) FlowGraph(parsed_function, 142 return new(isolate_) FlowGraph(*parsed_function,
143 result.graph_entry, 143 result.graph_entry,
144 result.num_blocks); 144 result.num_blocks);
145 } 145 }
146 146
147 virtual void FinalizeCompilation() { 147 virtual void FinalizeCompilation() {
148 backtrack_goto_->ComputeOffsetTable(isolate_); 148 backtrack_goto_->ComputeOffsetTable(isolate_);
149 } 149 }
150 150
151 private: 151 private:
152 IndirectGotoInstr* backtrack_goto_; 152 IndirectGotoInstr* backtrack_goto_;
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 FlowGraphAllocator allocator(*flow_graph); 679 FlowGraphAllocator allocator(*flow_graph);
680 allocator.AllocateRegisters(); 680 allocator.AllocateRegisters();
681 if (reorder_blocks) block_scheduler.ReorderBlocks(); 681 if (reorder_blocks) block_scheduler.ReorderBlocks();
682 682
683 if (print_flow_graph) { 683 if (print_flow_graph) {
684 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph); 684 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph);
685 } 685 }
686 } 686 }
687 687
688 Assembler assembler(use_far_branches); 688 Assembler assembler(use_far_branches);
689 FlowGraphCompiler graph_compiler( 689 FlowGraphCompiler graph_compiler(&assembler, flow_graph,
690 &assembler, flow_graph, optimized, inline_id_to_function); 690 *parsed_function, optimized,
691 inline_id_to_function);
691 { 692 {
692 TimerScope timer(FLAG_compiler_stats, 693 TimerScope timer(FLAG_compiler_stats,
693 &CompilerStats::graphcompiler_timer, 694 &CompilerStats::graphcompiler_timer,
694 isolate); 695 isolate);
695 graph_compiler.CompileGraph(); 696 graph_compiler.CompileGraph();
696 pipeline->FinalizeCompilation(); 697 pipeline->FinalizeCompilation();
697 } 698 }
698 { 699 {
699 TimerScope timer(FLAG_compiler_stats, 700 TimerScope timer(FLAG_compiler_stats,
700 &CompilerStats::codefinalizer_timer, 701 &CompilerStats::codefinalizer_timer,
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 const Object& result = 1206 const Object& result =
1206 PassiveObject::Handle(isolate->object_store()->sticky_error()); 1207 PassiveObject::Handle(isolate->object_store()->sticky_error());
1207 isolate->object_store()->clear_sticky_error(); 1208 isolate->object_store()->clear_sticky_error();
1208 return result.raw(); 1209 return result.raw();
1209 } 1210 }
1210 UNREACHABLE(); 1211 UNREACHABLE();
1211 return Object::null(); 1212 return Object::null();
1212 } 1213 }
1213 1214
1214 } // namespace dart 1215 } // 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