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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 last_loads->Add(index); | 471 last_loads->Add(index); |
472 load->mark_last(); | 472 load->mark_last(); |
473 } | 473 } |
474 continue; | 474 continue; |
475 } | 475 } |
476 | 476 |
477 StoreLocalInstr* store = current->AsStoreLocal(); | 477 StoreLocalInstr* store = current->AsStoreLocal(); |
478 if (store != NULL) { | 478 if (store != NULL) { |
479 const intptr_t index = | 479 const intptr_t index = |
480 store->local().BitIndexIn(num_non_copied_params_); | 480 store->local().BitIndexIn(num_non_copied_params_); |
| 481 if (index >= live_in->length()) continue; // Skip tmp_locals. |
481 if (kill->Contains(index)) { | 482 if (kill->Contains(index)) { |
482 if (!live_in->Contains(index)) { | 483 if (!live_in->Contains(index)) { |
483 store->mark_dead(); | 484 store->mark_dead(); |
484 } | 485 } |
485 } else { | 486 } else { |
486 if (!live_in->Contains(index)) { | 487 if (!live_in->Contains(index)) { |
487 store->mark_last(); | 488 store->mark_last(); |
488 } | 489 } |
489 kill->Add(index); | 490 kill->Add(index); |
490 } | 491 } |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 RenameRecursive(entry, &env, live_phis, variable_liveness); | 750 RenameRecursive(entry, &env, live_phis, variable_liveness); |
750 } | 751 } |
751 | 752 |
752 | 753 |
753 void FlowGraph::AttachEnvironment(Instruction* instr, | 754 void FlowGraph::AttachEnvironment(Instruction* instr, |
754 GrowableArray<Definition*>* env) { | 755 GrowableArray<Definition*>* env) { |
755 Environment* deopt_env = | 756 Environment* deopt_env = |
756 Environment::From(*env, | 757 Environment::From(*env, |
757 num_non_copied_params_, | 758 num_non_copied_params_, |
758 Code::Handle(parsed_function_.code())); | 759 Code::Handle(parsed_function_.code())); |
| 760 // TODO(fschneider): Add predicates CanEagerlyDeoptimize and |
| 761 // CanLazilyDeoptimize to instructions to generally deal with instructions |
| 762 // that have pushed arguments and input operands. |
| 763 // Right now, closure calls are the only instructions that have both. They |
| 764 // also don't have an eager deoptimziation point, so the environment attached |
| 765 // here is only used for after the call. |
| 766 if (instr->IsClosureCall()) { |
| 767 deopt_env = deopt_env->DeepCopy(deopt_env->Length() - instr->InputCount()); |
| 768 } |
759 instr->SetEnvironment(deopt_env); | 769 instr->SetEnvironment(deopt_env); |
760 for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) { | 770 for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) { |
761 Value* use = it.CurrentValue(); | 771 Value* use = it.CurrentValue(); |
762 use->definition()->AddEnvUse(use); | 772 use->definition()->AddEnvUse(use); |
763 } | 773 } |
764 if (instr->CanDeoptimize()) { | 774 if (instr->CanDeoptimize()) { |
765 instr->env()->set_deopt_id(instr->deopt_id()); | 775 instr->env()->set_deopt_id(instr->deopt_id()); |
766 } | 776 } |
767 } | 777 } |
768 | 778 |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 } | 1228 } |
1219 | 1229 |
1220 | 1230 |
1221 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, | 1231 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, |
1222 BlockEntryInstr* to) const { | 1232 BlockEntryInstr* to) const { |
1223 return available_at_[to->postorder_number()]->Contains( | 1233 return available_at_[to->postorder_number()]->Contains( |
1224 from->postorder_number()); | 1234 from->postorder_number()); |
1225 } | 1235 } |
1226 | 1236 |
1227 } // namespace dart | 1237 } // namespace dart |
OLD | NEW |