| 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_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter"); | 7 const USE_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 */ | 189 */ |
| 190 void computeNeededConstants() { | 190 void computeNeededConstants() { |
| 191 // Make sure we retain all metadata of all elements. This could add new | 191 // Make sure we retain all metadata of all elements. This could add new |
| 192 // constants to the handler. | 192 // constants to the handler. |
| 193 if (backend.mustRetainMetadata) { | 193 if (backend.mustRetainMetadata) { |
| 194 // TODO(floitsch): verify that we don't run through the same elements | 194 // TODO(floitsch): verify that we don't run through the same elements |
| 195 // multiple times. | 195 // multiple times. |
| 196 for (Element element in backend.generatedCode.keys) { | 196 for (Element element in backend.generatedCode.keys) { |
| 197 if (backend.isAccessibleByReflection(element)) { | 197 if (backend.isAccessibleByReflection(element)) { |
| 198 bool shouldRetainMetadata = backend.retainMetadataOf(element); | 198 bool shouldRetainMetadata = backend.retainMetadataOf(element); |
| 199 if (shouldRetainMetadata && element.isFunction) { | 199 if (shouldRetainMetadata && |
| 200 (element.isFunction || element.isConstructor || |
| 201 element.isSetter)) { |
| 200 FunctionElement function = element; | 202 FunctionElement function = element; |
| 201 function.functionSignature.forEachParameter( | 203 function.functionSignature.forEachParameter( |
| 202 backend.retainMetadataOf); | 204 backend.retainMetadataOf); |
| 203 } | 205 } |
| 204 } | 206 } |
| 205 } | 207 } |
| 206 for (ClassElement cls in neededClasses) { | 208 for (ClassElement cls in neededClasses) { |
| 207 final onlyForRti = typeTestRegistry.rtiNeededClasses.contains(cls); | 209 final onlyForRti = typeTestRegistry.rtiNeededClasses.contains(cls); |
| 208 if (!onlyForRti) { | 210 if (!onlyForRti) { |
| 209 backend.retainMetadataOf(cls); | 211 backend.retainMetadataOf(cls); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 jsAst.Expression generateFunctionThatReturnsNull(); | 444 jsAst.Expression generateFunctionThatReturnsNull(); |
| 443 | 445 |
| 444 int compareConstants(ConstantValue a, ConstantValue b); | 446 int compareConstants(ConstantValue a, ConstantValue b); |
| 445 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); | 447 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); |
| 446 | 448 |
| 447 /// Returns the JS code for accessing the given [constant]. | 449 /// Returns the JS code for accessing the given [constant]. |
| 448 jsAst.Expression constantReference(ConstantValue constant); | 450 jsAst.Expression constantReference(ConstantValue constant); |
| 449 | 451 |
| 450 void invalidateCaches(); | 452 void invalidateCaches(); |
| 451 } | 453 } |
| OLD | NEW |