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

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

Issue 2859673002: Pass type argument vector to generic functions (if --reify-generic-functions is (Closed)
Patch Set: address review comments and sync 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
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/kernel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 if (all_cids_known) { 131 if (all_cids_known) {
132 const Class& receiver_class = 132 const Class& receiver_class =
133 Class::Handle(Z, isolate()->class_table()->At(class_ids[0])); 133 Class::Handle(Z, isolate()->class_table()->At(class_ids[0]));
134 if (!receiver_class.is_finalized()) { 134 if (!receiver_class.is_finalized()) {
135 // Do not eagerly finalize classes. ResolveDynamicForReceiverClass can 135 // Do not eagerly finalize classes. ResolveDynamicForReceiverClass can
136 // cause class finalization, since callee's receiver class may not be 136 // cause class finalization, since callee's receiver class may not be
137 // finalized yet. 137 // finalized yet.
138 return false; 138 return false;
139 } 139 }
140 const Array& args_desc_array = 140 ArgumentsDescriptor args_desc(
141 Array::Handle(Z, ArgumentsDescriptor::New(call->ArgumentCount(), 141 Array::Handle(Z, call->GetArgumentsDescriptor()));
142 call->argument_names()));
143 ArgumentsDescriptor args_desc(args_desc_array);
144 bool allow_add = false; 142 bool allow_add = false;
145 const Function& function = Function::Handle( 143 const Function& function = Function::Handle(
146 Z, Resolver::ResolveDynamicForReceiverClass( 144 Z, Resolver::ResolveDynamicForReceiverClass(
147 receiver_class, call->function_name(), args_desc, allow_add)); 145 receiver_class, call->function_name(), args_desc, allow_add));
148 if (function.IsNull()) { 146 if (function.IsNull()) {
149 return false; 147 return false;
150 } 148 }
151 149
152 // Create new ICData, do not modify the one attached to the instruction 150 // Create new ICData, do not modify the one attached to the instruction
153 // since it is attached to the assembly instruction itself. 151 // since it is attached to the assembly instruction itself.
(...skipping 10 matching lines...) Expand all
164 call->set_ic_data(&ic_data); 162 call->set_ic_data(&ic_data);
165 return true; 163 return true;
166 } 164 }
167 165
168 // Check if getter or setter in function's class and class is currently leaf. 166 // Check if getter or setter in function's class and class is currently leaf.
169 if (FLAG_guess_icdata_cid && ((call->token_kind() == Token::kGET) || 167 if (FLAG_guess_icdata_cid && ((call->token_kind() == Token::kGET) ||
170 (call->token_kind() == Token::kSET))) { 168 (call->token_kind() == Token::kSET))) {
171 const Class& owner_class = Class::Handle(Z, function().Owner()); 169 const Class& owner_class = Class::Handle(Z, function().Owner());
172 if (!owner_class.is_abstract() && !CHA::HasSubclasses(owner_class) && 170 if (!owner_class.is_abstract() && !CHA::HasSubclasses(owner_class) &&
173 !CHA::IsImplemented(owner_class)) { 171 !CHA::IsImplemented(owner_class)) {
174 const Array& args_desc_array = 172 const int kTypeArgsLen = 0;
175 Array::Handle(Z, ArgumentsDescriptor::New(call->ArgumentCount(), 173 ASSERT(call->type_args_len() == kTypeArgsLen);
176 call->argument_names())); 174 const Array& args_desc_array = Array::Handle(
175 Z, ArgumentsDescriptor::New(kTypeArgsLen, call->ArgumentCount(),
176 call->argument_names()));
177 ArgumentsDescriptor args_desc(args_desc_array); 177 ArgumentsDescriptor args_desc(args_desc_array);
178 bool allow_add = false; 178 bool allow_add = false;
179 const Function& function = Function::Handle( 179 const Function& function = Function::Handle(
180 Z, Resolver::ResolveDynamicForReceiverClass( 180 Z, Resolver::ResolveDynamicForReceiverClass(
181 owner_class, call->function_name(), args_desc, allow_add)); 181 owner_class, call->function_name(), args_desc, allow_add));
182 if (!function.IsNull()) { 182 if (!function.IsNull()) {
183 const ICData& ic_data = ICData::ZoneHandle( 183 const ICData& ic_data = ICData::ZoneHandle(
184 Z, ICData::NewFrom(*call->ic_data(), class_ids.length())); 184 Z, ICData::NewFrom(*call->ic_data(), class_ids.length()));
185 ic_data.AddReceiverCheck(owner_class.id(), function); 185 ic_data.AddReceiverCheck(owner_class.id(), function);
186 call->set_ic_data(&ic_data); 186 call->set_ic_data(&ic_data);
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 // Discard the environment from the original instruction because the store 1778 // Discard the environment from the original instruction because the store
1779 // can't deoptimize. 1779 // can't deoptimize.
1780 instr->RemoveEnvironment(); 1780 instr->RemoveEnvironment();
1781 ReplaceCall(instr, store); 1781 ReplaceCall(instr, store);
1782 return true; 1782 return true;
1783 } 1783 }
1784 1784
1785 1785
1786 } // namespace dart 1786 } // namespace dart
1787 #endif // DART_PRECOMPILED_RUNTIME 1787 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/kernel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698