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 ResolutionEnqueuer resolution; | 8 final ResolutionEnqueuer resolution; |
9 final CodegenEnqueuer codegen; | 9 final CodegenEnqueuer codegen; |
10 | 10 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 224 } |
225 if (universe.hasInvokedSetter(member, compiler)) { | 225 if (universe.hasInvokedSetter(member, compiler)) { |
226 nativeEnqueuer.registerFieldStore(member); | 226 nativeEnqueuer.registerFieldStore(member); |
227 // See comment after registerFieldLoad above. | 227 // See comment after registerFieldLoad above. |
228 nativeEnqueuer.registerFieldLoad(member); | 228 nativeEnqueuer.registerFieldLoad(member); |
229 return; | 229 return; |
230 } | 230 } |
231 // Native fields need to go into instanceMembersByName as they | 231 // Native fields need to go into instanceMembersByName as they |
232 // are virtual instantiation points and escape points. | 232 // are virtual instantiation points and escape points. |
233 } else { | 233 } else { |
234 // The codegen inlines instance fields initialization, so it | |
235 // does not need to add individual fields in the work list. | |
236 if (isResolutionQueue) { | 234 if (isResolutionQueue) { |
| 235 // All field initializers must be resolved as they could |
| 236 // have an observable side-effect (and cannot be tree-shaken |
| 237 // away). However, codegen inlines field initializers, so |
| 238 // it does not need to add individual fields in the work |
| 239 // list. |
237 addToWorkList(member); | 240 addToWorkList(member); |
238 } | 241 } |
239 return; | 242 return; |
240 } | 243 } |
241 } else if (member.kind == ElementKind.FUNCTION) { | 244 } else if (member.kind == ElementKind.FUNCTION) { |
242 if (member.name == Compiler.NO_SUCH_METHOD) { | 245 if (member.name == Compiler.NO_SUCH_METHOD) { |
243 enableNoSuchMethod(member); | 246 enableNoSuchMethod(member); |
244 } | 247 } |
245 // If there is a property access with the same name as a method we | 248 // If there is a property access with the same name as a method we |
246 // need to emit the method. | 249 // need to emit the method. |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 while(!queue.isEmpty) { | 759 while(!queue.isEmpty) { |
757 // TODO(johnniwinther): Find an optimal process order for codegen. | 760 // TODO(johnniwinther): Find an optimal process order for codegen. |
758 f(queue.removeLast()); | 761 f(queue.removeLast()); |
759 } | 762 } |
760 } | 763 } |
761 | 764 |
762 void _logSpecificSummary(log(message)) { | 765 void _logSpecificSummary(log(message)) { |
763 log('Compiled ${generatedCode.length} methods.'); | 766 log('Compiled ${generatedCode.length} methods.'); |
764 } | 767 } |
765 } | 768 } |
OLD | NEW |