| 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.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Generates the code for all used classes in the program. Static fields (even | 8 * Generates the code for all used classes in the program. Static fields (even |
| 9 * in classes) are ignored, since they can be treated as non-class elements. | 9 * in classes) are ignored, since they can be treated as non-class elements. |
| 10 * | 10 * |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 for (String outputUnit in outputBuffers.keys) { | 1172 for (String outputUnit in outputBuffers.keys) { |
| 1173 ClassBuilder descriptor = | 1173 ClassBuilder descriptor = |
| 1174 descriptors.putIfAbsent(outputUnit, () | 1174 descriptors.putIfAbsent(outputUnit, () |
| 1175 => new ClassBuilder()); | 1175 => new ClassBuilder()); |
| 1176 if (descriptor.properties.isEmpty) continue; | 1176 if (descriptor.properties.isEmpty) continue; |
| 1177 bool isDeferred = outputUnit != "main"; | 1177 bool isDeferred = outputUnit != "main"; |
| 1178 jsAst.Fun metadata = metadataEmitter.buildMetadataFunction(library); | 1178 jsAst.Fun metadata = metadataEmitter.buildMetadataFunction(library); |
| 1179 | 1179 |
| 1180 jsAst.ObjectInitializer initializers = | 1180 jsAst.ObjectInitializer initializers = |
| 1181 descriptor.toObjectInitializer(); | 1181 descriptor.toObjectInitializer(); |
| 1182 int sizeBefore = outputBuffers[outputUnit].length; |
| 1182 outputBuffers[outputUnit] | 1183 outputBuffers[outputUnit] |
| 1183 ..write('["${library.getLibraryName()}",$_') | 1184 ..write('["${library.getLibraryName()}",$_') |
| 1184 ..write('"${uri}",$_') | 1185 ..write('"${uri}",$_') |
| 1185 ..write(metadata == null ? "" : jsAst.prettyPrint(metadata, compiler)) | 1186 ..write(metadata == null ? "" : jsAst.prettyPrint(metadata, compiler)) |
| 1186 ..write(isDeferred ? '[]' : '') | 1187 ..write(isDeferred ? '[]' : '') |
| 1187 ..write(',$_') | 1188 ..write(',$_') |
| 1188 ..write(namer.globalObjectFor(library)) | 1189 ..write(namer.globalObjectFor(library)) |
| 1189 ..write(',$_') | 1190 ..write(',$_') |
| 1190 ..write(jsAst.prettyPrint(initializers, compiler)) | 1191 ..write(jsAst.prettyPrint(initializers, compiler)) |
| 1191 ..write(library == compiler.mainApp ? ',${n}1' : "") | 1192 ..write(library == compiler.mainApp ? ',${n}1' : "") |
| 1192 ..write('],$n'); | 1193 ..write('],$n'); |
| 1194 int sizeAfter = outputBuffers[outputUnit].length; |
| 1195 compiler.dumpInfoTask.codeSizeCounter |
| 1196 .countCode(library, sizeAfter - sizeBefore); |
| 1193 } | 1197 } |
| 1194 } | 1198 } |
| 1195 | 1199 |
| 1196 String assembleProgram() { | 1200 String assembleProgram() { |
| 1197 measure(() { | 1201 measure(() { |
| 1198 // Compute the required type checks to know which classes need a | 1202 // Compute the required type checks to know which classes need a |
| 1199 // 'is$' method. | 1203 // 'is$' method. |
| 1200 typeTestEmitter.computeRequiredTypeChecks(); | 1204 typeTestEmitter.computeRequiredTypeChecks(); |
| 1201 | 1205 |
| 1202 computeNeededClasses(); | 1206 computeNeededClasses(); |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 } | 1597 } |
| 1594 | 1598 |
| 1595 bool get areAnyElementsDeferred { | 1599 bool get areAnyElementsDeferred { |
| 1596 return compiler.deferredLoadTask.areAnyElementsDeferred; | 1600 return compiler.deferredLoadTask.areAnyElementsDeferred; |
| 1597 } | 1601 } |
| 1598 | 1602 |
| 1599 void registerReadTypeVariable(TypeVariableElement element) { | 1603 void registerReadTypeVariable(TypeVariableElement element) { |
| 1600 readTypeVariables.add(element); | 1604 readTypeVariables.add(element); |
| 1601 } | 1605 } |
| 1602 } | 1606 } |
| OLD | NEW |