Chromium Code Reviews| 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/il_printer.h" | 9 #include "vm/il_printer.h" |
| 10 #include "vm/intermediate_language.h" | 10 #include "vm/intermediate_language.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 void FlowGraph::InsertAfter(Instruction* prev, | 129 void FlowGraph::InsertAfter(Instruction* prev, |
| 130 Instruction* instr, | 130 Instruction* instr, |
| 131 Environment* env, | 131 Environment* env, |
| 132 UseKind use_kind) { | 132 UseKind use_kind) { |
| 133 if (use_kind == kValue) { | 133 if (use_kind == kValue) { |
| 134 ASSERT(instr->IsDefinition()); | 134 ASSERT(instr->IsDefinition()); |
| 135 AllocateSSAIndexes(instr->AsDefinition()); | 135 AllocateSSAIndexes(instr->AsDefinition()); |
| 136 } | 136 } |
| 137 instr->InsertAfter(prev); | 137 instr->InsertAfter(prev); |
| 138 ASSERT(instr->env() == NULL); | 138 ASSERT(instr->env() == NULL); |
| 139 if (env != NULL) env->DeepCopyTo(isolate(), instr); | 139 if (env != NULL) env->DeepCopyTo(zone(), instr); |
|
Ivan Posva
2015/03/13 21:56:50
Please add
{
...
}
koda
2015/03/14 00:46:37
Done.
| |
| 140 } | 140 } |
| 141 | 141 |
| 142 | 142 |
| 143 Instruction* FlowGraph::AppendTo(Instruction* prev, | 143 Instruction* FlowGraph::AppendTo(Instruction* prev, |
| 144 Instruction* instr, | 144 Instruction* instr, |
| 145 Environment* env, | 145 Environment* env, |
| 146 UseKind use_kind) { | 146 UseKind use_kind) { |
| 147 if (use_kind == kValue) { | 147 if (use_kind == kValue) { |
| 148 ASSERT(instr->IsDefinition()); | 148 ASSERT(instr->IsDefinition()); |
| 149 AllocateSSAIndexes(instr->AsDefinition()); | 149 AllocateSSAIndexes(instr->AsDefinition()); |
| 150 } | 150 } |
| 151 ASSERT(instr->env() == NULL); | 151 ASSERT(instr->env() == NULL); |
| 152 if (env != NULL) env->DeepCopyTo(isolate(), instr); | 152 if (env != NULL) env->DeepCopyTo(zone(), instr); |
|
Ivan Posva
2015/03/13 21:56:50
ditto
koda
2015/03/14 00:46:37
Done.
| |
| 153 return prev->AppendInstruction(instr); | 153 return prev->AppendInstruction(instr); |
| 154 } | 154 } |
| 155 | 155 |
| 156 | 156 |
| 157 // A wrapper around block entries including an index of the next successor to | 157 // A wrapper around block entries including an index of the next successor to |
| 158 // be read. | 158 // be read. |
| 159 class BlockTraversalState { | 159 class BlockTraversalState { |
| 160 public: | 160 public: |
| 161 explicit BlockTraversalState(BlockEntryInstr* block) | 161 explicit BlockTraversalState(BlockEntryInstr* block) |
| 162 : block_(block), | 162 : block_(block), |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 877 // on entry to the catch. | 877 // on entry to the catch. |
| 878 entry->set_fixed_slot_count(num_stack_locals() + num_copied_params()); | 878 entry->set_fixed_slot_count(num_stack_locals() + num_copied_params()); |
| 879 } | 879 } |
| 880 RenameRecursive(entry, &env, live_phis, variable_liveness); | 880 RenameRecursive(entry, &env, live_phis, variable_liveness); |
| 881 } | 881 } |
| 882 | 882 |
| 883 | 883 |
| 884 void FlowGraph::AttachEnvironment(Instruction* instr, | 884 void FlowGraph::AttachEnvironment(Instruction* instr, |
| 885 GrowableArray<Definition*>* env) { | 885 GrowableArray<Definition*>* env) { |
| 886 Environment* deopt_env = | 886 Environment* deopt_env = |
| 887 Environment::From(isolate(), | 887 Environment::From(zone(), |
| 888 *env, | 888 *env, |
| 889 num_non_copied_params_, | 889 num_non_copied_params_, |
| 890 parsed_function_); | 890 parsed_function_); |
| 891 if (instr->IsClosureCall()) { | 891 if (instr->IsClosureCall()) { |
| 892 deopt_env = deopt_env->DeepCopy(isolate(), | 892 deopt_env = deopt_env->DeepCopy(zone(), |
| 893 deopt_env->Length() - instr->InputCount()); | 893 deopt_env->Length() - instr->InputCount()); |
| 894 } | 894 } |
| 895 instr->SetEnvironment(deopt_env); | 895 instr->SetEnvironment(deopt_env); |
| 896 for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) { | 896 for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) { |
| 897 Value* use = it.CurrentValue(); | 897 Value* use = it.CurrentValue(); |
| 898 use->definition()->AddEnvUse(use); | 898 use->definition()->AddEnvUse(use); |
| 899 } | 899 } |
| 900 if (instr->CanDeoptimize()) { | 900 if (instr->CanDeoptimize()) { |
| 901 instr->env()->set_deopt_id(instr->deopt_id()); | 901 instr->env()->set_deopt_id(instr->deopt_id()); |
| 902 } | 902 } |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 | 1386 |
| 1387 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, | 1387 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, |
| 1388 BlockEntryInstr* to) const { | 1388 BlockEntryInstr* to) const { |
| 1389 return available_at_[to->postorder_number()]->Contains( | 1389 return available_at_[to->postorder_number()]->Contains( |
| 1390 from->postorder_number()); | 1390 from->postorder_number()); |
| 1391 } | 1391 } |
| 1392 | 1392 |
| 1393 } // namespace dart | 1393 } // namespace dart |
| OLD | NEW |