| 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/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 | 81 |
| 82 bool FlowGraph::ShouldReorderBlocks(const Function& function, | 82 bool FlowGraph::ShouldReorderBlocks(const Function& function, |
| 83 bool is_optimized) { | 83 bool is_optimized) { |
| 84 return is_optimized && FLAG_reorder_basic_blocks && !function.is_intrinsic(); | 84 return is_optimized && FLAG_reorder_basic_blocks && !function.is_intrinsic(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 | 87 |
| 88 GrowableArray<BlockEntryInstr*>* FlowGraph::CodegenBlockOrder( | 88 GrowableArray<BlockEntryInstr*>* FlowGraph::CodegenBlockOrder( |
| 89 bool is_optimized) { | 89 bool is_optimized) { |
| 90 return ShouldReorderBlocks(parsed_function()->function(), is_optimized) | 90 return ShouldReorderBlocks(function(), is_optimized) |
| 91 ? &optimized_block_order_ | 91 ? &optimized_block_order_ |
| 92 : &reverse_postorder_; | 92 : &reverse_postorder_; |
| 93 } | 93 } |
| 94 | 94 |
| 95 | 95 |
| 96 ConstantInstr* FlowGraph::GetConstant(const Object& object) { | 96 ConstantInstr* FlowGraph::GetConstant(const Object& object) { |
| 97 ConstantInstr* constant = constant_instr_pool_.Lookup(object); | 97 ConstantInstr* constant = constant_instr_pool_.Lookup(object); |
| 98 if (constant == NULL) { | 98 if (constant == NULL) { |
| 99 // Otherwise, allocate and add it to the pool. | 99 // Otherwise, allocate and add it to the pool. |
| 100 constant = new(zone()) ConstantInstr( | 100 constant = new(zone()) ConstantInstr( |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 AddToInitialDefinitions(param); | 848 AddToInitialDefinitions(param); |
| 849 env.Add(param); | 849 env.Add(param); |
| 850 } | 850 } |
| 851 } | 851 } |
| 852 | 852 |
| 853 // Initialize all locals in the renaming environment For OSR, the locals have | 853 // Initialize all locals in the renaming environment For OSR, the locals have |
| 854 // already been handled as parameters. | 854 // already been handled as parameters. |
| 855 if (!IsCompiledForOsr()) { | 855 if (!IsCompiledForOsr()) { |
| 856 for (intptr_t i = parameter_count(); i < variable_count(); ++i) { | 856 for (intptr_t i = parameter_count(); i < variable_count(); ++i) { |
| 857 if (i == CurrentContextEnvIndex()) { | 857 if (i == CurrentContextEnvIndex()) { |
| 858 if (parsed_function()->function().IsClosureFunction()) { | 858 if (function().IsClosureFunction()) { |
| 859 CurrentContextInstr* context = new CurrentContextInstr(); | 859 CurrentContextInstr* context = new CurrentContextInstr(); |
| 860 context->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. | 860 context->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. |
| 861 AddToInitialDefinitions(context); | 861 AddToInitialDefinitions(context); |
| 862 env.Add(context); | 862 env.Add(context); |
| 863 } else { | 863 } else { |
| 864 env.Add(constant_empty_context()); | 864 env.Add(constant_empty_context()); |
| 865 } | 865 } |
| 866 } else { | 866 } else { |
| 867 env.Add(constant_null()); | 867 env.Add(constant_null()); |
| 868 } | 868 } |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 } | 1382 } |
| 1383 | 1383 |
| 1384 | 1384 |
| 1385 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, | 1385 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, |
| 1386 BlockEntryInstr* to) const { | 1386 BlockEntryInstr* to) const { |
| 1387 return available_at_[to->postorder_number()]->Contains( | 1387 return available_at_[to->postorder_number()]->Contains( |
| 1388 from->postorder_number()); | 1388 from->postorder_number()); |
| 1389 } | 1389 } |
| 1390 | 1390 |
| 1391 } // namespace dart | 1391 } // namespace dart |
| OLD | NEW |