| 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->ComputeCanDeoptimize()) { | 1045 if (instr->CanDeoptimize()) { |
| 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 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 | 2014 |
| 2015 disallow_licm(); | 2015 disallow_licm(); |
| 2016 for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done(); | 2016 for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done(); |
| 2017 block_it.Advance()) { | 2017 block_it.Advance()) { |
| 2018 BlockEntryInstr* block = block_it.Current(); | 2018 BlockEntryInstr* block = block_it.Current(); |
| 2019 if (!block->IsCatchBlockEntry()) { | 2019 if (!block->IsCatchBlockEntry()) { |
| 2020 block->RemoveEnvironment(); | 2020 block->RemoveEnvironment(); |
| 2021 } | 2021 } |
| 2022 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { | 2022 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { |
| 2023 Instruction* current = it.Current(); | 2023 Instruction* current = it.Current(); |
| 2024 if (!current->ComputeCanDeoptimize() && | 2024 if (!current->CanDeoptimize() && |
| 2025 (!current->MayThrow() || !current->GetBlock()->InsideTryBlock())) { | 2025 (!current->MayThrow() || !current->GetBlock()->InsideTryBlock())) { |
| 2026 // Instructions that can throw need an environment for optimized | 2026 // Instructions that can throw need an environment for optimized |
| 2027 // try-catch. | 2027 // try-catch. |
| 2028 // TODO(srdjan): --source-lines needs deopt environments to get at | 2028 // TODO(srdjan): --source-lines needs deopt environments to get at |
| 2029 // the code for this instruction, however, leaving the environment | 2029 // the code for this instruction, however, leaving the environment |
| 2030 // changes code. | 2030 // changes code. |
| 2031 current->RemoveEnvironment(); | 2031 current->RemoveEnvironment(); |
| 2032 } | 2032 } |
| 2033 } | 2033 } |
| 2034 } | 2034 } |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2300 Representation rep, | 2300 Representation rep, |
| 2301 intptr_t cid) { | 2301 intptr_t cid) { |
| 2302 ExtractNthOutputInstr* extract = | 2302 ExtractNthOutputInstr* extract = |
| 2303 new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid); | 2303 new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid); |
| 2304 instr->ReplaceUsesWith(extract); | 2304 instr->ReplaceUsesWith(extract); |
| 2305 InsertAfter(instr, extract, NULL, FlowGraph::kValue); | 2305 InsertAfter(instr, extract, NULL, FlowGraph::kValue); |
| 2306 } | 2306 } |
| 2307 | 2307 |
| 2308 | 2308 |
| 2309 } // namespace dart | 2309 } // namespace dart |
| OLD | NEW |