| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 return; | 373 return; |
| 374 } | 374 } |
| 375 const intptr_t kMaxChecks = 4; | 375 const intptr_t kMaxChecks = 4; |
| 376 if (comp->ic_data()->NumberOfChecks() <= kMaxChecks) { | 376 if (comp->ic_data()->NumberOfChecks() <= kMaxChecks) { |
| 377 PolymorphicInstanceCallComp* call = new PolymorphicInstanceCallComp(comp); | 377 PolymorphicInstanceCallComp* call = new PolymorphicInstanceCallComp(comp); |
| 378 ICData& unary_checks = | 378 ICData& unary_checks = |
| 379 ICData::ZoneHandle(comp->ic_data()->AsUnaryClassChecks()); | 379 ICData::ZoneHandle(comp->ic_data()->AsUnaryClassChecks()); |
| 380 call->set_ic_data(&unary_checks); | 380 call->set_ic_data(&unary_checks); |
| 381 instr->set_computation(call); | 381 instr->set_computation(call); |
| 382 } | 382 } |
| 383 } else { | |
| 384 // Mark it for deopt. | |
| 385 PolymorphicInstanceCallComp* call = new PolymorphicInstanceCallComp(comp); | |
| 386 call->set_ic_data(&ICData::ZoneHandle()); | |
| 387 instr->set_computation(call); | |
| 388 } | 383 } |
| 384 // An instance call without ICData should continue calling via IC calls |
| 385 // which should trigger reoptimization of optimized code. |
| 389 } | 386 } |
| 390 | 387 |
| 391 | 388 |
| 392 void FlowGraphOptimizer::VisitStaticCall(StaticCallComp* comp, | 389 void FlowGraphOptimizer::VisitStaticCall(StaticCallComp* comp, |
| 393 BindInstr* instr) { | 390 BindInstr* instr) { |
| 394 MethodRecognizer::Kind recognized_kind = | 391 MethodRecognizer::Kind recognized_kind = |
| 395 MethodRecognizer::RecognizeKind(comp->function()); | 392 MethodRecognizer::RecognizeKind(comp->function()); |
| 396 if (recognized_kind == MethodRecognizer::kMathSqrt) { | 393 if (recognized_kind == MethodRecognizer::kMathSqrt) { |
| 397 comp->set_recognized(MethodRecognizer::kMathSqrt); | 394 comp->set_recognized(MethodRecognizer::kMathSqrt); |
| 398 } | 395 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 LocationSummary* locs = it.Current()->locs(); | 594 LocationSummary* locs = it.Current()->locs(); |
| 598 if ((locs != NULL) && locs->is_call()) { | 595 if ((locs != NULL) && locs->is_call()) { |
| 599 is_leaf_ = false; | 596 is_leaf_ = false; |
| 600 return; | 597 return; |
| 601 } | 598 } |
| 602 } | 599 } |
| 603 } | 600 } |
| 604 } | 601 } |
| 605 | 602 |
| 606 } // namespace dart | 603 } // namespace dart |
| OLD | NEW |