| 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 #ifndef DART_PRECOMPILED_RUNTIME | 4 #ifndef DART_PRECOMPILED_RUNTIME |
| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 | 92 |
| 93 bool JitOptimizer::TryCreateICData(InstanceCallInstr* call) { | 93 bool JitOptimizer::TryCreateICData(InstanceCallInstr* call) { |
| 94 ASSERT(call->HasICData()); | 94 ASSERT(call->HasICData()); |
| 95 if (call->ic_data()->NumberOfUsedChecks() > 0) { | 95 if (call->ic_data()->NumberOfUsedChecks() > 0) { |
| 96 // This occurs when an instance call has too many checks, will be converted | 96 // This occurs when an instance call has too many checks, will be converted |
| 97 // to megamorphic call. | 97 // to megamorphic call. |
| 98 return false; | 98 return false; |
| 99 } | 99 } |
| 100 | 100 |
| 101 const intptr_t receiver_index = call->FirstParamIndex(); |
| 101 GrowableArray<intptr_t> class_ids(call->ic_data()->NumArgsTested()); | 102 GrowableArray<intptr_t> class_ids(call->ic_data()->NumArgsTested()); |
| 102 ASSERT(call->ic_data()->NumArgsTested() <= call->ArgumentCount()); | 103 ASSERT(call->ic_data()->NumArgsTested() <= |
| 104 call->ArgumentCountWithoutTypeArgs()); |
| 103 for (intptr_t i = 0; i < call->ic_data()->NumArgsTested(); i++) { | 105 for (intptr_t i = 0; i < call->ic_data()->NumArgsTested(); i++) { |
| 104 class_ids.Add(call->PushArgumentAt(i)->value()->Type()->ToCid()); | 106 class_ids.Add( |
| 107 call->PushArgumentAt(receiver_index + i)->value()->Type()->ToCid()); |
| 105 } | 108 } |
| 106 | 109 |
| 107 const Token::Kind op_kind = call->token_kind(); | 110 const Token::Kind op_kind = call->token_kind(); |
| 108 if (Token::IsRelationalOperator(op_kind) || | 111 if (Token::IsRelationalOperator(op_kind) || |
| 109 Token::IsEqualityOperator(op_kind) || Token::IsBinaryOperator(op_kind)) { | 112 Token::IsEqualityOperator(op_kind) || Token::IsBinaryOperator(op_kind)) { |
| 110 // Guess cid: if one of the inputs is a number assume that the other | 113 // Guess cid: if one of the inputs is a number assume that the other |
| 111 // is a number of same type. | 114 // is a number of same type. |
| 112 if (FLAG_guess_icdata_cid) { | 115 if (FLAG_guess_icdata_cid) { |
| 113 const intptr_t cid_0 = class_ids[0]; | 116 const intptr_t cid_0 = class_ids[0]; |
| 114 const intptr_t cid_1 = class_ids[1]; | 117 const intptr_t cid_1 = class_ids[1]; |
| (...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1719 // Discard the environment from the original instruction because the store | 1722 // Discard the environment from the original instruction because the store |
| 1720 // can't deoptimize. | 1723 // can't deoptimize. |
| 1721 instr->RemoveEnvironment(); | 1724 instr->RemoveEnvironment(); |
| 1722 ReplaceCall(instr, store); | 1725 ReplaceCall(instr, store); |
| 1723 return true; | 1726 return true; |
| 1724 } | 1727 } |
| 1725 | 1728 |
| 1726 | 1729 |
| 1727 } // namespace dart | 1730 } // namespace dart |
| 1728 #endif // DART_PRECOMPILED_RUNTIME | 1731 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |