| 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_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/cha.h" | 7 #include "vm/cha.h" |
| 8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
| 9 #include "vm/hash_map.h" | 9 #include "vm/hash_map.h" |
| 10 #include "vm/il_printer.h" | 10 #include "vm/il_printer.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 return false; | 245 return false; |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 | 249 |
| 250 BindInstr* FlowGraphOptimizer::InsertBefore(Instruction* instr, | 250 BindInstr* FlowGraphOptimizer::InsertBefore(Instruction* instr, |
| 251 Computation* comp, | 251 Computation* comp, |
| 252 Environment* env, | 252 Environment* env, |
| 253 BindInstr::UseKind use_kind) { | 253 BindInstr::UseKind use_kind) { |
| 254 BindInstr* bind = new BindInstr(use_kind, comp); | 254 BindInstr* bind = new BindInstr(use_kind, comp); |
| 255 if (env != NULL) bind->set_env(env->Copy()); | 255 if (env != NULL) env->CopyTo(bind); |
| 256 if (use_kind == BindInstr::kUsed) { | 256 if (use_kind == BindInstr::kUsed) { |
| 257 bind->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index()); | 257 bind->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index()); |
| 258 } | 258 } |
| 259 bind->InsertBefore(instr); | 259 bind->InsertBefore(instr); |
| 260 return bind; | 260 return bind; |
| 261 } | 261 } |
| 262 | 262 |
| 263 | 263 |
| 264 BindInstr* FlowGraphOptimizer::InsertAfter(Instruction* instr, | 264 BindInstr* FlowGraphOptimizer::InsertAfter(Instruction* instr, |
| 265 Computation* comp, | 265 Computation* comp, |
| 266 Environment* env, | 266 Environment* env, |
| 267 BindInstr::UseKind use_kind) { | 267 BindInstr::UseKind use_kind) { |
| 268 BindInstr* bind = new BindInstr(use_kind, comp); | 268 BindInstr* bind = new BindInstr(use_kind, comp); |
| 269 if (env != NULL) bind->set_env(env->Copy()); | 269 if (env != NULL) env->CopyTo(bind); |
| 270 if (use_kind == BindInstr::kUsed) { | 270 if (use_kind == BindInstr::kUsed) { |
| 271 bind->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index()); | 271 bind->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index()); |
| 272 } | 272 } |
| 273 bind->InsertAfter(instr); | 273 bind->InsertAfter(instr); |
| 274 return bind; | 274 return bind; |
| 275 } | 275 } |
| 276 | 276 |
| 277 | 277 |
| 278 bool FlowGraphOptimizer::TryReplaceWithBinaryOp(BindInstr* instr, | 278 bool FlowGraphOptimizer::TryReplaceWithBinaryOp(BindInstr* instr, |
| 279 InstanceCallComp* comp, | 279 InstanceCallComp* comp, |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map. | 1049 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map. |
| 1050 OptimizeRecursive(child, &child_map); | 1050 OptimizeRecursive(child, &child_map); |
| 1051 } else { | 1051 } else { |
| 1052 OptimizeRecursive(child, map); // Reuse map for the last child. | 1052 OptimizeRecursive(child, map); // Reuse map for the last child. |
| 1053 } | 1053 } |
| 1054 } | 1054 } |
| 1055 } | 1055 } |
| 1056 | 1056 |
| 1057 | 1057 |
| 1058 } // namespace dart | 1058 } // namespace dart |
| OLD | NEW |