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