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

Side by Side Diff: lib/compiler/implementation/emitter.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
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 /** 5 /**
6 * A function element that represents a closure call. The signature is copied 6 * A function element that represents a closure call. The signature is copied
7 * from the given element. 7 * from the given element.
8 */ 8 */
9 class ClosureInvocationElement extends FunctionElement { 9 class ClosureInvocationElement extends FunctionElement {
10 ClosureInvocationElement(SourceString name, 10 ClosureInvocationElement(SourceString name,
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 buffer.add(' return this.${namer.getName(member)}($arguments)'); 161 buffer.add(' return this.${namer.getName(member)}($arguments)');
162 } 162 }
163 buffer.add('\n};\n'); 163 buffer.add('\n};\n');
164 } 164 }
165 165
166 void addParameterStubs(FunctionElement member, 166 void addParameterStubs(FunctionElement member,
167 String attachTo(String invocationName), 167 String attachTo(String invocationName),
168 StringBuffer buffer) { 168 StringBuffer buffer) {
169 Set<Selector> selectors = compiler.universe.invokedNames[member.name]; 169 Set<Selector> selectors = compiler.universe.invokedNames[member.name];
170 if (selectors == null) return; 170 if (selectors == null) return;
171 FunctionParameters parameters = member.computeParameters(compiler); 171 FunctionParameters parameters = member.computeParameters(compiler);
floitsch 2012/04/23 13:58:30 unused?
ngeoffray 2012/04/23 14:09:33 Done.
172 for (Selector selector in selectors) { 172 for (Selector selector in selectors) {
173 if (!selector.applies(parameters)) continue; 173 if (!selector.applies(member, compiler)) continue;
174 addParameterStub(member, attachTo, buffer, selector); 174 addParameterStub(member, attachTo, buffer, selector);
175 } 175 }
176 } 176 }
177 177
178 void addInstanceMember(Element member, 178 void addInstanceMember(Element member,
179 String attachTo(String name), 179 String attachTo(String name),
180 StringBuffer buffer) { 180 StringBuffer buffer) {
181 // TODO(floitsch): we don't need to deal with members of 181 // TODO(floitsch): we don't need to deal with members of
182 // uninstantiated classes, that have been overwritten by subclasses. 182 // uninstantiated classes, that have been overwritten by subclasses.
183 183
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 mainBuffer.add( 734 mainBuffer.add(
735 'var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); 735 'var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n');
736 nativeEmitter.emitDynamicDispatchMetadata(); 736 nativeEmitter.emitDynamicDispatchMetadata();
737 nativeEmitter.assembleCode(mainBuffer); 737 nativeEmitter.assembleCode(mainBuffer);
738 emitMain(mainBuffer); 738 emitMain(mainBuffer);
739 compiler.assembledCode = mainBuffer.toString(); 739 compiler.assembledCode = mainBuffer.toString();
740 }); 740 });
741 return compiler.assembledCode; 741 return compiler.assembledCode;
742 } 742 }
743 } 743 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698