| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 explicit Chain(BlockEntryInstr* block) | 101 explicit Chain(BlockEntryInstr* block) |
| 102 : first(new Link(block, NULL)), last(first), length(1) { } | 102 : first(new Link(block, NULL)), last(first), length(1) { } |
| 103 | 103 |
| 104 Link* first; | 104 Link* first; |
| 105 Link* last; | 105 Link* last; |
| 106 intptr_t length; | 106 intptr_t length; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 | 109 |
| 110 int Edge::LowestWeightFirst(const Edge* a, const Edge* b) { | 110 int Edge::LowestWeightFirst(const Edge* a, const Edge* b) { |
| 111 return (a->weight < b->weight) ? -1 : (a->weight > b->weight); | 111 if (a->weight < b->weight) { |
| 112 return -1; |
| 113 } |
| 114 return (a->weight > b->weight) ? 1 : 0; |
| 112 } | 115 } |
| 113 | 116 |
| 114 | 117 |
| 115 // Combine two chains by adding the shorter chain's links to the longer | 118 // Combine two chains by adding the shorter chain's links to the longer |
| 116 // chain. | 119 // chain. |
| 117 static void Union(GrowableArray<Chain*>* chains, | 120 static void Union(GrowableArray<Chain*>* chains, |
| 118 Chain* source_chain, | 121 Chain* source_chain, |
| 119 Chain* target_chain) { | 122 Chain* target_chain) { |
| 120 if (source_chain->length < target_chain->length) { | 123 if (source_chain->length < target_chain->length) { |
| 121 for (Link* link = source_chain->first; link != NULL; link = link->next) { | 124 for (Link* link = source_chain->first; link != NULL; link = link->next) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 for (intptr_t i = block_count - 1; i >= 0; --i) { | 196 for (intptr_t i = block_count - 1; i >= 0; --i) { |
| 194 if (chains[i]->first->block == flow_graph()->postorder()[i]) { | 197 if (chains[i]->first->block == flow_graph()->postorder()[i]) { |
| 195 for (Link* link = chains[i]->first; link != NULL; link = link->next) { | 198 for (Link* link = chains[i]->first; link != NULL; link = link->next) { |
| 196 flow_graph()->CodegenBlockOrder(true)->Add(link->block); | 199 flow_graph()->CodegenBlockOrder(true)->Add(link->block); |
| 197 } | 200 } |
| 198 } | 201 } |
| 199 } | 202 } |
| 200 } | 203 } |
| 201 | 204 |
| 202 } // namespace dart | 205 } // namespace dart |
| OLD | NEW |