| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 double weight = | 58 double weight = |
| 59 static_cast<double>(count) / static_cast<double>(entry_count); | 59 static_cast<double>(count) / static_cast<double>(entry_count); |
| 60 jump->set_edge_weight(weight); | 60 jump->set_edge_weight(weight); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 | 66 |
| 67 void BlockScheduler::AssignEdgeWeights() const { | 67 void BlockScheduler::AssignEdgeWeights() const { |
| 68 const Code& unoptimized_code = flow_graph()->parsed_function()->code(); | 68 const Code& unoptimized_code = flow_graph()->parsed_function().code(); |
| 69 ASSERT(!unoptimized_code.IsNull()); | 69 ASSERT(!unoptimized_code.IsNull()); |
| 70 | 70 |
| 71 intptr_t entry_count = | 71 intptr_t entry_count = |
| 72 ComputeEdgeCount(unoptimized_code, | 72 ComputeEdgeCount(unoptimized_code, |
| 73 flow_graph()->graph_entry()->normal_entry()->deopt_id()); | 73 flow_graph()->graph_entry()->normal_entry()->deopt_id()); |
| 74 flow_graph()->graph_entry()->set_entry_count(entry_count); | 74 flow_graph()->graph_entry()->set_entry_count(entry_count); |
| 75 | 75 |
| 76 for (BlockIterator it = flow_graph()->reverse_postorder_iterator(); | 76 for (BlockIterator it = flow_graph()->reverse_postorder_iterator(); |
| 77 !it.Done(); | 77 !it.Done(); |
| 78 it.Advance()) { | 78 it.Advance()) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 for (intptr_t i = block_count - 1; i >= 0; --i) { | 209 for (intptr_t i = block_count - 1; i >= 0; --i) { |
| 210 if (chains[i]->first->block == flow_graph()->postorder()[i]) { | 210 if (chains[i]->first->block == flow_graph()->postorder()[i]) { |
| 211 for (Link* link = chains[i]->first; link != NULL; link = link->next) { | 211 for (Link* link = chains[i]->first; link != NULL; link = link->next) { |
| 212 flow_graph()->CodegenBlockOrder(true)->Add(link->block); | 212 flow_graph()->CodegenBlockOrder(true)->Add(link->block); |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 } // namespace dart | 218 } // namespace dart |
| OLD | NEW |