| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/jit_optimizer.h" | 5 #include "vm/jit_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/branch_optimizer.h" | 8 #include "vm/branch_optimizer.h" |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 push->ReplaceUsesWith(push->value()->definition()); | 2683 push->ReplaceUsesWith(push->value()->definition()); |
| 2684 push->RemoveFromGraph(); | 2684 push->RemoveFromGraph(); |
| 2685 } | 2685 } |
| 2686 // Remove call, replace it with 'left'. | 2686 // Remove call, replace it with 'left'. |
| 2687 call->ReplaceUsesWith(left); | 2687 call->ReplaceUsesWith(left); |
| 2688 ASSERT(current_iterator()->Current() == call); | 2688 ASSERT(current_iterator()->Current() == call); |
| 2689 current_iterator()->RemoveCurrentFromGraph(); | 2689 current_iterator()->RemoveCurrentFromGraph(); |
| 2690 return; | 2690 return; |
| 2691 } | 2691 } |
| 2692 } | 2692 } |
| 2693 const String& dst_name = String::ZoneHandle(Z, | |
| 2694 Symbols::New(Exceptions::kCastErrorDstName)); | |
| 2695 AssertAssignableInstr* assert_as = | 2693 AssertAssignableInstr* assert_as = |
| 2696 new(Z) AssertAssignableInstr(call->token_pos(), | 2694 new(Z) AssertAssignableInstr(call->token_pos(), |
| 2697 new(Z) Value(left), | 2695 new(Z) Value(left), |
| 2698 new(Z) Value(type_args), | 2696 new(Z) Value(type_args), |
| 2699 type, | 2697 type, |
| 2700 dst_name, | 2698 Symbols::InTypeCast(), |
| 2701 call->deopt_id()); | 2699 call->deopt_id()); |
| 2702 ReplaceCall(call, assert_as); | 2700 ReplaceCall(call, assert_as); |
| 2703 } | 2701 } |
| 2704 | 2702 |
| 2705 | 2703 |
| 2706 // Tries to optimize instance call by replacing it with a faster instruction | 2704 // Tries to optimize instance call by replacing it with a faster instruction |
| 2707 // (e.g, binary op, field load, ..). | 2705 // (e.g, binary op, field load, ..). |
| 2708 void JitOptimizer::VisitInstanceCall(InstanceCallInstr* instr) { | 2706 void JitOptimizer::VisitInstanceCall(InstanceCallInstr* instr) { |
| 2709 if (!instr->HasICData() || (instr->ic_data()->NumberOfUsedChecks() == 0)) { | 2707 if (!instr->HasICData() || (instr->ic_data()->NumberOfUsedChecks() == 0)) { |
| 2710 return; | 2708 return; |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3153 | 3151 |
| 3154 // Discard the environment from the original instruction because the store | 3152 // Discard the environment from the original instruction because the store |
| 3155 // can't deoptimize. | 3153 // can't deoptimize. |
| 3156 instr->RemoveEnvironment(); | 3154 instr->RemoveEnvironment(); |
| 3157 ReplaceCall(instr, store); | 3155 ReplaceCall(instr, store); |
| 3158 return true; | 3156 return true; |
| 3159 } | 3157 } |
| 3160 | 3158 |
| 3161 | 3159 |
| 3162 } // namespace dart | 3160 } // namespace dart |
| OLD | NEW |