| 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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 * TODO(ngeoffray): Use a BitSet instead. | 693 * TODO(ngeoffray): Use a BitSet instead. |
| 694 */ | 694 */ |
| 695 final Map<ClassElement, ClassElement> interceptedClasses; | 695 final Map<ClassElement, ClassElement> interceptedClasses; |
| 696 | 696 |
| 697 List<CompilerTask> get tasks { | 697 List<CompilerTask> get tasks { |
| 698 return <CompilerTask>[builder, optimizer, generator, emitter]; | 698 return <CompilerTask>[builder, optimizer, generator, emitter]; |
| 699 } | 699 } |
| 700 | 700 |
| 701 final RuntimeTypeInformation rti; | 701 final RuntimeTypeInformation rti; |
| 702 | 702 |
| 703 JavaScriptBackend(Compiler compiler, | 703 JavaScriptBackend(Compiler compiler, bool generateSourceMap, bool disableEval) |
| 704 bool generateSourceMap, | 704 : namer = determineNamer(compiler), |
| 705 bool disableEval) | |
| 706 : namer = new Namer(compiler), | |
| 707 returnInfo = new Map<Element, ReturnInfo>(), | 705 returnInfo = new Map<Element, ReturnInfo>(), |
| 708 invalidateAfterCodegen = new List<Element>(), | 706 invalidateAfterCodegen = new List<Element>(), |
| 709 interceptors = new Interceptors(compiler), | 707 interceptors = new Interceptors(compiler), |
| 710 usedInterceptors = new Set<Selector>(), | 708 usedInterceptors = new Set<Selector>(), |
| 711 interceptedElements = new Map<SourceString, Set<Element>>(), | 709 interceptedElements = new Map<SourceString, Set<Element>>(), |
| 712 rti = new RuntimeTypeInformation(compiler), | 710 rti = new RuntimeTypeInformation(compiler), |
| 713 specializedGetInterceptors = | 711 specializedGetInterceptors = |
| 714 new Map<String, Collection<ClassElement>>(), | 712 new Map<String, Collection<ClassElement>>(), |
| 715 interceptedClasses = new LinkedHashMap<ClassElement, ClassElement>(), | 713 interceptedClasses = new LinkedHashMap<ClassElement, ClassElement>(), |
| 716 super(compiler, JAVA_SCRIPT_CONSTANT_SYSTEM) { | 714 super(compiler, JAVA_SCRIPT_CONSTANT_SYSTEM) { |
| 717 emitter = disableEval | 715 emitter = disableEval |
| 718 ? new CodeEmitterNoEvalTask(compiler, namer, generateSourceMap) | 716 ? new CodeEmitterNoEvalTask(compiler, namer, generateSourceMap) |
| 719 : new CodeEmitterTask(compiler, namer, generateSourceMap); | 717 : new CodeEmitterTask(compiler, namer, generateSourceMap); |
| 720 builder = new SsaBuilderTask(this); | 718 builder = new SsaBuilderTask(this); |
| 721 optimizer = new SsaOptimizerTask(this); | 719 optimizer = new SsaOptimizerTask(this); |
| 722 generator = new SsaCodeGeneratorTask(this); | 720 generator = new SsaCodeGeneratorTask(this); |
| 723 argumentTypes = new ArgumentTypesRegistry(this); | 721 argumentTypes = new ArgumentTypesRegistry(this); |
| 724 fieldTypes = new FieldTypesRegistry(this); | 722 fieldTypes = new FieldTypesRegistry(this); |
| 725 } | 723 } |
| 726 | 724 |
| 725 static Namer determineNamer(Compiler compiler) { |
| 726 return compiler.enableMinification ? |
| 727 new MinifyNamer(compiler) : |
| 728 new Namer(compiler); |
| 729 } |
| 730 |
| 727 bool isInterceptorClass(Element element) { | 731 bool isInterceptorClass(Element element) { |
| 728 if (element == null) return false; | 732 if (element == null) return false; |
| 729 return interceptedClasses.containsKey(element); | 733 return interceptedClasses.containsKey(element); |
| 730 } | 734 } |
| 731 | 735 |
| 732 void addInterceptedSelector(Selector selector) { | 736 void addInterceptedSelector(Selector selector) { |
| 733 usedInterceptors.add(selector); | 737 usedInterceptors.add(selector); |
| 734 } | 738 } |
| 735 | 739 |
| 736 /** | 740 /** |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 print("Inferred return types:"); | 1132 print("Inferred return types:"); |
| 1129 print("----------------------"); | 1133 print("----------------------"); |
| 1130 dumpReturnTypes(); | 1134 dumpReturnTypes(); |
| 1131 print(""); | 1135 print(""); |
| 1132 print("Inferred field types:"); | 1136 print("Inferred field types:"); |
| 1133 print("------------------------"); | 1137 print("------------------------"); |
| 1134 fieldTypes.dump(); | 1138 fieldTypes.dump(); |
| 1135 print(""); | 1139 print(""); |
| 1136 } | 1140 } |
| 1137 } | 1141 } |
| OLD | NEW |