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 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
8 | 8 |
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 JavaScriptConstantTask constantCompilerTask; | 592 JavaScriptConstantTask constantCompilerTask; |
593 | 593 |
594 JavaScriptResolutionCallbacks resolutionCallbacks; | 594 JavaScriptResolutionCallbacks resolutionCallbacks; |
595 | 595 |
596 PatchResolverTask patchResolverTask; | 596 PatchResolverTask patchResolverTask; |
597 | 597 |
598 bool get canHandleCompilationFailed => true; | 598 bool get canHandleCompilationFailed => true; |
599 | 599 |
600 bool enabledNoSuchMethod = false; | 600 bool enabledNoSuchMethod = false; |
601 | 601 |
602 JavaScriptBackend(Compiler compiler, bool generateSourceMap) | 602 JavaScriptBackend(Compiler compiler, |
| 603 SourceInformationFactory sourceInformationFactory, |
| 604 {bool generateSourceMap: true}) |
603 : namer = determineNamer(compiler), | 605 : namer = determineNamer(compiler), |
604 oneShotInterceptors = new Map<String, Selector>(), | 606 oneShotInterceptors = new Map<String, Selector>(), |
605 interceptedElements = new Map<String, Set<Element>>(), | 607 interceptedElements = new Map<String, Set<Element>>(), |
606 rti = new RuntimeTypes(compiler), | 608 rti = new RuntimeTypes(compiler), |
607 specializedGetInterceptors = new Map<String, Set<ClassElement>>(), | 609 specializedGetInterceptors = new Map<String, Set<ClassElement>>(), |
608 super(compiler) { | 610 super(compiler) { |
609 emitter = new CodeEmitterTask(compiler, namer, generateSourceMap); | 611 emitter = new CodeEmitterTask(compiler, namer, generateSourceMap); |
610 typeVariableHandler = new TypeVariableHandler(compiler); | 612 typeVariableHandler = new TypeVariableHandler(compiler); |
611 customElementsAnalysis = new CustomElementsAnalysis(this); | 613 customElementsAnalysis = new CustomElementsAnalysis(this); |
612 noSuchMethodRegistry = new NoSuchMethodRegistry(this); | 614 noSuchMethodRegistry = new NoSuchMethodRegistry(this); |
613 constantCompilerTask = new JavaScriptConstantTask(compiler); | 615 constantCompilerTask = new JavaScriptConstantTask(compiler); |
614 resolutionCallbacks = new JavaScriptResolutionCallbacks(this); | 616 resolutionCallbacks = new JavaScriptResolutionCallbacks(this); |
615 patchResolverTask = new PatchResolverTask(compiler); | 617 patchResolverTask = new PatchResolverTask(compiler); |
616 functionCompiler = compiler.useCpsIr | 618 functionCompiler = compiler.useCpsIr |
617 ? new CpsFunctionCompiler( | 619 ? new CpsFunctionCompiler( |
618 compiler, this, generateSourceMap: generateSourceMap) | 620 compiler, this, sourceInformationFactory) |
619 : new SsaFunctionCompiler(this, generateSourceMap); | 621 : new SsaFunctionCompiler(this, sourceInformationFactory); |
620 } | 622 } |
621 | 623 |
622 ConstantSystem get constantSystem => constants.constantSystem; | 624 ConstantSystem get constantSystem => constants.constantSystem; |
623 | 625 |
624 /// Returns constant environment for the JavaScript interpretation of the | 626 /// Returns constant environment for the JavaScript interpretation of the |
625 /// constants. | 627 /// constants. |
626 JavaScriptConstantCompiler get constants { | 628 JavaScriptConstantCompiler get constants { |
627 return constantCompilerTask.jsConstantCompiler; | 629 return constantCompilerTask.jsConstantCompiler; |
628 } | 630 } |
629 | 631 |
(...skipping 2276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2906 } | 2908 } |
2907 } | 2909 } |
2908 | 2910 |
2909 /// Records that [constant] is used by the element behind [registry]. | 2911 /// Records that [constant] is used by the element behind [registry]. |
2910 class Dependency { | 2912 class Dependency { |
2911 final ConstantValue constant; | 2913 final ConstantValue constant; |
2912 final Element annotatedElement; | 2914 final Element annotatedElement; |
2913 | 2915 |
2914 const Dependency(this.constant, this.annotatedElement); | 2916 const Dependency(this.constant, this.annotatedElement); |
2915 } | 2917 } |
OLD | NEW |