| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/block_scheduler.h" | 5 #include "vm/block_scheduler.h" |
| 6 | 6 |
| 7 #include "vm/allocation.h" | 7 #include "vm/allocation.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/flow_graph.h" | 9 #include "vm/flow_graph.h" |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 double weight = | 51 double weight = |
| 52 static_cast<double>(count) / static_cast<double>(entry_count); | 52 static_cast<double>(count) / static_cast<double>(entry_count); |
| 53 jump->set_edge_weight(weight); | 53 jump->set_edge_weight(weight); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 | 59 |
| 60 void BlockScheduler::AssignEdgeWeights() const { | 60 void BlockScheduler::AssignEdgeWeights() const { |
| 61 const Code& unoptimized_code = Code::Handle( | 61 const Code& unoptimized_code = flow_graph()->parsed_function().code(); |
| 62 flow_graph()->parsed_function().code()); | |
| 63 ASSERT(!unoptimized_code.IsNull()); | 62 ASSERT(!unoptimized_code.IsNull()); |
| 64 | 63 |
| 65 intptr_t entry_count = | 64 intptr_t entry_count = |
| 66 ComputeEdgeCount(unoptimized_code, | 65 ComputeEdgeCount(unoptimized_code, |
| 67 flow_graph()->graph_entry()->normal_entry()->deopt_id()); | 66 flow_graph()->graph_entry()->normal_entry()->deopt_id()); |
| 68 flow_graph()->graph_entry()->set_entry_count(entry_count); | 67 flow_graph()->graph_entry()->set_entry_count(entry_count); |
| 69 | 68 |
| 70 for (BlockIterator it = flow_graph()->reverse_postorder_iterator(); | 69 for (BlockIterator it = flow_graph()->reverse_postorder_iterator(); |
| 71 !it.Done(); | 70 !it.Done(); |
| 72 it.Advance()) { | 71 it.Advance()) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 for (intptr_t i = block_count - 1; i >= 0; --i) { | 202 for (intptr_t i = block_count - 1; i >= 0; --i) { |
| 204 if (chains[i]->first->block == flow_graph()->postorder()[i]) { | 203 if (chains[i]->first->block == flow_graph()->postorder()[i]) { |
| 205 for (Link* link = chains[i]->first; link != NULL; link = link->next) { | 204 for (Link* link = chains[i]->first; link != NULL; link = link->next) { |
| 206 flow_graph()->CodegenBlockOrder(true)->Add(link->block); | 205 flow_graph()->CodegenBlockOrder(true)->Add(link->block); |
| 207 } | 206 } |
| 208 } | 207 } |
| 209 } | 208 } |
| 210 } | 209 } |
| 211 | 210 |
| 212 } // namespace dart | 211 } // namespace dart |
| OLD | NEW |