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

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);
172 for (Selector selector in selectors) { 171 for (Selector selector in selectors) {
173 if (!selector.applies(parameters)) continue; 172 if (!selector.applies(member, compiler)) continue;
174 addParameterStub(member, attachTo, buffer, selector); 173 addParameterStub(member, attachTo, buffer, selector);
175 } 174 }
176 } 175 }
177 176
178 void addInstanceMember(Element member, 177 void addInstanceMember(Element member,
179 String attachTo(String name), 178 String attachTo(String name),
180 StringBuffer buffer) { 179 StringBuffer buffer) {
181 // TODO(floitsch): we don't need to deal with members of 180 // TODO(floitsch): we don't need to deal with members of
182 // uninstantiated classes, that have been overwritten by subclasses. 181 // uninstantiated classes, that have been overwritten by subclasses.
183 182
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 mainBuffer.add( 733 mainBuffer.add(
735 'var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); 734 'var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n');
736 nativeEmitter.emitDynamicDispatchMetadata(); 735 nativeEmitter.emitDynamicDispatchMetadata();
737 nativeEmitter.assembleCode(mainBuffer); 736 nativeEmitter.assembleCode(mainBuffer);
738 emitMain(mainBuffer); 737 emitMain(mainBuffer);
739 compiler.assembledCode = mainBuffer.toString(); 738 compiler.assembledCode = mainBuffer.toString();
740 }); 739 });
741 return compiler.assembledCode; 740 return compiler.assembledCode;
742 } 741 }
743 } 742 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/elements/elements.dart ('k') | lib/compiler/implementation/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698