OLD | NEW |
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 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 FlowGraphPrinter printer(*flow_graph); | 172 FlowGraphPrinter printer(*flow_graph); |
173 printer.PrintBlocks(); | 173 printer.PrintBlocks(); |
174 } | 174 } |
175 if (Dart::flow_graph_writer() != NULL) { | 175 if (Dart::flow_graph_writer() != NULL) { |
176 // Write flow graph to file. | 176 // Write flow graph to file. |
177 FlowGraphVisualizer printer(*flow_graph); | 177 FlowGraphVisualizer printer(*flow_graph); |
178 printer.PrintFunction(); | 178 printer.PrintFunction(); |
179 } | 179 } |
180 | 180 |
181 if (optimized) { | 181 if (optimized) { |
182 // TODO(vegorov): we need to compute uses for the | |
183 // purposes of unboxing. Move unboxing to a later | |
184 // stage. | |
185 // Compute the use lists. | |
186 flow_graph->ComputeUseLists(); | 182 flow_graph->ComputeUseLists(); |
187 | 183 |
188 FlowGraphOptimizer optimizer(flow_graph); | 184 FlowGraphOptimizer optimizer(flow_graph); |
189 optimizer.ApplyICData(); | 185 optimizer.ApplyICData(); |
190 | 186 |
191 // Compute the use lists. | 187 // Compute the use lists. |
192 flow_graph->ComputeUseLists(); | 188 flow_graph->ComputeUseLists(); |
193 | 189 |
194 // Inlining (mutates the flow graph) | 190 // Inlining (mutates the flow graph) |
195 if (FLAG_use_inlining) { | 191 if (FLAG_use_inlining) { |
196 FlowGraphInliner inliner(flow_graph); | 192 FlowGraphInliner inliner(flow_graph); |
197 inliner.Inline(); | 193 inliner.Inline(); |
198 // Verify that the use lists are still valid. | 194 // Verify that the use lists are still valid. |
199 DEBUG_ASSERT(flow_graph->ValidateUseLists()); | 195 DEBUG_ASSERT(flow_graph->ValidateUseLists()); |
200 } | 196 } |
201 | 197 |
202 // Propagate types and eliminate more type tests. | 198 // Propagate types and eliminate more type tests. |
203 FlowGraphTypePropagator propagator(*flow_graph); | 199 FlowGraphTypePropagator propagator(*flow_graph); |
204 propagator.PropagateTypes(); | 200 propagator.PropagateTypes(); |
205 | 201 |
206 // Verify that the use lists are still valid. | 202 // Verify that the use lists are still valid. |
207 DEBUG_ASSERT(flow_graph->ValidateUseLists()); | 203 DEBUG_ASSERT(flow_graph->ValidateUseLists()); |
208 | 204 |
209 // Do optimizations that depend on the propagated type information. | 205 // Do optimizations that depend on the propagated type information. |
210 optimizer.OptimizeComputations(); | 206 optimizer.OptimizeComputations(); |
211 | 207 |
| 208 // Unbox doubles. |
| 209 flow_graph->ComputeUseLists(); |
| 210 optimizer.SelectRepresentations(); |
| 211 |
212 if (FLAG_cse) { | 212 if (FLAG_cse) { |
| 213 flow_graph->ComputeUseLists(); |
213 DominatorBasedCSE::Optimize(flow_graph->graph_entry()); | 214 DominatorBasedCSE::Optimize(flow_graph->graph_entry()); |
214 } | 215 } |
215 | 216 |
216 // Perform register allocation on the SSA graph. | 217 // Perform register allocation on the SSA graph. |
217 FlowGraphAllocator allocator(*flow_graph); | 218 FlowGraphAllocator allocator(*flow_graph); |
218 allocator.AllocateRegisters(); | 219 allocator.AllocateRegisters(); |
219 | 220 |
220 if (FLAG_print_flow_graph) { | 221 if (FLAG_print_flow_graph) { |
221 OS::Print("After Optimizations:\n"); | 222 OS::Print("After Optimizations:\n"); |
222 FlowGraphPrinter printer(*flow_graph); | 223 FlowGraphPrinter printer(*flow_graph); |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 result = isolate->object_store()->sticky_error(); | 571 result = isolate->object_store()->sticky_error(); |
571 isolate->object_store()->clear_sticky_error(); | 572 isolate->object_store()->clear_sticky_error(); |
572 isolate->set_long_jump_base(base); | 573 isolate->set_long_jump_base(base); |
573 return result.raw(); | 574 return result.raw(); |
574 } | 575 } |
575 UNREACHABLE(); | 576 UNREACHABLE(); |
576 return Object::null(); | 577 return Object::null(); |
577 } | 578 } |
578 | 579 |
579 } // namespace dart | 580 } // namespace dart |
OLD | NEW |