OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_emitter.program_builder; | 5 library dart2js.js_emitter.program_builder; |
6 | 6 |
7 import 'js_emitter.dart' show computeMixinClass; | 7 import 'js_emitter.dart' show computeMixinClass; |
8 import 'model.dart'; | 8 import 'model.dart'; |
9 | 9 |
10 import '../common.dart'; | 10 import '../common.dart'; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 _markEagerClasses(); | 117 _markEagerClasses(); |
118 | 118 |
119 List<Holder> holders = _registry.holders.toList(growable: false); | 119 List<Holder> holders = _registry.holders.toList(growable: false); |
120 | 120 |
121 bool needsNativeSupport = _compiler.enqueuer.codegen.nativeEnqueuer | 121 bool needsNativeSupport = _compiler.enqueuer.codegen.nativeEnqueuer |
122 .hasInstantiatedNativeClasses(); | 122 .hasInstantiatedNativeClasses(); |
123 | 123 |
124 assert(!needsNativeSupport || nativeClasses.isNotEmpty); | 124 assert(!needsNativeSupport || nativeClasses.isNotEmpty); |
125 | 125 |
| 126 List<js.TokenFinalizer> finalizers = [_task.metadataCollector]; |
| 127 if (backend.namer is js.TokenFinalizer) { |
| 128 var namingFinalizer = backend.namer; |
| 129 finalizers.add(namingFinalizer); |
| 130 } |
| 131 |
126 return new Program( | 132 return new Program( |
127 fragments, | 133 fragments, |
128 holders, | 134 holders, |
129 _buildLoadMap(), | 135 _buildLoadMap(), |
130 _buildTypeToInterceptorMap(), | 136 _buildTypeToInterceptorMap(), |
131 _task.metadataCollector, | 137 _task.metadataCollector, |
| 138 finalizers, |
132 needsNativeSupport: needsNativeSupport, | 139 needsNativeSupport: needsNativeSupport, |
133 outputContainsConstantList: _task.outputContainsConstantList, | 140 outputContainsConstantList: _task.outputContainsConstantList, |
134 hasIsolateSupport: _compiler.hasIsolateSupport); | 141 hasIsolateSupport: _compiler.hasIsolateSupport); |
135 } | 142 } |
136 | 143 |
137 void _markEagerClasses() { | 144 void _markEagerClasses() { |
138 _markEagerInterceptorClasses(); | 145 _markEagerInterceptorClasses(); |
139 } | 146 } |
140 | 147 |
141 /// Builds a map from loadId to outputs-to-load. | 148 /// Builds a map from loadId to outputs-to-load. |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 _registry.registerConstant(outputUnit, constantValue); | 760 _registry.registerConstant(outputUnit, constantValue); |
754 assert(!_constants.containsKey(constantValue)); | 761 assert(!_constants.containsKey(constantValue)); |
755 js.Name name = namer.constantName(constantValue); | 762 js.Name name = namer.constantName(constantValue); |
756 String constantObject = namer.globalObjectForConstant(constantValue); | 763 String constantObject = namer.globalObjectForConstant(constantValue); |
757 Holder holder = _registry.registerHolder(constantObject); | 764 Holder holder = _registry.registerHolder(constantObject); |
758 Constant constant = new Constant(name, holder, constantValue); | 765 Constant constant = new Constant(name, holder, constantValue); |
759 _constants[constantValue] = constant; | 766 _constants[constantValue] = constant; |
760 } | 767 } |
761 } | 768 } |
762 } | 769 } |
OLD | NEW |