| 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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 | 654 |
| 655 /** | 655 /** |
| 656 * Documentation wanted -- johnniwinther | 656 * Documentation wanted -- johnniwinther |
| 657 * | 657 * |
| 658 * Invariant: Elements must be declaration elements. | 658 * Invariant: Elements must be declaration elements. |
| 659 */ | 659 */ |
| 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; |
| 665 |
| 664 List<CompilerTask> get tasks { | 666 List<CompilerTask> get tasks { |
| 665 return <CompilerTask>[builder, optimizer, generator, emitter]; | 667 return <CompilerTask>[builder, optimizer, generator, emitter]; |
| 666 } | 668 } |
| 667 | 669 |
| 668 JavaScriptBackend(Compiler compiler, bool generateSourceMap) | 670 JavaScriptBackend(Compiler compiler, bool generateSourceMap) |
| 669 : namer = new Namer(compiler), | 671 : namer = new Namer(compiler), |
| 670 returnInfo = new Map<Element, ReturnInfo>(), | 672 returnInfo = new Map<Element, ReturnInfo>(), |
| 671 invalidateAfterCodegen = new List<Element>(), | 673 invalidateAfterCodegen = new List<Element>(), |
| 674 interceptors = new Interceptors(compiler), |
| 672 super(compiler, constantSystem: JAVA_SCRIPT_CONSTANT_SYSTEM) { | 675 super(compiler, constantSystem: JAVA_SCRIPT_CONSTANT_SYSTEM) { |
| 673 emitter = new CodeEmitterTask(compiler, namer, generateSourceMap); | 676 emitter = new CodeEmitterTask(compiler, namer, generateSourceMap); |
| 674 builder = new SsaBuilderTask(this); | 677 builder = new SsaBuilderTask(this); |
| 675 optimizer = new SsaOptimizerTask(this); | 678 optimizer = new SsaOptimizerTask(this); |
| 676 generator = new SsaCodeGeneratorTask(this); | 679 generator = new SsaCodeGeneratorTask(this); |
| 677 argumentTypes = new ArgumentTypesRegistry(this); | 680 argumentTypes = new ArgumentTypesRegistry(this); |
| 678 fieldTypes = new FieldTypesRegistry(this); | 681 fieldTypes = new FieldTypesRegistry(this); |
| 679 } | 682 } |
| 680 | 683 |
| 681 Element get cyclicThrowHelper { | 684 Element get cyclicThrowHelper { |
| 682 return compiler.findHelper(const SourceString("throwCyclicInit")); | 685 return compiler.findHelper(const SourceString("throwCyclicInit")); |
| 683 } | 686 } |
| 684 | 687 |
| 685 JavaScriptItemCompilationContext createItemCompilationContext() { | 688 JavaScriptItemCompilationContext createItemCompilationContext() { |
| 686 return new JavaScriptItemCompilationContext(); | 689 return new JavaScriptItemCompilationContext(); |
| 687 } | 690 } |
| 688 | 691 |
| 692 Element getInterceptor(Selector selector) { |
| 693 return interceptors.getStaticInterceptorBySelector(selector); |
| 694 } |
| 695 |
| 689 void enqueueHelpers(Enqueuer world) { | 696 void enqueueHelpers(Enqueuer world) { |
| 690 enqueueAllTopLevelFunctions(compiler.jsHelperLibrary, world); | 697 enqueueAllTopLevelFunctions(compiler.jsHelperLibrary, world); |
| 691 | 698 |
| 692 jsIndexingBehaviorInterface = | 699 jsIndexingBehaviorInterface = |
| 693 compiler.findHelper(const SourceString('JavaScriptIndexingBehavior')); | 700 compiler.findHelper(const SourceString('JavaScriptIndexingBehavior')); |
| 694 if (jsIndexingBehaviorInterface != null) { | 701 if (jsIndexingBehaviorInterface != null) { |
| 695 world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler)); | 702 world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler)); |
| 696 } | 703 } |
| 697 | 704 |
| 698 for (var helper in [const SourceString('Closure'), | 705 for (var helper in [const SourceString('Closure'), |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 print("Inferred return types:"); | 941 print("Inferred return types:"); |
| 935 print("----------------------"); | 942 print("----------------------"); |
| 936 dumpReturnTypes(); | 943 dumpReturnTypes(); |
| 937 print(""); | 944 print(""); |
| 938 print("Inferred field types:"); | 945 print("Inferred field types:"); |
| 939 print("------------------------"); | 946 print("------------------------"); |
| 940 fieldTypes.dump(); | 947 fieldTypes.dump(); |
| 941 print(""); | 948 print(""); |
| 942 } | 949 } |
| 943 } | 950 } |
| OLD | NEW |