| 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.common.codegen; | 5 library dart2js.common.codegen; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../compiler.dart' show | 8 import '../compiler.dart' show |
| 9 Compiler; | 9 Compiler; |
| 10 import '../constants/values.dart' show | 10 import '../constants/values.dart' show |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 import '../enqueue.dart' show | 21 import '../enqueue.dart' show |
| 22 CodegenEnqueuer; | 22 CodegenEnqueuer; |
| 23 import '../resolution/tree_elements.dart' show | 23 import '../resolution/tree_elements.dart' show |
| 24 TreeElements; | 24 TreeElements; |
| 25 import '../universe/use.dart' show | 25 import '../universe/use.dart' show |
| 26 DynamicUse, | 26 DynamicUse, |
| 27 StaticUse, | 27 StaticUse, |
| 28 TypeUse; | 28 TypeUse; |
| 29 import '../universe/world_impact.dart' show | 29 import '../universe/world_impact.dart' show |
| 30 WorldImpact, | 30 WorldImpact, |
| 31 WorldImpactBuilder, | 31 WorldImpactBuilder; |
| 32 WorldImpactVisitor; | |
| 33 import '../util/util.dart' show | 32 import '../util/util.dart' show |
| 34 Pair, | 33 Pair, |
| 35 Setlet; | 34 Setlet; |
| 36 import 'registry.dart' show | 35 import 'registry.dart' show |
| 37 Registry, | 36 Registry, |
| 38 EagerRegistry; | 37 EagerRegistry; |
| 39 import 'work.dart' show | 38 import 'work.dart' show |
| 40 ItemCompilationContext, | 39 ItemCompilationContext, |
| 41 WorkItem; | 40 WorkItem; |
| 42 | 41 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 72 Setlet<ConstantValue> _compileTimeConstants; | 71 Setlet<ConstantValue> _compileTimeConstants; |
| 73 Setlet<Pair<DartType, DartType>> _typeVariableBoundsSubtypeChecks; | 72 Setlet<Pair<DartType, DartType>> _typeVariableBoundsSubtypeChecks; |
| 74 Setlet<String> _constSymbols; | 73 Setlet<String> _constSymbols; |
| 75 List<Set<ClassElement>> _specializedGetInterceptors; | 74 List<Set<ClassElement>> _specializedGetInterceptors; |
| 76 bool _usesInterceptor = false; | 75 bool _usesInterceptor = false; |
| 77 Setlet<ClassElement> _typeConstants; | 76 Setlet<ClassElement> _typeConstants; |
| 78 Setlet<FunctionElement> _asyncMarkers; | 77 Setlet<FunctionElement> _asyncMarkers; |
| 79 | 78 |
| 80 _CodegenImpact(this.registry); | 79 _CodegenImpact(this.registry); |
| 81 | 80 |
| 82 void apply(WorldImpactVisitor visitor) { | |
| 83 staticUses.forEach(visitor.visitStaticUse); | |
| 84 dynamicUses.forEach(visitor.visitDynamicUse); | |
| 85 typeUses.forEach(visitor.visitTypeUse); | |
| 86 } | |
| 87 | |
| 88 void registerCompileTimeConstant(ConstantValue constant) { | 81 void registerCompileTimeConstant(ConstantValue constant) { |
| 89 if (_compileTimeConstants == null) { | 82 if (_compileTimeConstants == null) { |
| 90 _compileTimeConstants = new Setlet<ConstantValue>(); | 83 _compileTimeConstants = new Setlet<ConstantValue>(); |
| 91 } | 84 } |
| 92 _compileTimeConstants.add(constant); | 85 _compileTimeConstants.add(constant); |
| 93 } | 86 } |
| 94 | 87 |
| 95 Iterable<ConstantValue> get compileTimeConstants { | 88 Iterable<ConstantValue> get compileTimeConstants { |
| 96 return _compileTimeConstants != null | 89 return _compileTimeConstants != null |
| 97 ? _compileTimeConstants : const <ConstantValue>[]; | 90 ? _compileTimeConstants : const <ConstantValue>[]; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 AstElement element, | 255 AstElement element, |
| 263 ItemCompilationContext compilationContext) | 256 ItemCompilationContext compilationContext) |
| 264 : super(element, compilationContext); | 257 : super(element, compilationContext); |
| 265 | 258 |
| 266 TreeElements get resolutionTree => element.resolvedAst.elements; | 259 TreeElements get resolutionTree => element.resolvedAst.elements; |
| 267 | 260 |
| 268 WorldImpact run(Compiler compiler, CodegenEnqueuer world) { | 261 WorldImpact run(Compiler compiler, CodegenEnqueuer world) { |
| 269 if (world.isProcessed(element)) return const WorldImpact(); | 262 if (world.isProcessed(element)) return const WorldImpact(); |
| 270 | 263 |
| 271 registry = new CodegenRegistry(compiler, element); | 264 registry = new CodegenRegistry(compiler, element); |
| 272 return compiler.codegen(this, world); | 265 var impact = compiler.codegen(this, world); |
| 266 compiler.dumpInfoTask.registerImpact(element, impact); |
| 267 return impact; |
| 273 } | 268 } |
| 274 } | 269 } |
| OLD | NEW |