| 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 staticFieldAccess(Element e) { |
| 69 return emitter.staticFunctionAccess(e); |
| 70 } |
| 71 |
| 72 jsAst.Expression staticFunctionAccess(Element e) { |
| 73 return emitter.staticFunctionAccess(e); |
| 74 } |
| 75 |
| 76 jsAst.Expression classAccess(Element e) { |
| 77 return emitter.classAccess(e); |
| 78 } |
| 79 |
| 80 jsAst.Expression typedefAccess(Element e) { |
| 81 return emitter.typedefAccess(e); |
| 82 } |
| 83 |
| 68 void registerReadTypeVariable(TypeVariableElement element) { | 84 void registerReadTypeVariable(TypeVariableElement element) { |
| 69 readTypeVariables.add(element); | 85 readTypeVariables.add(element); |
| 70 } | 86 } |
| 71 | 87 |
| 72 Set<ClassElement> interceptorsReferencedFromConstants() { | 88 Set<ClassElement> interceptorsReferencedFromConstants() { |
| 73 Set<ClassElement> classes = new Set<ClassElement>(); | 89 Set<ClassElement> classes = new Set<ClassElement>(); |
| 74 JavaScriptConstantCompiler handler = backend.constants; | 90 JavaScriptConstantCompiler handler = backend.constants; |
| 75 List<ConstantValue> constants = handler.getConstantsForEmission(); | 91 List<ConstantValue> constants = handler.getConstantsForEmission(); |
| 76 for (ConstantValue constant in constants) { | 92 for (ConstantValue constant in constants) { |
| 77 if (constant is InterceptorConstantValue) { | 93 if (constant is InterceptorConstantValue) { |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 emitter.emitProgram(program); | 363 emitter.emitProgram(program); |
| 348 }); | 364 }); |
| 349 } | 365 } |
| 350 } | 366 } |
| 351 | 367 |
| 352 abstract class Emitter { | 368 abstract class Emitter { |
| 353 void emitProgram(Program program); | 369 void emitProgram(Program program); |
| 354 | 370 |
| 355 jsAst.Expression generateEmbeddedGlobalAccess(String global); | 371 jsAst.Expression generateEmbeddedGlobalAccess(String global); |
| 356 jsAst.Expression constantReference(ConstantValue value); | 372 jsAst.Expression constantReference(ConstantValue value); |
| 373 jsAst.PropertyAccess staticFunctionAccess(Element element); |
| 374 |
| 375 // TODO(zarah): Split into more fine-grained accesses |
| 376 /// Generates access to the js constructor of the class represented by |
| 377 /// [element] |
| 378 jsAst.PropertyAccess classAccess(Element element); |
| 379 jsAst.PropertyAccess typedefAccess(Element element); |
| 380 jsAst.PropertyAccess staticFieldAccess(Element element); |
| 381 |
| 357 | 382 |
| 358 int compareConstants(ConstantValue a, ConstantValue b); | 383 int compareConstants(ConstantValue a, ConstantValue b); |
| 359 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); | 384 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); |
| 360 | 385 |
| 361 void invalidateCaches(); | 386 void invalidateCaches(); |
| 362 } | 387 } |
| OLD | NEW |