Chromium Code Reviews| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 // Build the flow graph. | 161 // Build the flow graph. |
| 162 FlowGraphBuilder builder(parsed_function); | 162 FlowGraphBuilder builder(parsed_function); |
| 163 flow_graph = builder.BuildGraph(); | 163 flow_graph = builder.BuildGraph(); |
| 164 | 164 |
| 165 // Transform to SSA. | 165 // Transform to SSA. |
| 166 if (optimized) { | 166 if (optimized) { |
| 167 flow_graph->ComputeSSA(); | 167 flow_graph->ComputeSSA(); |
| 168 flow_graph->ComputeUseLists(); | |
| 168 } | 169 } |
| 169 | 170 |
| 170 if (FLAG_print_flow_graph) { | 171 if (FLAG_print_flow_graph) { |
| 171 OS::Print("Before Optimizations\n"); | 172 OS::Print("Before Optimizations\n"); |
| 172 FlowGraphPrinter printer(*flow_graph); | 173 FlowGraphPrinter printer(*flow_graph); |
| 173 printer.PrintBlocks(); | 174 printer.PrintBlocks(); |
| 174 } | 175 } |
| 175 if (Dart::flow_graph_writer() != NULL) { | 176 if (Dart::flow_graph_writer() != NULL) { |
| 176 // Write flow graph to file. | 177 // Write flow graph to file. |
| 177 FlowGraphVisualizer printer(*flow_graph); | 178 FlowGraphVisualizer printer(*flow_graph); |
| 178 printer.PrintFunction(); | 179 printer.PrintFunction(); |
| 179 } | 180 } |
| 180 | 181 |
| 181 if (optimized) { | 182 if (optimized) { |
| 182 FlowGraphOptimizer optimizer(*flow_graph); | 183 FlowGraphOptimizer optimizer(*flow_graph); |
| 183 optimizer.ApplyICData(); | 184 optimizer.ApplyICData(); |
| 185 ASSERT(flow_graph->ComputeUseLists()); | |
|
Vyacheslav Egorov (Google)
2012/08/23 13:51:10
ASSERT is compiled out in Release mode so this wil
| |
| 184 | 186 |
| 185 // Propagate types and eliminate more type tests. | 187 // Propagate types and eliminate more type tests. |
| 186 FlowGraphTypePropagator propagator(*flow_graph); | 188 FlowGraphTypePropagator propagator(*flow_graph); |
| 187 propagator.PropagateTypes(); | 189 propagator.PropagateTypes(); |
| 190 ASSERT(flow_graph->ComputeUseLists()); | |
| 188 | 191 |
| 189 // Do optimizations that depend on the propagated type information. | 192 // Do optimizations that depend on the propagated type information. |
| 190 optimizer.OptimizeComputations(); | 193 optimizer.OptimizeComputations(); |
| 194 ASSERT(flow_graph->ComputeUseLists()); | |
| 191 | 195 |
| 192 if (FLAG_local_cse) { | 196 if (FLAG_local_cse) { |
| 193 LocalCSE local_cse(*flow_graph); | 197 LocalCSE local_cse(*flow_graph); |
| 194 local_cse.Optimize(); | 198 local_cse.Optimize(); |
| 199 ASSERT(flow_graph->ComputeUseLists()); | |
| 195 } | 200 } |
| 196 | 201 |
| 197 // Perform register allocation on the SSA graph. | 202 // Perform register allocation on the SSA graph. |
| 198 FlowGraphAllocator allocator(*flow_graph); | 203 FlowGraphAllocator allocator(*flow_graph); |
| 199 allocator.AllocateRegisters(); | 204 allocator.AllocateRegisters(); |
| 205 ASSERT(flow_graph->ComputeUseLists()); | |
| 200 | 206 |
| 201 if (FLAG_print_flow_graph) { | 207 if (FLAG_print_flow_graph) { |
| 202 OS::Print("After Optimizations:\n"); | 208 OS::Print("After Optimizations:\n"); |
| 203 FlowGraphPrinter printer(*flow_graph); | 209 FlowGraphPrinter printer(*flow_graph); |
| 204 printer.PrintBlocks(); | 210 printer.PrintBlocks(); |
| 205 } | 211 } |
| 206 } | 212 } |
| 207 } | 213 } |
| 208 | 214 |
| 209 bool is_leaf = false; | 215 bool is_leaf = false; |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 551 result = isolate->object_store()->sticky_error(); | 557 result = isolate->object_store()->sticky_error(); |
| 552 isolate->object_store()->clear_sticky_error(); | 558 isolate->object_store()->clear_sticky_error(); |
| 553 isolate->set_long_jump_base(base); | 559 isolate->set_long_jump_base(base); |
| 554 return result.raw(); | 560 return result.raw(); |
| 555 } | 561 } |
| 556 UNREACHABLE(); | 562 UNREACHABLE(); |
| 557 return Object::null(); | 563 return Object::null(); |
| 558 } | 564 } |
| 559 | 565 |
| 560 } // namespace dart | 566 } // namespace dart |
| OLD | NEW |