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

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

Issue 10854158: Make selector registration in the resolver and code generator more explicit. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge from master. Created 8 years, 4 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 class EnqueueTask extends CompilerTask { 5 class EnqueueTask extends CompilerTask {
6 final Enqueuer codegen; 6 final Enqueuer codegen;
7 final Enqueuer resolution; 7 final Enqueuer resolution;
8 8
9 String get name() => 'Enqueue'; 9 String get name() => 'Enqueue';
10 10
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 } 137 }
138 }); 138 });
139 return true; 139 return true;
140 } 140 }
141 141
142 void processInstantiatedClass(ClassElement cls) { 142 void processInstantiatedClass(ClassElement cls) {
143 cls.localMembers.forEach(processInstantiatedClassMember); 143 cls.localMembers.forEach(processInstantiatedClassMember);
144 } 144 }
145 145
146 void registerFieldClosureInvocations() {
147 task.measure(() {
148 // Make sure that the closure understands a call with the given
149 // selector. For a method-invocation of the form o.foo(a: 499), we
150 // need to make sure that closures can handle the optional argument if
151 // there exists a field or getter 'foo'.
152 var names = universe.instantiatedClassInstanceFields;
153 // TODO(ahe): Might be enough to use invokedGetters.
154 for (SourceString name in names) {
155 Set<Selector> invokedSelectors = universe.invokedNames[name];
156 if (invokedSelectors != null) {
157 for (Selector selector in invokedSelectors) {
158 Selector call = new Selector.call(
159 compiler.namer.CLOSURE_INVOCATION_NAME,
160 selector.library, // TODO(kasperl): Use "default" library?
161 selector.argumentCount,
162 selector.namedArguments);
163 registerDynamicInvocation(compiler.namer.CLOSURE_INVOCATION_NAME,
164 call);
165 }
166 }
167 }
168 });
169 }
170
171 void processInstantiatedClassMember(Element member) { 146 void processInstantiatedClassMember(Element member) {
172 if (universe.generatedCode.containsKey(member)) return; 147 if (universe.generatedCode.containsKey(member)) return;
173 if (resolvedElements[member] !== null) return; 148 if (resolvedElements[member] !== null) return;
174 149
175 if (!member.isInstanceMember()) return; 150 if (!member.isInstanceMember()) return;
176 if (member.isField()) return; 151 if (member.isField()) return;
177 152
178 String memberName = member.name.slowToString(); 153 String memberName = member.name.slowToString();
179 Link<Element> members = instanceMembersByName.putIfAbsent( 154 Link<Element> members = instanceMembersByName.putIfAbsent(
180 memberName, () => const EmptyLink<Element>()); 155 memberName, () => const EmptyLink<Element>());
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 }); 317 });
343 } 318 }
344 319
345 // TODO(ngeoffray): This should get a type. 320 // TODO(ngeoffray): This should get a type.
346 void registerIsCheck(Element element) { 321 void registerIsCheck(Element element) {
347 universe.isChecks.add(element); 322 universe.isChecks.add(element);
348 } 323 }
349 324
350 void forEach(f(WorkItem work)) { 325 void forEach(f(WorkItem work)) {
351 while (!queue.isEmpty()) { 326 while (!queue.isEmpty()) {
352 do { 327 do {
floitsch 2012/08/15 14:14:04 remove the inner loop.
ahe 2012/08/15 14:32:21 Remove this loop.
kasperl 2012/08/16 10:35:47 Done.
kasperl 2012/08/16 10:35:47 Done.
353 f(queue.removeLast()); 328 f(queue.removeLast());
354 } while (!queue.isEmpty()); 329 } while (!queue.isEmpty());
355 // TODO(ahe): we shouldn't register the field closure invocations here.
356 registerFieldClosureInvocations();
ahe 2012/08/15 14:32:21 Yay!
357 } 330 }
358 } 331 }
359 } 332 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698