| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 return class_id; | 306 return class_id; |
| 307 } | 307 } |
| 308 | 308 |
| 309 | 309 |
| 310 void FlowGraphOptimizer::AddCheckClass(BindInstr* instr, | 310 void FlowGraphOptimizer::AddCheckClass(BindInstr* instr, |
| 311 InstanceCallComp* comp, | 311 InstanceCallComp* comp, |
| 312 Value* value) { | 312 Value* value) { |
| 313 // Type propagation has not run yet, we cannot eliminate the check. | 313 // Type propagation has not run yet, we cannot eliminate the check. |
| 314 const ICData& unary_checks = | 314 const ICData& unary_checks = |
| 315 ICData::ZoneHandle(comp->ic_data()->AsUnaryClassChecks()); | 315 ICData::ZoneHandle(comp->ic_data()->AsUnaryClassChecks()); |
| 316 CheckNonSmiComp* check_non_smi = new CheckNonSmiComp(value->Copy(), | 316 CheckClassComp* check = new CheckClassComp(value, comp, unary_checks); |
| 317 comp->deopt_id()); | 317 InsertBefore(instr, check, instr->env(), Definition::kEffect); |
| 318 InsertBefore(instr, check_non_smi, instr->env(), Definition::kEffect); | |
| 319 CheckClassComp* check_class = new CheckClassComp(value, comp, unary_checks); | |
| 320 InsertBefore(instr, check_class, instr->env(), Definition::kEffect); | |
| 321 } | 318 } |
| 322 | 319 |
| 323 | 320 |
| 324 bool FlowGraphOptimizer::TryReplaceWithArrayOp(BindInstr* instr, | 321 bool FlowGraphOptimizer::TryReplaceWithArrayOp(BindInstr* instr, |
| 325 InstanceCallComp* comp, | 322 InstanceCallComp* comp, |
| 326 Token::Kind op_kind) { | 323 Token::Kind op_kind) { |
| 327 // TODO(fschneider): Optimize []= operator in checked mode as well. | 324 // TODO(fschneider): Optimize []= operator in checked mode as well. |
| 328 if (op_kind == Token::kASSIGN_INDEX && FLAG_enable_type_checks) return false; | 325 if (op_kind == Token::kASSIGN_INDEX && FLAG_enable_type_checks) return false; |
| 329 | 326 |
| 330 const intptr_t class_id = ReceiverClassId(comp); | 327 const intptr_t class_id = ReceiverClassId(comp); |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map. | 1199 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map. |
| 1203 OptimizeRecursive(child, &child_map); | 1200 OptimizeRecursive(child, &child_map); |
| 1204 } else { | 1201 } else { |
| 1205 OptimizeRecursive(child, map); // Reuse map for the last child. | 1202 OptimizeRecursive(child, map); // Reuse map for the last child. |
| 1206 } | 1203 } |
| 1207 } | 1204 } |
| 1208 } | 1205 } |
| 1209 | 1206 |
| 1210 | 1207 |
| 1211 } // namespace dart | 1208 } // namespace dart |
| OLD | NEW |