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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/enqueue.dart

Issue 17580016: Limit the amount of inlining we do to try to avoid generating too much code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/builder.dart » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart2js; 5 part of dart2js;
6 6
7 class EnqueueTask extends CompilerTask { 7 class EnqueueTask extends CompilerTask {
8 final ResolutionEnqueuer resolution; 8 final ResolutionEnqueuer resolution;
9 final CodegenEnqueuer codegen; 9 final CodegenEnqueuer codegen;
10 10
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 enableNoSuchMethod(member); 230 enableNoSuchMethod(member);
231 } 231 }
232 if (member.name == Compiler.CALL_OPERATOR_NAME && 232 if (member.name == Compiler.CALL_OPERATOR_NAME &&
233 !cls.typeVariables.isEmpty) { 233 !cls.typeVariables.isEmpty) {
234 registerGenericCallMethod(member, compiler.globalDependencies); 234 registerGenericCallMethod(member, compiler.globalDependencies);
235 } 235 }
236 // If there is a property access with the same name as a method we 236 // If there is a property access with the same name as a method we
237 // need to emit the method. 237 // need to emit the method.
238 if (universe.hasInvokedGetter(member, compiler)) { 238 if (universe.hasInvokedGetter(member, compiler)) {
239 registerClosurizedMember(member, compiler.globalDependencies); 239 registerClosurizedMember(member, compiler.globalDependencies);
240 // We will emit a closure, so make sure the closure class is
241 // generated.
242 registerInstantiatedClass(compiler.boundClosureClass,
243 // Precise dependency is not important here.
244 compiler.globalDependencies);
245 return addToWorkList(member); 240 return addToWorkList(member);
246 } 241 }
247 // Store the member in [instanceFunctionsByName] to catch 242 // Store the member in [instanceFunctionsByName] to catch
248 // getters on the function. 243 // getters on the function.
249 Link<Element> members = instanceFunctionsByName.putIfAbsent( 244 Link<Element> members = instanceFunctionsByName.putIfAbsent(
250 memberName, () => const Link<Element>()); 245 memberName, () => const Link<Element>());
251 instanceFunctionsByName[memberName] = members.prepend(member); 246 instanceFunctionsByName[memberName] = members.prepend(member);
252 if (universe.hasInvocation(member, compiler)) { 247 if (universe.hasInvocation(member, compiler)) {
253 return addToWorkList(member); 248 return addToWorkList(member);
254 } 249 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 450 }
456 } 451 }
457 addToWorkList(member); 452 addToWorkList(member);
458 return true; 453 return true;
459 } 454 }
460 return false; 455 return false;
461 }); 456 });
462 if (selector.isGetter()) { 457 if (selector.isGetter()) {
463 processInstanceFunctions(methodName, (Element member) { 458 processInstanceFunctions(methodName, (Element member) {
464 if (selector.appliesUnnamed(member, compiler)) { 459 if (selector.appliesUnnamed(member, compiler)) {
465 // We will emit a closure, so make sure the bound closure class is 460 registerBoundClosure();
466 // generated.
467 registerInstantiatedClass(compiler.boundClosureClass,
468 // Precise dependency is not important here.
469 compiler.globalDependencies);
470 return true; 461 return true;
471 } 462 }
472 return false; 463 return false;
473 }); 464 });
474 } 465 }
475 } 466 }
476 467
477 /** 468 /**
478 * Documentation wanted -- johnniwinther 469 * Documentation wanted -- johnniwinther
479 * 470 *
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 void registerAsCheck(DartType type, TreeElements elements) { 537 void registerAsCheck(DartType type, TreeElements elements) {
547 registerIsCheck(type, elements); 538 registerIsCheck(type, elements);
548 compiler.backend.registerAsCheck(type, elements); 539 compiler.backend.registerAsCheck(type, elements);
549 } 540 }
550 541
551 void registerGenericCallMethod(Element element, TreeElements elements) { 542 void registerGenericCallMethod(Element element, TreeElements elements) {
552 compiler.backend.registerGenericCallMethod(element, this, elements); 543 compiler.backend.registerGenericCallMethod(element, this, elements);
553 universe.genericCallMethods.add(element); 544 universe.genericCallMethods.add(element);
554 } 545 }
555 546
547 void registerBoundClosure() {
548 registerInstantiatedClass(compiler.boundClosureClass,
549 // Precise dependency is not important here.
550 compiler.globalDependencies);
551 }
552
556 void registerClosurizedMember(Element element, TreeElements elements) { 553 void registerClosurizedMember(Element element, TreeElements elements) {
557 if (element.computeType(compiler).containsTypeVariables) { 554 if (element.computeType(compiler).containsTypeVariables) {
558 registerClosurizedGenericMember(element, elements); 555 registerClosurizedGenericMember(element, elements);
556 } else {
557 registerBoundClosure();
559 } 558 }
560 universe.closurizedMembers.add(element); 559 universe.closurizedMembers.add(element);
561 } 560 }
562 561
563 void registerClosurizedGenericMember(Element element, TreeElements elements) { 562 void registerClosurizedGenericMember(Element element, TreeElements elements) {
563 registerBoundClosure();
564 compiler.backend.registerGenericClosure(element, this, elements); 564 compiler.backend.registerGenericClosure(element, this, elements);
565 universe.closurizedGenericMembers.add(element); 565 universe.closurizedGenericMembers.add(element);
566 } 566 }
567 567
568 void forEach(f(WorkItem work)); 568 void forEach(f(WorkItem work));
569 569
570 void forEachPostProcessTask(f(PostProcessTask work)) {} 570 void forEachPostProcessTask(f(PostProcessTask work)) {}
571 571
572 void logSummary(log(message)) { 572 void logSummary(log(message)) {
573 _logSpecificSummary(log); 573 _logSpecificSummary(log);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 while(!queue.isEmpty) { 763 while(!queue.isEmpty) {
764 // TODO(johnniwinther): Find an optimal process order for codegen. 764 // TODO(johnniwinther): Find an optimal process order for codegen.
765 f(queue.removeLast()); 765 f(queue.removeLast());
766 } 766 }
767 } 767 }
768 768
769 void _logSpecificSummary(log(message)) { 769 void _logSpecificSummary(log(message)) {
770 log('Compiled ${generatedCode.length} methods.'); 770 log('Compiled ${generatedCode.length} methods.');
771 } 771 }
772 } 772 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698