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