| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 | 59 |
| 60 jsAst.Expression generateEmbeddedGlobalAccess(String global) { | 60 jsAst.Expression generateEmbeddedGlobalAccess(String global) { |
| 61 return emitter.generateEmbeddedGlobalAccess(global); | 61 return emitter.generateEmbeddedGlobalAccess(global); |
| 62 } | 62 } |
| 63 | 63 |
| 64 jsAst.Expression constantReference(ConstantValue value) { | 64 jsAst.Expression constantReference(ConstantValue value) { |
| 65 return emitter.constantReference(value); | 65 return emitter.constantReference(value); |
| 66 } | 66 } |
| 67 | 67 |
| 68 jsAst.Expression globalPropertyAccess(Element e) { |
| 69 return emitter.globalPropertyAccess(e); |
| 70 } |
| 71 |
| 68 void registerReadTypeVariable(TypeVariableElement element) { | 72 void registerReadTypeVariable(TypeVariableElement element) { |
| 69 readTypeVariables.add(element); | 73 readTypeVariables.add(element); |
| 70 } | 74 } |
| 71 | 75 |
| 72 Set<ClassElement> interceptorsReferencedFromConstants() { | 76 Set<ClassElement> interceptorsReferencedFromConstants() { |
| 73 Set<ClassElement> classes = new Set<ClassElement>(); | 77 Set<ClassElement> classes = new Set<ClassElement>(); |
| 74 JavaScriptConstantCompiler handler = backend.constants; | 78 JavaScriptConstantCompiler handler = backend.constants; |
| 75 List<ConstantValue> constants = handler.getConstantsForEmission(); | 79 List<ConstantValue> constants = handler.getConstantsForEmission(); |
| 76 for (ConstantValue constant in constants) { | 80 for (ConstantValue constant in constants) { |
| 77 if (constant is InterceptorConstantValue) { | 81 if (constant is InterceptorConstantValue) { |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 emitter.emitProgram(program); | 351 emitter.emitProgram(program); |
| 348 }); | 352 }); |
| 349 } | 353 } |
| 350 } | 354 } |
| 351 | 355 |
| 352 abstract class Emitter { | 356 abstract class Emitter { |
| 353 void emitProgram(Program program); | 357 void emitProgram(Program program); |
| 354 | 358 |
| 355 jsAst.Expression generateEmbeddedGlobalAccess(String global); | 359 jsAst.Expression generateEmbeddedGlobalAccess(String global); |
| 356 jsAst.Expression constantReference(ConstantValue value); | 360 jsAst.Expression constantReference(ConstantValue value); |
| 361 jsAst.PropertyAccess globalPropertyAccess(Element element); |
| 357 | 362 |
| 358 int compareConstants(ConstantValue a, ConstantValue b); | 363 int compareConstants(ConstantValue a, ConstantValue b); |
| 359 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); | 364 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); |
| 360 | 365 |
| 361 void invalidateCaches(); | 366 void invalidateCaches(); |
| 362 } | 367 } |
| OLD | NEW |