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

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

Issue 1634903003: Remove restriction with method resolution in background compilation, now that (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | no next file » | 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 4
5 #include "vm/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 if (all_cids_known) { 219 if (all_cids_known) {
220 const Class& receiver_class = Class::Handle(Z, 220 const Class& receiver_class = Class::Handle(Z,
221 isolate()->class_table()->At(class_ids[0])); 221 isolate()->class_table()->At(class_ids[0]));
222 if (!receiver_class.is_finalized()) { 222 if (!receiver_class.is_finalized()) {
223 // Do not eagerly finalize classes. ResolveDynamicForReceiverClass can 223 // Do not eagerly finalize classes. ResolveDynamicForReceiverClass can
224 // cause class finalization, since callee's receiver class may not be 224 // cause class finalization, since callee's receiver class may not be
225 // finalized yet. 225 // finalized yet.
226 return false; 226 return false;
227 } 227 }
228 // Do not run the optimization below if in background compilation since
229 // resolution of method extractor functions may create new signature
230 // classes.
231 // TODO(regis): Remove test for background compilation once signature
232 // classes are not generated any longer.
233 if (!thread()->IsMutatorThread()) {
234 return false;
235 }
236 const Array& args_desc_array = Array::Handle(Z, 228 const Array& args_desc_array = Array::Handle(Z,
237 ArgumentsDescriptor::New(call->ArgumentCount(), 229 ArgumentsDescriptor::New(call->ArgumentCount(),
238 call->argument_names())); 230 call->argument_names()));
239 ArgumentsDescriptor args_desc(args_desc_array); 231 ArgumentsDescriptor args_desc(args_desc_array);
240 const Function& function = Function::Handle(Z, 232 const Function& function = Function::Handle(Z,
241 Resolver::ResolveDynamicForReceiverClass( 233 Resolver::ResolveDynamicForReceiverClass(
242 receiver_class, 234 receiver_class,
243 call->function_name(), 235 call->function_name(),
244 args_desc)); 236 args_desc));
245 if (function.IsNull()) { 237 if (function.IsNull()) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 const intptr_t cid = Class::Handle(Z, target_function.Owner()).id(); 269 const intptr_t cid = Class::Handle(Z, target_function.Owner()).id();
278 const ICData& ic_data = ICData::ZoneHandle(Z, 270 const ICData& ic_data = ICData::ZoneHandle(Z,
279 ICData::NewFrom(*call->ic_data(), 1)); 271 ICData::NewFrom(*call->ic_data(), 1));
280 ic_data.AddReceiverCheck(cid, target_function); 272 ic_data.AddReceiverCheck(cid, target_function);
281 call->set_ic_data(&ic_data); 273 call->set_ic_data(&ic_data);
282 return true; 274 return true;
283 } 275 }
284 } 276 }
285 277
286 // Check if getter or setter in function's class and class is currently leaf. 278 // Check if getter or setter in function's class and class is currently leaf.
287 // Do not run the optimization below if in background compilation since 279 if (FLAG_guess_icdata_cid &&
288 // resolution of getter functions may create new signature classes.
289 // TODO(regis): Remove test for background compilation once signature classes
290 // are not generated any longer.
291 if (thread()->IsMutatorThread() &&
292 FLAG_guess_icdata_cid &&
293 ((call->token_kind() == Token::kGET) || 280 ((call->token_kind() == Token::kGET) ||
294 (call->token_kind() == Token::kSET))) { 281 (call->token_kind() == Token::kSET))) {
295 const Class& owner_class = Class::Handle(Z, function().Owner()); 282 const Class& owner_class = Class::Handle(Z, function().Owner());
296 if (!owner_class.is_abstract() && 283 if (!owner_class.is_abstract() &&
297 !CHA::HasSubclasses(owner_class) && 284 !CHA::HasSubclasses(owner_class) &&
298 !CHA::IsImplemented(owner_class)) { 285 !CHA::IsImplemented(owner_class)) {
299 const Array& args_desc_array = Array::Handle(Z, 286 const Array& args_desc_array = Array::Handle(Z,
300 ArgumentsDescriptor::New(call->ArgumentCount(), 287 ArgumentsDescriptor::New(call->ArgumentCount(),
301 call->argument_names())); 288 call->argument_names()));
302 ArgumentsDescriptor args_desc(args_desc_array); 289 ArgumentsDescriptor args_desc(args_desc_array);
(...skipping 8556 matching lines...) Expand 10 before | Expand all | Expand 10 after
8859 8846
8860 // Insert materializations at environment uses. 8847 // Insert materializations at environment uses.
8861 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 8848 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
8862 CreateMaterializationAt( 8849 CreateMaterializationAt(
8863 exits_collector_.exits()[i], alloc, *slots); 8850 exits_collector_.exits()[i], alloc, *slots);
8864 } 8851 }
8865 } 8852 }
8866 8853
8867 8854
8868 } // namespace dart 8855 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698