| 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 js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 typedef void Recompile(Element element); | 7 typedef void Recompile(Element element); |
| 8 | 8 |
| 9 class ReturnInfo { | 9 class ReturnInfo { |
| 10 HType returnType; | 10 HType returnType; |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 final List<Element> invalidateAfterCodegen; | 662 final List<Element> invalidateAfterCodegen; |
| 663 ArgumentTypesRegistry argumentTypes; | 663 ArgumentTypesRegistry argumentTypes; |
| 664 FieldTypesRegistry fieldTypes; | 664 FieldTypesRegistry fieldTypes; |
| 665 | 665 |
| 666 final Interceptors interceptors; | 666 final Interceptors interceptors; |
| 667 | 667 |
| 668 List<CompilerTask> get tasks { | 668 List<CompilerTask> get tasks { |
| 669 return <CompilerTask>[builder, optimizer, generator, emitter]; | 669 return <CompilerTask>[builder, optimizer, generator, emitter]; |
| 670 } | 670 } |
| 671 | 671 |
| 672 JavaScriptBackend(Compiler compiler, bool generateSourceMap, bool disableEval) | 672 JavaScriptBackend(Compiler compiler, |
| 673 : namer = determineNamer(compiler), | 673 bool generateSourceMap, |
| 674 bool disableEval) |
| 675 : namer = new Namer(compiler), |
| 674 returnInfo = new Map<Element, ReturnInfo>(), | 676 returnInfo = new Map<Element, ReturnInfo>(), |
| 675 invalidateAfterCodegen = new List<Element>(), | 677 invalidateAfterCodegen = new List<Element>(), |
| 676 interceptors = new Interceptors(compiler), | 678 interceptors = new Interceptors(compiler), |
| 677 super(compiler, JAVA_SCRIPT_CONSTANT_SYSTEM) { | 679 super(compiler, JAVA_SCRIPT_CONSTANT_SYSTEM) { |
| 678 emitter = disableEval | 680 emitter = disableEval |
| 679 ? new CodeEmitterNoEvalTask(compiler, namer, generateSourceMap) | 681 ? new CodeEmitterNoEvalTask(compiler, namer, generateSourceMap) |
| 680 : new CodeEmitterTask(compiler, namer, generateSourceMap); | 682 : new CodeEmitterTask(compiler, namer, generateSourceMap); |
| 681 builder = new SsaBuilderTask(this); | 683 builder = new SsaBuilderTask(this); |
| 682 optimizer = new SsaOptimizerTask(this); | 684 optimizer = new SsaOptimizerTask(this); |
| 683 generator = new SsaCodeGeneratorTask(this); | 685 generator = new SsaCodeGeneratorTask(this); |
| 684 argumentTypes = new ArgumentTypesRegistry(this); | 686 argumentTypes = new ArgumentTypesRegistry(this); |
| 685 fieldTypes = new FieldTypesRegistry(this); | 687 fieldTypes = new FieldTypesRegistry(this); |
| 686 } | 688 } |
| 687 | 689 |
| 688 static Namer determineNamer(Compiler compiler) { | |
| 689 // TODO(erikcorry): Use the MinifyNamer depending on | |
| 690 // compiler.enableMinification. | |
| 691 return new Namer(compiler); | |
| 692 } | |
| 693 | |
| 694 Element get cyclicThrowHelper { | 690 Element get cyclicThrowHelper { |
| 695 return compiler.findHelper(const SourceString("throwCyclicInit")); | 691 return compiler.findHelper(const SourceString("throwCyclicInit")); |
| 696 } | 692 } |
| 697 | 693 |
| 698 JavaScriptItemCompilationContext createItemCompilationContext() { | 694 JavaScriptItemCompilationContext createItemCompilationContext() { |
| 699 return new JavaScriptItemCompilationContext(); | 695 return new JavaScriptItemCompilationContext(); |
| 700 } | 696 } |
| 701 | 697 |
| 702 Element getInterceptor(Selector selector) { | 698 Element getInterceptor(Selector selector) { |
| 703 return interceptors.getStaticInterceptorBySelector(selector); | 699 return interceptors.getStaticInterceptorBySelector(selector); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 print("Inferred return types:"); | 947 print("Inferred return types:"); |
| 952 print("----------------------"); | 948 print("----------------------"); |
| 953 dumpReturnTypes(); | 949 dumpReturnTypes(); |
| 954 print(""); | 950 print(""); |
| 955 print("Inferred field types:"); | 951 print("Inferred field types:"); |
| 956 print("------------------------"); | 952 print("------------------------"); |
| 957 fieldTypes.dump(); | 953 fieldTypes.dump(); |
| 958 print(""); | 954 print(""); |
| 959 } | 955 } |
| 960 } | 956 } |
| OLD | NEW |