| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 oldEmitter = new OldEmitter(compiler, namer, generateSourceMap, this); | 54 oldEmitter = new OldEmitter(compiler, namer, generateSourceMap, this); |
| 55 emitter = USE_NEW_EMITTER | 55 emitter = USE_NEW_EMITTER |
| 56 ? new new_js_emitter.Emitter(compiler, namer) | 56 ? new new_js_emitter.Emitter(compiler, namer) |
| 57 : oldEmitter; | 57 : oldEmitter; |
| 58 nativeEmitter = new NativeEmitter(this); | 58 nativeEmitter = new NativeEmitter(this); |
| 59 } | 59 } |
| 60 | 60 |
| 61 String get name => 'Code emitter'; |
| 62 |
| 61 /// Returns the closure expression of a static function. | 63 /// Returns the closure expression of a static function. |
| 62 jsAst.Expression isolateStaticClosureAccess(FunctionElement element) { | 64 jsAst.Expression isolateStaticClosureAccess(FunctionElement element) { |
| 63 return emitter.isolateStaticClosureAccess(element); | 65 return emitter.isolateStaticClosureAccess(element); |
| 64 } | 66 } |
| 65 | 67 |
| 66 /// Returns the JS function that must be invoked to get the value of the | 68 /// Returns the JS function that must be invoked to get the value of the |
| 67 /// lazily initialized static. | 69 /// lazily initialized static. |
| 68 jsAst.Expression isolateLazyInitializerAccess(FieldElement element) { | 70 jsAst.Expression isolateLazyInitializerAccess(FieldElement element) { |
| 69 return emitter.isolateLazyInitializerAccess(element); | 71 return emitter.isolateLazyInitializerAccess(element); |
| 70 } | 72 } |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 jsAst.Expression typeAccess(Element e); | 457 jsAst.Expression typeAccess(Element e); |
| 456 | 458 |
| 457 /// Returns the JS expression representing a function that returns 'null' | 459 /// Returns the JS expression representing a function that returns 'null' |
| 458 jsAst.Expression generateFunctionThatReturnsNull(); | 460 jsAst.Expression generateFunctionThatReturnsNull(); |
| 459 | 461 |
| 460 int compareConstants(ConstantValue a, ConstantValue b); | 462 int compareConstants(ConstantValue a, ConstantValue b); |
| 461 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); | 463 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); |
| 462 | 464 |
| 463 void invalidateCaches(); | 465 void invalidateCaches(); |
| 464 } | 466 } |
| OLD | NEW |