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

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

Issue 340023003: Various caches for incremental compilation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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
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 typedef ItemCompilationContext ItemCompilationContextCreator(); 7 typedef ItemCompilationContext ItemCompilationContextCreator();
8 8
9 class EnqueueTask extends CompilerTask { 9 class EnqueueTask extends CompilerTask {
10 final ResolutionEnqueuer resolution; 10 final ResolutionEnqueuer resolution;
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 log('Resolved ${resolvedElements.length} elements.'); 714 log('Resolved ${resolvedElements.length} elements.');
715 } 715 }
716 } 716 }
717 717
718 /// [Enqueuer] which is specific to code generation. 718 /// [Enqueuer] which is specific to code generation.
719 class CodegenEnqueuer extends Enqueuer { 719 class CodegenEnqueuer extends Enqueuer {
720 final Queue<CodegenWorkItem> queue; 720 final Queue<CodegenWorkItem> queue;
721 final Map<Element, js.Expression> generatedCode = 721 final Map<Element, js.Expression> generatedCode =
722 new Map<Element, js.Expression>(); 722 new Map<Element, js.Expression>();
723 723
724 final Set<Element> newlyEnqueuedElements = new HashSet<Element>.identity();
Johnni Winther 2014/06/19 09:22:32 Element equality is object identity so why do you
ahe 2014/06/19 09:36:19 Good point. I'll investigate if it matters. I doub
ahe 2014/06/19 13:50:10 I'm not sure I have specific evidence for this par
725
724 CodegenEnqueuer(Compiler compiler, 726 CodegenEnqueuer(Compiler compiler,
725 ItemCompilationContext itemCompilationContextCreator()) 727 ItemCompilationContext itemCompilationContextCreator())
726 : super('codegen enqueuer', compiler, itemCompilationContextCreator), 728 : super('codegen enqueuer', compiler, itemCompilationContextCreator),
727 queue = new Queue<CodegenWorkItem>(); 729 queue = new Queue<CodegenWorkItem>();
728 730
729 bool isProcessed(Element member) => 731 bool isProcessed(Element member) =>
730 member.isAbstract || generatedCode.containsKey(member); 732 member.isAbstract || generatedCode.containsKey(member);
731 733
732 void internalAddToWorkList(Element element) { 734 void internalAddToWorkList(Element element) {
735 if (compiler.hasIncrementalSupport) {
736 newlyEnqueuedElements.add(element);
737 }
733 // Don't generate code for foreign elements. 738 // Don't generate code for foreign elements.
734 if (element.isForeign(compiler)) return; 739 if (element.isForeign(compiler)) return;
735 740
736 // Codegen inlines field initializers. It only needs to generate 741 // Codegen inlines field initializers. It only needs to generate
737 // code for checked setters. 742 // code for checked setters.
738 if (element.isField && element.isInstanceMember) { 743 if (element.isField && element.isInstanceMember) {
739 if (!compiler.enableTypeAssertions 744 if (!compiler.enableTypeAssertions
740 || element.enclosingElement.isClosure) { 745 || element.enclosingElement.isClosure) {
741 return; 746 return;
742 } 747 }
743 } 748 }
744 749
745 if (queueIsClosed) { 750 if (queueIsClosed) {
746 throw new SpannableAssertionFailure(element, 751 throw new SpannableAssertionFailure(element,
747 "Codegen work list is closed. Trying to add $element"); 752 "Codegen work list is closed. Trying to add $element");
748 } 753 }
749 CodegenWorkItem workItem = new CodegenWorkItem( 754 CodegenWorkItem workItem = new CodegenWorkItem(
750 element, itemCompilationContextCreator()); 755 element, itemCompilationContextCreator());
751 queue.add(workItem); 756 queue.add(workItem);
752 } 757 }
753 758
754 void _logSpecificSummary(log(message)) { 759 void _logSpecificSummary(log(message)) {
755 log('Compiled ${generatedCode.length} methods.'); 760 log('Compiled ${generatedCode.length} methods.');
756 } 761 }
757 } 762 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698