| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 double weight = | 73 double weight = |
| 74 static_cast<double>(count) / static_cast<double>(entry_count); | 74 static_cast<double>(count) / static_cast<double>(entry_count); |
| 75 jump->set_edge_weight(weight); | 75 jump->set_edge_weight(weight); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 void BlockScheduler::AssignEdgeWeights() const { | 82 void BlockScheduler::AssignEdgeWeights() const { |
| 83 if (!FLAG_emit_edge_counters) { |
| 84 return; |
| 85 } |
| 83 const Code& unoptimized_code = flow_graph()->parsed_function().code(); | 86 const Code& unoptimized_code = flow_graph()->parsed_function().code(); |
| 84 ASSERT(!unoptimized_code.IsNull()); | 87 ASSERT(!unoptimized_code.IsNull()); |
| 85 | 88 |
| 86 ZoneGrowableArray<uword>* deopt_id_pc_pairs = new ZoneGrowableArray<uword>(); | 89 ZoneGrowableArray<uword>* deopt_id_pc_pairs = new ZoneGrowableArray<uword>(); |
| 87 const PcDescriptors& descriptors = | 90 const PcDescriptors& descriptors = |
| 88 PcDescriptors::Handle(unoptimized_code.pc_descriptors()); | 91 PcDescriptors::Handle(unoptimized_code.pc_descriptors()); |
| 89 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kDeopt); | 92 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kDeopt); |
| 90 uword entry = unoptimized_code.EntryPoint(); | 93 uword entry = unoptimized_code.EntryPoint(); |
| 91 while (iter.MoveNext()) { | 94 while (iter.MoveNext()) { |
| 92 intptr_t deopt_id = iter.DeoptId(); | 95 intptr_t deopt_id = iter.DeoptId(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 for (intptr_t i = block_count - 1; i >= 0; --i) { | 242 for (intptr_t i = block_count - 1; i >= 0; --i) { |
| 240 if (chains[i]->first->block == flow_graph()->postorder()[i]) { | 243 if (chains[i]->first->block == flow_graph()->postorder()[i]) { |
| 241 for (Link* link = chains[i]->first; link != NULL; link = link->next) { | 244 for (Link* link = chains[i]->first; link != NULL; link = link->next) { |
| 242 flow_graph()->CodegenBlockOrder(true)->Add(link->block); | 245 flow_graph()->CodegenBlockOrder(true)->Add(link->block); |
| 243 } | 246 } |
| 244 } | 247 } |
| 245 } | 248 } |
| 246 } | 249 } |
| 247 | 250 |
| 248 } // namespace dart | 251 } // namespace dart |
| OLD | NEW |