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

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

Issue 10180001: Introduce typed selectors to do better tree shaking based on calls on 'this'. Getters and setters w… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | « lib/compiler/implementation/emitter.dart ('k') | lib/compiler/implementation/resolver.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 class EnqueueTask extends CompilerTask { 5 class EnqueueTask extends CompilerTask {
6 final Map<String, Link<Element>> instanceMembersByName; 6 final Map<String, Link<Element>> instanceMembersByName;
7 final Set<ClassElement> seenClasses; 7 final Set<ClassElement> seenClasses;
8 8
9 String get name() => 'Enqueue'; 9 String get name() => 'Enqueue';
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 member.kind === ElementKind.FIELD) { 65 member.kind === ElementKind.FIELD) {
66 compiler.universe.instantiatedClassInstanceFields.add(member.name); 66 compiler.universe.instantiatedClassInstanceFields.add(member.name);
67 } 67 }
68 68
69 if (member.kind == ElementKind.FUNCTION) { 69 if (member.kind == ElementKind.FUNCTION) {
70 if (member.name == Compiler.NO_SUCH_METHOD) { 70 if (member.name == Compiler.NO_SUCH_METHOD) {
71 compiler.enableNoSuchMethod(member); 71 compiler.enableNoSuchMethod(member);
72 } 72 }
73 Set<Selector> selectors = compiler.universe.invokedNames[member.name]; 73 Set<Selector> selectors = compiler.universe.invokedNames[member.name];
74 if (selectors != null) { 74 if (selectors != null) {
75 FunctionElement functionMember = member;
76 FunctionParameters parameters =
77 functionMember.computeParameters(compiler);
78 for (Selector selector in selectors) { 75 for (Selector selector in selectors) {
79 if (selector.applies(parameters)) { 76 if (selector.applies(member, compiler)) {
80 return compiler.addToWorkList(member); 77 return compiler.addToWorkList(member);
81 } 78 }
82 } 79 }
83 } 80 }
84 // If there is a property access with the same name as a method we 81 // If there is a property access with the same name as a method we
85 // need to emit the method. 82 // need to emit the method.
86 if (compiler.universe.invokedGetters.contains(member.name)) { 83 if (compiler.universe.invokedGetters.contains(member.name)) {
87 // We will emit a closure, so make sure the closure class is 84 // We will emit a closure, so make sure the closure class is
88 // generated. 85 // generated.
89 compiler.closureClass.ensureResolved(compiler); 86 compiler.closureClass.ensureResolved(compiler);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 instanceMembersByName[memberName] = remaining.toLink(); 164 instanceMembersByName[memberName] = remaining.toLink();
168 } 165 }
169 } 166 }
170 167
171 void handleUnseenInvocation(SourceString methodName, Selector selector) { 168 void handleUnseenInvocation(SourceString methodName, Selector selector) {
172 processInstanceMembers(methodName, (Element member) { 169 processInstanceMembers(methodName, (Element member) {
173 if (member.isGetter()) { 170 if (member.isGetter()) {
174 compiler.addToWorkList(member); 171 compiler.addToWorkList(member);
175 return true; 172 return true;
176 } else if (member.isFunction()) { 173 } else if (member.isFunction()) {
177 FunctionElement functionMember = member; 174 if (selector.applies(member, compiler)) {
178 FunctionParameters parameters =
179 functionMember.computeParameters(compiler);
180 if (selector.applies(parameters)) {
181 compiler.addToWorkList(member); 175 compiler.addToWorkList(member);
182 return true; 176 return true;
183 } 177 }
184 } 178 }
185 return false; 179 return false;
186 }); 180 });
187 } 181 }
188 182
189 void handleUnseenGetter(SourceString methodName) { 183 void handleUnseenGetter(SourceString methodName) {
190 processInstanceMembers(methodName, (Element member) { 184 processInstanceMembers(methodName, (Element member) {
(...skipping 10 matching lines...) Expand all
201 processInstanceMembers(methodName, (Element member) { 195 processInstanceMembers(methodName, (Element member) {
202 if (member.isSetter()) { 196 if (member.isSetter()) {
203 compiler.addToWorkList(member); 197 compiler.addToWorkList(member);
204 return true; 198 return true;
205 } else { 199 } else {
206 return false; 200 return false;
207 } 201 }
208 }); 202 });
209 } 203 }
210 } 204 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/emitter.dart ('k') | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698