| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 new Set<TypeVariableElement>(); | 44 new Set<TypeVariableElement>(); |
| 45 | 45 |
| 46 List<TypedefElement> typedefsNeededForReflection; | 46 List<TypedefElement> typedefsNeededForReflection; |
| 47 | 47 |
| 48 JavaScriptBackend get backend => compiler.backend; | 48 JavaScriptBackend get backend => compiler.backend; |
| 49 | 49 |
| 50 CodeEmitterTask(Compiler compiler, Namer namer, bool generateSourceMap) | 50 CodeEmitterTask(Compiler compiler, Namer namer, bool generateSourceMap) |
| 51 : super(compiler), | 51 : super(compiler), |
| 52 this.namer = namer, | 52 this.namer = namer, |
| 53 this.typeTestRegistry = new TypeTestRegistry(compiler) { | 53 this.typeTestRegistry = new TypeTestRegistry(compiler) { |
| 54 nativeEmitter = new NativeEmitter(this); |
| 54 oldEmitter = new OldEmitter(compiler, namer, generateSourceMap, this); | 55 oldEmitter = new OldEmitter(compiler, namer, generateSourceMap, this); |
| 55 emitter = USE_NEW_EMITTER | 56 emitter = USE_NEW_EMITTER |
| 56 ? new new_js_emitter.Emitter(compiler, namer) | 57 ? new new_js_emitter.Emitter(compiler, namer, nativeEmitter) |
| 57 : oldEmitter; | 58 : oldEmitter; |
| 58 nativeEmitter = new NativeEmitter(this); | |
| 59 } | 59 } |
| 60 | 60 |
| 61 /// Returns the closure expression of a static function. | 61 /// Returns the closure expression of a static function. |
| 62 jsAst.Expression isolateStaticClosureAccess(FunctionElement element) { | 62 jsAst.Expression isolateStaticClosureAccess(FunctionElement element) { |
| 63 return emitter.isolateStaticClosureAccess(element); | 63 return emitter.isolateStaticClosureAccess(element); |
| 64 } | 64 } |
| 65 | 65 |
| 66 /// Returns the JS function that must be invoked to get the value of the | 66 /// Returns the JS function that must be invoked to get the value of the |
| 67 /// lazily initialized static. | 67 /// lazily initialized static. |
| 68 jsAst.Expression isolateLazyInitializerAccess(FieldElement element) { | 68 jsAst.Expression isolateLazyInitializerAccess(FieldElement element) { |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 jsAst.Expression typeAccess(Element e); | 455 jsAst.Expression typeAccess(Element e); |
| 456 | 456 |
| 457 /// Returns the JS expression representing a function that returns 'null' | 457 /// Returns the JS expression representing a function that returns 'null' |
| 458 jsAst.Expression generateFunctionThatReturnsNull(); | 458 jsAst.Expression generateFunctionThatReturnsNull(); |
| 459 | 459 |
| 460 int compareConstants(ConstantValue a, ConstantValue b); | 460 int compareConstants(ConstantValue a, ConstantValue b); |
| 461 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); | 461 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); |
| 462 | 462 |
| 463 void invalidateCaches(); | 463 void invalidateCaches(); |
| 464 } | 464 } |
| OLD | NEW |