OLD | NEW |
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 class EnqueueTask extends CompilerTask { | 7 class EnqueueTask extends CompilerTask { |
8 final Enqueuer codegen; | 8 final Enqueuer codegen; |
9 final Enqueuer resolution; | 9 final Enqueuer resolution; |
10 | 10 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 219 } |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 void onRegisterInstantiatedClass(ClassElement cls) { | 223 void onRegisterInstantiatedClass(ClassElement cls) { |
224 task.measure(() { | 224 task.measure(() { |
225 // The class must be resolved to compute the set of all | 225 // The class must be resolved to compute the set of all |
226 // supertypes. | 226 // supertypes. |
227 cls.ensureResolved(compiler); | 227 cls.ensureResolved(compiler); |
228 | 228 |
229 for (Link<DartType> supertypes = cls.allSupertypesAndSelf; | 229 void processClass(ClassElement cls) { |
230 !supertypes.isEmpty; supertypes = supertypes.tail) { | 230 if (seenClasses.contains(cls)) return; |
231 cls = supertypes.head.element; | 231 |
232 if (seenClasses.contains(cls)) continue; | |
233 seenClasses.add(cls); | 232 seenClasses.add(cls); |
234 cls.ensureResolved(compiler); | 233 cls.ensureResolved(compiler); |
235 cls.implementation.forEachMember(processInstantiatedClassMember); | 234 cls.implementation.forEachMember(processInstantiatedClassMember); |
236 if (isResolutionQueue) { | 235 if (isResolutionQueue) { |
237 compiler.resolver.checkMembers(cls); | 236 compiler.resolver.checkMembers(cls); |
238 } | 237 } |
239 | 238 |
240 if (compiler.enableTypeAssertions) { | 239 if (compiler.enableTypeAssertions) { |
241 // We need to register is checks and helpers for checking | 240 // We need to register is checks and helpers for checking |
242 // assignments to fields. | 241 // assignments to fields. |
243 // TODO(ngeoffray): This should really move to the backend. | 242 // TODO(ngeoffray): This should really move to the backend. |
244 cls.localMembers.forEach((Element member) { | 243 cls.localMembers.forEach((Element member) { |
245 if (!member.isInstanceMember() || !member.isField()) return; | 244 if (!member.isInstanceMember() || !member.isField()) return; |
246 DartType type = member.computeType(compiler); | 245 DartType type = member.computeType(compiler); |
247 registerIsCheck(type); | 246 registerIsCheck(type); |
248 SourceString helper = compiler.backend.getCheckedModeHelper(type); | 247 SourceString helper = compiler.backend.getCheckedModeHelper(type); |
249 if (helper != null) { | 248 if (helper != null) { |
250 Element helperElement = compiler.findHelper(helper); | 249 Element helperElement = compiler.findHelper(helper); |
251 registerStaticUse(helperElement); | 250 registerStaticUse(helperElement); |
252 } | 251 } |
253 }); | 252 }); |
254 } | 253 } |
255 } | 254 } |
| 255 processClass(cls); |
| 256 for (Link<DartType> supertypes = cls.allSupertypes; |
| 257 !supertypes.isEmpty; supertypes = supertypes.tail) { |
| 258 processClass(supertypes.head.element); |
| 259 } |
256 }); | 260 }); |
257 } | 261 } |
258 | 262 |
259 void registerNewSelector(SourceString name, | 263 void registerNewSelector(SourceString name, |
260 Selector selector, | 264 Selector selector, |
261 Map<SourceString, Set<Selector>> selectorsMap) { | 265 Map<SourceString, Set<Selector>> selectorsMap) { |
262 if (name != selector.name) { | 266 if (name != selector.name) { |
263 String message = "$name != ${selector.name} (${selector.kind})"; | 267 String message = "$name != ${selector.name} (${selector.kind})"; |
264 compiler.internalError("Wrong selector name: $message."); | 268 compiler.internalError("Wrong selector name: $message."); |
265 } | 269 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 400 |
397 String toString() => 'Enqueuer($name)'; | 401 String toString() => 'Enqueuer($name)'; |
398 | 402 |
399 void logSummary(log(message)) { | 403 void logSummary(log(message)) { |
400 log(isResolutionQueue | 404 log(isResolutionQueue |
401 ? 'Resolved ${resolvedElements.length} elements.' | 405 ? 'Resolved ${resolvedElements.length} elements.' |
402 : 'Compiled ${universe.generatedCode.length} methods.'); | 406 : 'Compiled ${universe.generatedCode.length} methods.'); |
403 nativeEnqueuer.logSummary(log); | 407 nativeEnqueuer.logSummary(log); |
404 } | 408 } |
405 } | 409 } |
OLD | NEW |