Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Side by Side Diff: runtime/vm/jit_optimizer.cc

Issue 2894953002: Support inlining of calls where type arguments are passed to generic functions. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 91
92 bool JitOptimizer::TryCreateICData(InstanceCallInstr* call) { 92 bool JitOptimizer::TryCreateICData(InstanceCallInstr* call) {
93 ASSERT(call->HasICData()); 93 ASSERT(call->HasICData());
94 if (call->ic_data()->NumberOfUsedChecks() > 0) { 94 if (call->ic_data()->NumberOfUsedChecks() > 0) {
95 // This occurs when an instance call has too many checks, will be converted 95 // This occurs when an instance call has too many checks, will be converted
96 // to megamorphic call. 96 // to megamorphic call.
97 return false; 97 return false;
98 } 98 }
99 99
100 const intptr_t receiver_index = call->FirstParamIndex();
100 GrowableArray<intptr_t> class_ids(call->ic_data()->NumArgsTested()); 101 GrowableArray<intptr_t> class_ids(call->ic_data()->NumArgsTested());
101 ASSERT(call->ic_data()->NumArgsTested() <= call->ArgumentCount()); 102 ASSERT(call->ic_data()->NumArgsTested() <=
103 call->ArgumentCount() - receiver_index);
102 for (intptr_t i = 0; i < call->ic_data()->NumArgsTested(); i++) { 104 for (intptr_t i = 0; i < call->ic_data()->NumArgsTested(); i++) {
103 class_ids.Add(call->PushArgumentAt(i)->value()->Type()->ToCid()); 105 class_ids.Add(
106 call->PushArgumentAt(receiver_index + i)->value()->Type()->ToCid());
104 } 107 }
105 108
106 const Token::Kind op_kind = call->token_kind(); 109 const Token::Kind op_kind = call->token_kind();
107 if (Token::IsRelationalOperator(op_kind) || 110 if (Token::IsRelationalOperator(op_kind) ||
108 Token::IsEqualityOperator(op_kind) || Token::IsBinaryOperator(op_kind)) { 111 Token::IsEqualityOperator(op_kind) || Token::IsBinaryOperator(op_kind)) {
109 // Guess cid: if one of the inputs is a number assume that the other 112 // Guess cid: if one of the inputs is a number assume that the other
110 // is a number of same type. 113 // is a number of same type.
111 if (FLAG_guess_icdata_cid) { 114 if (FLAG_guess_icdata_cid) {
112 const intptr_t cid_0 = class_ids[0]; 115 const intptr_t cid_0 = class_ids[0];
113 const intptr_t cid_1 = class_ids[1]; 116 const intptr_t cid_1 = class_ids[1];
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 // Discard the environment from the original instruction because the store 1775 // Discard the environment from the original instruction because the store
1773 // can't deoptimize. 1776 // can't deoptimize.
1774 instr->RemoveEnvironment(); 1777 instr->RemoveEnvironment();
1775 ReplaceCall(instr, store); 1778 ReplaceCall(instr, store);
1776 return true; 1779 return true;
1777 } 1780 }
1778 1781
1779 1782
1780 } // namespace dart 1783 } // namespace dart
1781 #endif // DART_PRECOMPILED_RUNTIME 1784 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698