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 library dart2js.js.enqueue; | 5 library dart2js.js.enqueue; |
6 | 6 |
7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
8 | 8 |
9 import '../common/codegen.dart' show CodegenWorkItem; | 9 import '../common/codegen.dart' show CodegenWorkItem; |
10 import '../common/tasks.dart' show CompilerTask; | 10 import '../common/tasks.dart' show CompilerTask; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 bool queueIsClosed = false; | 44 bool queueIsClosed = false; |
45 final CompilerTask task; | 45 final CompilerTask task; |
46 final EnqueuerListener listener; | 46 final EnqueuerListener listener; |
47 final CompilerOptions _options; | 47 final CompilerOptions _options; |
48 | 48 |
49 WorldImpactVisitor _impactVisitor; | 49 WorldImpactVisitor _impactVisitor; |
50 | 50 |
51 final Queue<WorkItem> _queue = new Queue<WorkItem>(); | 51 final Queue<WorkItem> _queue = new Queue<WorkItem>(); |
52 | 52 |
53 /// All declaration elements that have been processed by codegen. | 53 /// All declaration elements that have been processed by codegen. |
54 final Set<Entity> _processedEntities = new Set<Entity>(); | 54 final Set<MemberEntity> _processedEntities = new Set<MemberEntity>(); |
55 | 55 |
56 static const ImpactUseCase IMPACT_USE = | 56 static const ImpactUseCase IMPACT_USE = |
57 const ImpactUseCase('CodegenEnqueuer'); | 57 const ImpactUseCase('CodegenEnqueuer'); |
58 | 58 |
59 CodegenEnqueuer(this.task, this._options, this.strategy, this._worldBuilder, | 59 CodegenEnqueuer(this.task, this._options, this.strategy, this._worldBuilder, |
60 this._workItemBuilder, this.listener) | 60 this._workItemBuilder, this.listener) |
61 : this.name = 'codegen enqueuer' { | 61 : this.name = 'codegen enqueuer' { |
62 _impactVisitor = new EnqueuerImplImpactVisitor(this); | 62 _impactVisitor = new EnqueuerImplImpactVisitor(this); |
63 } | 63 } |
64 | 64 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 void logSummary(void log(String message)) { | 252 void logSummary(void log(String message)) { |
253 log('Compiled ${_processedEntities.length} methods.'); | 253 log('Compiled ${_processedEntities.length} methods.'); |
254 listener.logSummary(log); | 254 listener.logSummary(log); |
255 } | 255 } |
256 | 256 |
257 String toString() => 'Enqueuer($name)'; | 257 String toString() => 'Enqueuer($name)'; |
258 | 258 |
259 ImpactUseCase get impactUse => IMPACT_USE; | 259 ImpactUseCase get impactUse => IMPACT_USE; |
260 | 260 |
261 @override | 261 @override |
262 Iterable<Entity> get processedEntities => _processedEntities; | 262 Iterable<MemberEntity> get processedEntities => _processedEntities; |
263 | 263 |
264 @override | 264 @override |
265 Iterable<ClassEntity> get processedClasses => _worldBuilder.processedClasses; | 265 Iterable<ClassEntity> get processedClasses => _worldBuilder.processedClasses; |
266 } | 266 } |
267 | 267 |
268 /// Builder that creates the work item necessary for the code generation of a | 268 /// Builder that creates the work item necessary for the code generation of a |
269 /// [MemberElement]. | 269 /// [MemberElement]. |
270 class CodegenWorkItemBuilder extends WorkItemBuilder { | 270 class CodegenWorkItemBuilder extends WorkItemBuilder { |
271 JavaScriptBackend _backend; | 271 JavaScriptBackend _backend; |
272 CompilerOptions _options; | 272 CompilerOptions _options; |
(...skipping 11 matching lines...) Expand all Loading... |
284 // code for checked setters. | 284 // code for checked setters. |
285 if (element.isField && element.isInstanceMember) { | 285 if (element.isField && element.isInstanceMember) { |
286 if (!_options.enableTypeAssertions || | 286 if (!_options.enableTypeAssertions || |
287 element.enclosingElement.isClosure) { | 287 element.enclosingElement.isClosure) { |
288 return null; | 288 return null; |
289 } | 289 } |
290 } | 290 } |
291 return new CodegenWorkItem(_backend, element); | 291 return new CodegenWorkItem(_backend, element); |
292 } | 292 } |
293 } | 293 } |
OLD | NEW |