Chromium Code Reviews| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 static_cast<double>(count) / static_cast<double>(entry_count); | 46 static_cast<double>(count) / static_cast<double>(entry_count); |
| 47 jump->set_edge_weight(weight); | 47 jump->set_edge_weight(weight); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 | 53 |
| 54 void BlockScheduler::AssignEdgeWeights() const { | 54 void BlockScheduler::AssignEdgeWeights() const { |
| 55 const Code& unoptimized_code = Code::Handle( | 55 const Code& unoptimized_code = Code::Handle( |
| 56 flow_graph()->parsed_function().function().unoptimized_code()); | 56 flow_graph()->parsed_function().function().unoptimized_code()); |
|
srdjan
2013/11/19 19:18:29
Maybe cache unoptimized code in class ParsedFuncti
zra
2013/11/22 17:18:54
Done.
| |
| 57 ASSERT(!unoptimized_code.IsNull()); | |
| 57 | 58 |
| 58 intptr_t entry_count = | 59 intptr_t entry_count = |
| 59 ComputeEdgeCount(unoptimized_code, | 60 ComputeEdgeCount(unoptimized_code, |
| 60 flow_graph()->graph_entry()->normal_entry()->deopt_id()); | 61 flow_graph()->graph_entry()->normal_entry()->deopt_id()); |
| 61 flow_graph()->graph_entry()->set_entry_count(entry_count); | 62 flow_graph()->graph_entry()->set_entry_count(entry_count); |
| 62 | 63 |
| 63 for (BlockIterator it = flow_graph()->reverse_postorder_iterator(); | 64 for (BlockIterator it = flow_graph()->reverse_postorder_iterator(); |
| 64 !it.Done(); | 65 !it.Done(); |
| 65 it.Advance()) { | 66 it.Advance()) { |
| 66 BlockEntryInstr* block = it.Current(); | 67 BlockEntryInstr* block = it.Current(); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 for (intptr_t i = block_count - 1; i >= 0; --i) { | 197 for (intptr_t i = block_count - 1; i >= 0; --i) { |
| 197 if (chains[i]->first->block == flow_graph()->postorder()[i]) { | 198 if (chains[i]->first->block == flow_graph()->postorder()[i]) { |
| 198 for (Link* link = chains[i]->first; link != NULL; link = link->next) { | 199 for (Link* link = chains[i]->first; link != NULL; link = link->next) { |
| 199 flow_graph()->CodegenBlockOrder(true)->Add(link->block); | 200 flow_graph()->CodegenBlockOrder(true)->Add(link->block); |
| 200 } | 201 } |
| 201 } | 202 } |
| 202 } | 203 } |
| 203 } | 204 } |
| 204 | 205 |
| 205 } // namespace dart | 206 } // namespace dart |
| OLD | NEW |