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 library js_backend.backend; | 5 library js_backend.backend; |
6 | 6 |
7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
10 | 10 |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 final NativeData nativeData = new NativeData(); | 590 final NativeData nativeData = new NativeData(); |
591 | 591 |
592 final BackendHelpers helpers; | 592 final BackendHelpers helpers; |
593 final BackendImpacts impacts; | 593 final BackendImpacts impacts; |
594 | 594 |
595 final JSFrontendAccess frontend; | 595 final JSFrontendAccess frontend; |
596 | 596 |
597 JavaScriptBackend(Compiler compiler, | 597 JavaScriptBackend(Compiler compiler, |
598 {bool generateSourceMap: true, | 598 {bool generateSourceMap: true, |
599 bool useStartupEmitter: false, | 599 bool useStartupEmitter: false, |
600 bool useNewSourceInfo: false}) | 600 bool useNewSourceInfo: false, |
| 601 bool useKernel: false}) |
601 : namer = determineNamer(compiler), | 602 : namer = determineNamer(compiler), |
602 oneShotInterceptors = new Map<jsAst.Name, Selector>(), | 603 oneShotInterceptors = new Map<jsAst.Name, Selector>(), |
603 interceptedElements = new Map<String, Set<Element>>(), | 604 interceptedElements = new Map<String, Set<Element>>(), |
604 rti = new _RuntimeTypes(compiler), | 605 rti = new _RuntimeTypes(compiler), |
605 rtiEncoder = new _RuntimeTypesEncoder(compiler), | 606 rtiEncoder = new _RuntimeTypesEncoder(compiler), |
606 specializedGetInterceptors = new Map<jsAst.Name, Set<ClassElement>>(), | 607 specializedGetInterceptors = new Map<jsAst.Name, Set<ClassElement>>(), |
607 annotations = new Annotations(compiler), | 608 annotations = new Annotations(compiler), |
608 this.sourceInformationStrategy = generateSourceMap | 609 this.sourceInformationStrategy = generateSourceMap |
609 ? (useNewSourceInfo | 610 ? (useNewSourceInfo |
610 ? new PositionSourceInformationStrategy() | 611 ? new PositionSourceInformationStrategy() |
611 : const StartEndSourceInformationStrategy()) | 612 : const StartEndSourceInformationStrategy()) |
612 : const JavaScriptSourceInformationStrategy(), | 613 : const JavaScriptSourceInformationStrategy(), |
613 helpers = new BackendHelpers(compiler), | 614 helpers = new BackendHelpers(compiler), |
614 impacts = new BackendImpacts(compiler), | 615 impacts = new BackendImpacts(compiler), |
615 frontend = new JSFrontendAccess(compiler), | 616 frontend = new JSFrontendAccess(compiler), |
616 super(compiler) { | 617 super(compiler) { |
617 emitter = new CodeEmitterTask( | 618 emitter = new CodeEmitterTask( |
618 compiler, namer, generateSourceMap, useStartupEmitter); | 619 compiler, namer, generateSourceMap, useStartupEmitter); |
619 typeVariableHandler = new TypeVariableHandler(compiler); | 620 typeVariableHandler = new TypeVariableHandler(compiler); |
620 customElementsAnalysis = new CustomElementsAnalysis(this); | 621 customElementsAnalysis = new CustomElementsAnalysis(this); |
621 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); | 622 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); |
622 jsInteropAnalysis = new JsInteropAnalysis(this); | 623 jsInteropAnalysis = new JsInteropAnalysis(this); |
623 | 624 |
624 noSuchMethodRegistry = new NoSuchMethodRegistry(this); | 625 noSuchMethodRegistry = new NoSuchMethodRegistry(this); |
625 constantCompilerTask = new JavaScriptConstantTask(compiler); | 626 constantCompilerTask = new JavaScriptConstantTask(compiler); |
626 impactTransformer = new JavaScriptImpactTransformer(this); | 627 impactTransformer = new JavaScriptImpactTransformer(this); |
627 patchResolverTask = new PatchResolverTask(compiler); | 628 patchResolverTask = new PatchResolverTask(compiler); |
| 629 // TODO(sigmund): pass along the kernel flag. |
628 functionCompiler = new SsaFunctionCompiler(this, sourceInformationStrategy); | 630 functionCompiler = new SsaFunctionCompiler(this, sourceInformationStrategy); |
629 serialization = new JavaScriptBackendSerialization(this); | 631 serialization = new JavaScriptBackendSerialization(this); |
630 } | 632 } |
631 | 633 |
632 ConstantSystem get constantSystem => constants.constantSystem; | 634 ConstantSystem get constantSystem => constants.constantSystem; |
633 | 635 |
634 DiagnosticReporter get reporter => compiler.reporter; | 636 DiagnosticReporter get reporter => compiler.reporter; |
635 | 637 |
636 CoreClasses get coreClasses => compiler.coreClasses; | 638 CoreClasses get coreClasses => compiler.coreClasses; |
637 | 639 |
(...skipping 2558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3196 | 3198 |
3197 @override | 3199 @override |
3198 void onImpactUsed(ImpactUseCase impactUse) { | 3200 void onImpactUsed(ImpactUseCase impactUse) { |
3199 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { | 3201 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { |
3200 // TODO(johnniwinther): Allow emptying when serialization has been | 3202 // TODO(johnniwinther): Allow emptying when serialization has been |
3201 // performed. | 3203 // performed. |
3202 resolution.emptyCache(); | 3204 resolution.emptyCache(); |
3203 } | 3205 } |
3204 } | 3206 } |
3205 } | 3207 } |
OLD | NEW |