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

Side by Side Diff: dart/pkg/compiler/lib/src/enqueue.dart

Issue 740273003: Incremental compiler: support optional arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r42234. Created 6 years 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 | dart/pkg/compiler/lib/src/js_backend/backend.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 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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 } 805 }
806 806
807 /// [Enqueuer] which is specific to code generation. 807 /// [Enqueuer] which is specific to code generation.
808 class CodegenEnqueuer extends Enqueuer { 808 class CodegenEnqueuer extends Enqueuer {
809 final Queue<CodegenWorkItem> queue; 809 final Queue<CodegenWorkItem> queue;
810 final Map<Element, js.Expression> generatedCode = 810 final Map<Element, js.Expression> generatedCode =
811 new Map<Element, js.Expression>(); 811 new Map<Element, js.Expression>();
812 812
813 final Set<Element> newlyEnqueuedElements; 813 final Set<Element> newlyEnqueuedElements;
814 814
815 final Set<Selector> newlySeenSelectors;
816
815 CodegenEnqueuer(Compiler compiler, 817 CodegenEnqueuer(Compiler compiler,
816 ItemCompilationContext itemCompilationContextCreator()) 818 ItemCompilationContext itemCompilationContextCreator())
817 : queue = new Queue<CodegenWorkItem>(), 819 : queue = new Queue<CodegenWorkItem>(),
818 newlyEnqueuedElements = compiler.cacheStrategy.newSet(), 820 newlyEnqueuedElements = compiler.cacheStrategy.newSet(),
821 newlySeenSelectors = compiler.cacheStrategy.newSet(),
819 super('codegen enqueuer', compiler, itemCompilationContextCreator); 822 super('codegen enqueuer', compiler, itemCompilationContextCreator);
820 823
821 bool isProcessed(Element member) => 824 bool isProcessed(Element member) =>
822 member.isAbstract || generatedCode.containsKey(member); 825 member.isAbstract || generatedCode.containsKey(member);
823 826
824 /** 827 /**
825 * Decides whether an element should be included to satisfy requirements 828 * Decides whether an element should be included to satisfy requirements
826 * of the mirror system. 829 * of the mirror system.
827 * 830 *
828 * For code generation, we rely on the precomputed set of elements that takes 831 * For code generation, we rely on the precomputed set of elements that takes
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 super.forgetElement(element); 871 super.forgetElement(element);
869 generatedCode.remove(element); 872 generatedCode.remove(element);
870 if (element is MemberElement) { 873 if (element is MemberElement) {
871 for (Element closure in element.nestedClosures) { 874 for (Element closure in element.nestedClosures) {
872 generatedCode.remove(closure); 875 generatedCode.remove(closure);
873 removeFromSet(instanceMembersByName, closure); 876 removeFromSet(instanceMembersByName, closure);
874 removeFromSet(instanceFunctionsByName, closure); 877 removeFromSet(instanceFunctionsByName, closure);
875 } 878 }
876 } 879 }
877 } 880 }
881
882 void handleUnseenSelector(String methodName, Selector selector) {
883 if (compiler.hasIncrementalSupport) {
884 newlySeenSelectors.add(selector);
885 }
886 super.handleUnseenSelector(methodName, selector);
887 }
878 } 888 }
879 889
880 /// Parameterizes filtering of which work items are enqueued. 890 /// Parameterizes filtering of which work items are enqueued.
881 class QueueFilter { 891 class QueueFilter {
882 bool checkNoEnqueuedInvokedInstanceMethods(Enqueuer enqueuer) { 892 bool checkNoEnqueuedInvokedInstanceMethods(Enqueuer enqueuer) {
883 enqueuer.task.measure(() { 893 enqueuer.task.measure(() {
884 // Run through the classes and see if we need to compile methods. 894 // Run through the classes and see if we need to compile methods.
885 for (ClassElement classElement in 895 for (ClassElement classElement in
886 enqueuer.universe.directlyInstantiatedClasses) { 896 enqueuer.universe.directlyInstantiatedClasses) {
887 for (ClassElement currentClass = classElement; 897 for (ClassElement currentClass = classElement;
888 currentClass != null; 898 currentClass != null;
889 currentClass = currentClass.superclass) { 899 currentClass = currentClass.superclass) {
890 enqueuer.processInstantiatedClassMembers(currentClass); 900 enqueuer.processInstantiatedClassMembers(currentClass);
891 } 901 }
892 } 902 }
893 }); 903 });
894 return true; 904 return true;
895 } 905 }
896 906
897 void processWorkItem(void f(WorkItem work), WorkItem work) { 907 void processWorkItem(void f(WorkItem work), WorkItem work) {
898 f(work); 908 f(work);
899 } 909 }
900 } 910 }
901 911
902 void removeFromSet(Map<String, Set<Element>> map, Element element) { 912 void removeFromSet(Map<String, Set<Element>> map, Element element) {
903 Set<Element> set = map[element.name]; 913 Set<Element> set = map[element.name];
904 if (set == null) return; 914 if (set == null) return;
905 set.remove(element); 915 set.remove(element);
906 } 916 }
OLDNEW
« no previous file with comments | « no previous file | dart/pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698