| 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 const USE_LAZY_EMITTER = const bool.fromEnvironment("dart2js.use.lazy.emitter"); | 7 const USE_LAZY_EMITTER = const bool.fromEnvironment("dart2js.use.lazy.emitter"); |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Generates the code for all used classes in the program. Static fields (even | 10 * Generates the code for all used classes in the program. Static fields (even |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // Compute the classes needed by RTI. | 126 // Compute the classes needed by RTI. |
| 127 return typeTestRegistry.computeRtiNeededClasses(); | 127 return typeTestRegistry.computeRtiNeededClasses(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 int assembleProgram() { | 130 int assembleProgram() { |
| 131 return measure(() { | 131 return measure(() { |
| 132 emitter.invalidateCaches(); | 132 emitter.invalidateCaches(); |
| 133 | 133 |
| 134 Set<ClassElement> rtiNeededClasses = _finalizeRti(); | 134 Set<ClassElement> rtiNeededClasses = _finalizeRti(); |
| 135 ProgramBuilder programBuilder = new ProgramBuilder( | 135 ProgramBuilder programBuilder = new ProgramBuilder( |
| 136 compiler, namer, this, emitter, oldEmitter, rtiNeededClasses); | 136 compiler, namer, this, emitter, rtiNeededClasses); |
| 137 int size = emitter.emitProgram(programBuilder); | 137 int size = emitter.emitProgram(programBuilder); |
| 138 // TODO(floitsch): we shouldn't need the `neededClasses` anymore. | 138 // TODO(floitsch): we shouldn't need the `neededClasses` anymore. |
| 139 neededClasses = programBuilder.collector.neededClasses; | 139 neededClasses = programBuilder.collector.neededClasses; |
| 140 return size; | 140 return size; |
| 141 }); | 141 }); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 abstract class Emitter { | 145 abstract class Emitter { |
| 146 /// Uses the [programBuilder] to generate a model of the program, emits | 146 /// Uses the [programBuilder] to generate a model of the program, emits |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); | 185 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); |
| 186 | 186 |
| 187 /// Returns the JS code for accessing the given [constant]. | 187 /// Returns the JS code for accessing the given [constant]. |
| 188 jsAst.Expression constantReference(ConstantValue constant); | 188 jsAst.Expression constantReference(ConstantValue constant); |
| 189 | 189 |
| 190 /// Returns the JS template for the given [builtin]. | 190 /// Returns the JS template for the given [builtin]. |
| 191 jsAst.Template templateForBuiltin(JsBuiltin builtin); | 191 jsAst.Template templateForBuiltin(JsBuiltin builtin); |
| 192 | 192 |
| 193 void invalidateCaches(); | 193 void invalidateCaches(); |
| 194 } | 194 } |
| OLD | NEW |