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