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