| 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/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 Environment::From(zone(), *env, num_non_copied_params_, parsed_function_); | 1035 Environment::From(zone(), *env, num_non_copied_params_, parsed_function_); |
| 1036 if (instr->IsClosureCall()) { | 1036 if (instr->IsClosureCall()) { |
| 1037 deopt_env = | 1037 deopt_env = |
| 1038 deopt_env->DeepCopy(zone(), deopt_env->Length() - instr->InputCount()); | 1038 deopt_env->DeepCopy(zone(), deopt_env->Length() - instr->InputCount()); |
| 1039 } | 1039 } |
| 1040 instr->SetEnvironment(deopt_env); | 1040 instr->SetEnvironment(deopt_env); |
| 1041 for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) { | 1041 for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) { |
| 1042 Value* use = it.CurrentValue(); | 1042 Value* use = it.CurrentValue(); |
| 1043 use->definition()->AddEnvUse(use); | 1043 use->definition()->AddEnvUse(use); |
| 1044 } | 1044 } |
| 1045 if (instr->CanDeoptimize()) { | 1045 if (instr->ComputeCanDeoptimize()) { |
| 1046 instr->env()->set_deopt_id(instr->deopt_id()); | 1046 instr->env()->set_deopt_id(instr->deopt_id()); |
| 1047 } | 1047 } |
| 1048 } | 1048 } |
| 1049 | 1049 |
| 1050 | 1050 |
| 1051 void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry, | 1051 void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry, |
| 1052 GrowableArray<Definition*>* env, | 1052 GrowableArray<Definition*>* env, |
| 1053 GrowableArray<PhiInstr*>* live_phis, | 1053 GrowableArray<PhiInstr*>* live_phis, |
| 1054 VariableLivenessAnalysis* variable_liveness) { | 1054 VariableLivenessAnalysis* variable_liveness) { |
| 1055 // 1. Process phis first. | 1055 // 1. Process phis first. |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2013 | 2013 |
| 2014 disallow_licm(); | 2014 disallow_licm(); |
| 2015 for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done(); | 2015 for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done(); |
| 2016 block_it.Advance()) { | 2016 block_it.Advance()) { |
| 2017 BlockEntryInstr* block = block_it.Current(); | 2017 BlockEntryInstr* block = block_it.Current(); |
| 2018 if (!block->IsCatchBlockEntry()) { | 2018 if (!block->IsCatchBlockEntry()) { |
| 2019 block->RemoveEnvironment(); | 2019 block->RemoveEnvironment(); |
| 2020 } | 2020 } |
| 2021 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { | 2021 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { |
| 2022 Instruction* current = it.Current(); | 2022 Instruction* current = it.Current(); |
| 2023 if (!current->CanDeoptimize() && | 2023 if (!current->ComputeCanDeoptimize() && |
| 2024 (!current->MayThrow() || !current->GetBlock()->InsideTryBlock())) { | 2024 (!current->MayThrow() || !current->GetBlock()->InsideTryBlock())) { |
| 2025 // Instructions that can throw need an environment for optimized | 2025 // Instructions that can throw need an environment for optimized |
| 2026 // try-catch. | 2026 // try-catch. |
| 2027 // TODO(srdjan): --source-lines needs deopt environments to get at | 2027 // TODO(srdjan): --source-lines needs deopt environments to get at |
| 2028 // the code for this instruction, however, leaving the environment | 2028 // the code for this instruction, however, leaving the environment |
| 2029 // changes code. | 2029 // changes code. |
| 2030 current->RemoveEnvironment(); | 2030 current->RemoveEnvironment(); |
| 2031 } | 2031 } |
| 2032 } | 2032 } |
| 2033 } | 2033 } |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 Representation rep, | 2299 Representation rep, |
| 2300 intptr_t cid) { | 2300 intptr_t cid) { |
| 2301 ExtractNthOutputInstr* extract = | 2301 ExtractNthOutputInstr* extract = |
| 2302 new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid); | 2302 new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid); |
| 2303 instr->ReplaceUsesWith(extract); | 2303 instr->ReplaceUsesWith(extract); |
| 2304 InsertAfter(instr, extract, NULL, FlowGraph::kValue); | 2304 InsertAfter(instr, extract, NULL, FlowGraph::kValue); |
| 2305 } | 2305 } |
| 2306 | 2306 |
| 2307 | 2307 |
| 2308 } // namespace dart | 2308 } // namespace dart |
| OLD | NEW |