| 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/flow_graph_builder.h" | 7 #include "vm/flow_graph_builder.h" |
| 8 #include "vm/il_printer.h" | 8 #include "vm/il_printer.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 | 10 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 323 |
| 324 | 324 |
| 325 void FlowGraphOptimizer::VisitInstanceSetter(InstanceSetterComp* comp) { | 325 void FlowGraphOptimizer::VisitInstanceSetter(InstanceSetterComp* comp) { |
| 326 // TODO(srdjan): Add assigneable check node if --enable_type_checks. | 326 // TODO(srdjan): Add assigneable check node if --enable_type_checks. |
| 327 if (comp->HasICData() && !FLAG_enable_type_checks) { | 327 if (comp->HasICData() && !FLAG_enable_type_checks) { |
| 328 TryInlineInstanceSetter(comp); | 328 TryInlineInstanceSetter(comp); |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 | 332 |
| 333 void FlowGraphOptimizer::VisitLoadIndexed(LoadIndexedComp* comp) { |
| 334 if (!comp->HasICData()) return; |
| 335 |
| 336 const ICData& ic_data = *comp->ic_data(); |
| 337 if (ic_data.NumberOfChecks() == 0) return; |
| 338 if (!HasOneTarget(ic_data)) return; |
| 339 |
| 340 Function& target = Function::Handle(); |
| 341 Class& cls = Class::Handle(); |
| 342 ic_data.GetOneClassCheckAt(0, &cls, &target); |
| 343 |
| 344 switch (cls.id()) { |
| 345 case kArray: |
| 346 case kImmutableArray: |
| 347 case kGrowableObjectArray: |
| 348 comp->set_receiver_type(static_cast<ObjectKind>(cls.id())); |
| 349 } |
| 350 } |
| 351 |
| 352 |
| 333 void FlowGraphOptimizer::VisitDo(DoInstr* instr) { | 353 void FlowGraphOptimizer::VisitDo(DoInstr* instr) { |
| 334 instr->computation()->Accept(this); | 354 instr->computation()->Accept(this); |
| 335 } | 355 } |
| 336 | 356 |
| 337 | 357 |
| 338 void FlowGraphOptimizer::VisitBind(BindInstr* instr) { | 358 void FlowGraphOptimizer::VisitBind(BindInstr* instr) { |
| 339 instr->computation()->Accept(this); | 359 instr->computation()->Accept(this); |
| 340 } | 360 } |
| 341 | 361 |
| 342 | 362 |
| 343 } // namespace dart | 363 } // namespace dart |
| OLD | NEW |