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) { |
| 140 env->DeepCopyTo(zone(), instr); |
| 141 } |
140 } | 142 } |
141 | 143 |
142 | 144 |
143 Instruction* FlowGraph::AppendTo(Instruction* prev, | 145 Instruction* FlowGraph::AppendTo(Instruction* prev, |
144 Instruction* instr, | 146 Instruction* instr, |
145 Environment* env, | 147 Environment* env, |
146 UseKind use_kind) { | 148 UseKind use_kind) { |
147 if (use_kind == kValue) { | 149 if (use_kind == kValue) { |
148 ASSERT(instr->IsDefinition()); | 150 ASSERT(instr->IsDefinition()); |
149 AllocateSSAIndexes(instr->AsDefinition()); | 151 AllocateSSAIndexes(instr->AsDefinition()); |
150 } | 152 } |
151 ASSERT(instr->env() == NULL); | 153 ASSERT(instr->env() == NULL); |
152 if (env != NULL) env->DeepCopyTo(isolate(), instr); | 154 if (env != NULL) { |
| 155 env->DeepCopyTo(zone(), instr); |
| 156 } |
153 return prev->AppendInstruction(instr); | 157 return prev->AppendInstruction(instr); |
154 } | 158 } |
155 | 159 |
156 | 160 |
157 // A wrapper around block entries including an index of the next successor to | 161 // A wrapper around block entries including an index of the next successor to |
158 // be read. | 162 // be read. |
159 class BlockTraversalState { | 163 class BlockTraversalState { |
160 public: | 164 public: |
161 explicit BlockTraversalState(BlockEntryInstr* block) | 165 explicit BlockTraversalState(BlockEntryInstr* block) |
162 : block_(block), | 166 : block_(block), |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 // on entry to the catch. | 881 // on entry to the catch. |
878 entry->set_fixed_slot_count(num_stack_locals() + num_copied_params()); | 882 entry->set_fixed_slot_count(num_stack_locals() + num_copied_params()); |
879 } | 883 } |
880 RenameRecursive(entry, &env, live_phis, variable_liveness); | 884 RenameRecursive(entry, &env, live_phis, variable_liveness); |
881 } | 885 } |
882 | 886 |
883 | 887 |
884 void FlowGraph::AttachEnvironment(Instruction* instr, | 888 void FlowGraph::AttachEnvironment(Instruction* instr, |
885 GrowableArray<Definition*>* env) { | 889 GrowableArray<Definition*>* env) { |
886 Environment* deopt_env = | 890 Environment* deopt_env = |
887 Environment::From(isolate(), | 891 Environment::From(zone(), |
888 *env, | 892 *env, |
889 num_non_copied_params_, | 893 num_non_copied_params_, |
890 parsed_function_); | 894 parsed_function_); |
891 if (instr->IsClosureCall()) { | 895 if (instr->IsClosureCall()) { |
892 deopt_env = deopt_env->DeepCopy(isolate(), | 896 deopt_env = deopt_env->DeepCopy(zone(), |
893 deopt_env->Length() - instr->InputCount()); | 897 deopt_env->Length() - instr->InputCount()); |
894 } | 898 } |
895 instr->SetEnvironment(deopt_env); | 899 instr->SetEnvironment(deopt_env); |
896 for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) { | 900 for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) { |
897 Value* use = it.CurrentValue(); | 901 Value* use = it.CurrentValue(); |
898 use->definition()->AddEnvUse(use); | 902 use->definition()->AddEnvUse(use); |
899 } | 903 } |
900 if (instr->CanDeoptimize()) { | 904 if (instr->CanDeoptimize()) { |
901 instr->env()->set_deopt_id(instr->deopt_id()); | 905 instr->env()->set_deopt_id(instr->deopt_id()); |
902 } | 906 } |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 } | 1388 } |
1385 | 1389 |
1386 | 1390 |
1387 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, | 1391 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, |
1388 BlockEntryInstr* to) const { | 1392 BlockEntryInstr* to) const { |
1389 return available_at_[to->postorder_number()]->Contains( | 1393 return available_at_[to->postorder_number()]->Contains( |
1390 from->postorder_number()); | 1394 from->postorder_number()); |
1391 } | 1395 } |
1392 | 1396 |
1393 } // namespace dart | 1397 } // namespace dart |
OLD | NEW |