| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 outputs.setAll(1, deferredOutputs); | 111 outputs.setAll(1, deferredOutputs); |
| 112 | 112 |
| 113 _markEagerClasses(); | 113 _markEagerClasses(); |
| 114 | 114 |
| 115 bool containsNativeClasses = | 115 bool containsNativeClasses = |
| 116 nativeClasses.length != _unneededNativeClasses.length; | 116 nativeClasses.length != _unneededNativeClasses.length; |
| 117 | 117 |
| 118 return new Program( | 118 return new Program( |
| 119 outputs, | 119 outputs, |
| 120 _buildLoadMap(), | 120 _buildLoadMap(), |
| 121 _buildTypeToInterceptorMap(), |
| 121 outputContainsNativeClasses: containsNativeClasses, | 122 outputContainsNativeClasses: containsNativeClasses, |
| 122 outputContainsConstantList: _task.outputContainsConstantList); | 123 outputContainsConstantList: _task.outputContainsConstantList); |
| 123 } | 124 } |
| 124 | 125 |
| 125 void _markEagerClasses() { | 126 void _markEagerClasses() { |
| 126 _markEagerInterceptorClasses(); | 127 _markEagerInterceptorClasses(); |
| 127 } | 128 } |
| 128 | 129 |
| 129 /// Builds a map from loadId to outputs-to-load. | 130 /// Builds a map from loadId to outputs-to-load. |
| 130 Map<String, List<Fragment>> _buildLoadMap() { | 131 Map<String, List<Fragment>> _buildLoadMap() { |
| 131 Map<String, List<Fragment>> loadMap = <String, List<Fragment>>{}; | 132 Map<String, List<Fragment>> loadMap = <String, List<Fragment>>{}; |
| 132 _compiler.deferredLoadTask.hunksToLoad | 133 _compiler.deferredLoadTask.hunksToLoad |
| 133 .forEach((String loadId, List<OutputUnit> outputUnits) { | 134 .forEach((String loadId, List<OutputUnit> outputUnits) { |
| 134 loadMap[loadId] = outputUnits | 135 loadMap[loadId] = outputUnits |
| 135 .map((OutputUnit unit) => _outputs[unit]) | 136 .map((OutputUnit unit) => _outputs[unit]) |
| 136 .toList(growable: false); | 137 .toList(growable: false); |
| 137 }); | 138 }); |
| 138 return loadMap; | 139 return loadMap; |
| 139 } | 140 } |
| 140 | 141 |
| 142 js.Expression _buildTypeToInterceptorMap() { |
| 143 InterceptorStubGenerator stubGenerator = |
| 144 new InterceptorStubGenerator(_compiler, namer, backend); |
| 145 return stubGenerator.generateTypeToInterceptorMap(); |
| 146 } |
| 147 |
| 141 MainFragment _buildMainOutput(LibrariesMap librariesMap) { | 148 MainFragment _buildMainOutput(LibrariesMap librariesMap) { |
| 142 // Construct the main output from the libraries and the registered holders. | 149 // Construct the main output from the libraries and the registered holders. |
| 143 MainFragment result = new MainFragment( | 150 MainFragment result = new MainFragment( |
| 144 librariesMap.outputUnit, | 151 librariesMap.outputUnit, |
| 145 "", // The empty string is the name for the main output file. | 152 "", // The empty string is the name for the main output file. |
| 146 backend.emitter.staticFunctionAccess(_compiler.mainFunction), | 153 backend.emitter.staticFunctionAccess(_compiler.mainFunction), |
| 147 _buildLibraries(librariesMap), | 154 _buildLibraries(librariesMap), |
| 148 _buildStaticNonFinalFields(librariesMap), | 155 _buildStaticNonFinalFields(librariesMap), |
| 149 _buildStaticLazilyInitializedFields(librariesMap), | 156 _buildStaticLazilyInitializedFields(librariesMap), |
| 150 _buildConstants(librariesMap), | 157 _buildConstants(librariesMap), |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 _registry.registerConstant(outputUnit, constantValue); | 518 _registry.registerConstant(outputUnit, constantValue); |
| 512 assert(!_constants.containsKey(constantValue)); | 519 assert(!_constants.containsKey(constantValue)); |
| 513 String name = namer.constantName(constantValue); | 520 String name = namer.constantName(constantValue); |
| 514 String constantObject = namer.globalObjectForConstant(constantValue); | 521 String constantObject = namer.globalObjectForConstant(constantValue); |
| 515 Holder holder = _registry.registerHolder(constantObject); | 522 Holder holder = _registry.registerHolder(constantObject); |
| 516 Constant constant = new Constant(name, holder, constantValue); | 523 Constant constant = new Constant(name, holder, constantValue); |
| 517 _constants[constantValue] = constant; | 524 _constants[constantValue] = constant; |
| 518 } | 525 } |
| 519 } | 526 } |
| 520 } | 527 } |
| OLD | NEW |