OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flow_graph.h" | 5 #include "vm/flow_graph.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } | 53 } |
54 for (intptr_t j = 0; j < array->length(); j++) { | 54 for (intptr_t j = 0; j < array->length(); j++) { |
55 if ((*array)[j]->raw() == field->raw()) { | 55 if ((*array)[j]->raw() == field->raw()) { |
56 return; | 56 return; |
57 } | 57 } |
58 } | 58 } |
59 array->Add(field); | 59 array->Add(field); |
60 } | 60 } |
61 | 61 |
62 | 62 |
63 GrowableArray<BlockEntryInstr*>* FlowGraph::codegen_block_order( | 63 bool FlowGraph::ShouldReorderBlocks(const Function& function, |
| 64 bool is_optimized) { |
| 65 return is_optimized && FLAG_reorder_basic_blocks && !function.is_intrinsic(); |
| 66 } |
| 67 |
| 68 |
| 69 GrowableArray<BlockEntryInstr*>* FlowGraph::CodegenBlockOrder( |
64 bool is_optimized) { | 70 bool is_optimized) { |
65 return (is_optimized && FLAG_reorder_basic_blocks) | 71 return ShouldReorderBlocks(parsed_function().function(), is_optimized) |
66 ? &optimized_block_order_ | 72 ? &optimized_block_order_ |
67 : &reverse_postorder_; | 73 : &reverse_postorder_; |
68 } | 74 } |
69 | 75 |
70 | 76 |
71 ConstantInstr* FlowGraph::GetConstant(const Object& object) { | 77 ConstantInstr* FlowGraph::GetConstant(const Object& object) { |
72 // Check if the constant is already in the pool. | 78 // Check if the constant is already in the pool. |
73 GrowableArray<Definition*>* pool = graph_entry_->initial_definitions(); | 79 GrowableArray<Definition*>* pool = graph_entry_->initial_definitions(); |
74 for (intptr_t i = 0; i < pool->length(); ++i) { | 80 for (intptr_t i = 0; i < pool->length(); ++i) { |
75 ConstantInstr* constant = (*pool)[i]->AsConstant(); | 81 ConstantInstr* constant = (*pool)[i]->AsConstant(); |
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 } | 1192 } |
1187 | 1193 |
1188 | 1194 |
1189 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, | 1195 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, |
1190 BlockEntryInstr* to) const { | 1196 BlockEntryInstr* to) const { |
1191 return available_at_[to->postorder_number()]->Contains( | 1197 return available_at_[to->postorder_number()]->Contains( |
1192 from->postorder_number()); | 1198 from->postorder_number()); |
1193 } | 1199 } |
1194 | 1200 |
1195 } // namespace dart | 1201 } // namespace dart |
OLD | NEW |