| 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 this.sourceInformationStrategy = generateSourceMap | 487 this.sourceInformationStrategy = generateSourceMap |
| 488 ? (useNewSourceInfo | 488 ? (useNewSourceInfo |
| 489 ? new PositionSourceInformationStrategy() | 489 ? new PositionSourceInformationStrategy() |
| 490 : const StartEndSourceInformationStrategy()) | 490 : const StartEndSourceInformationStrategy()) |
| 491 : const JavaScriptSourceInformationStrategy(), | 491 : const JavaScriptSourceInformationStrategy(), |
| 492 impacts = new BackendImpacts(compiler), | 492 impacts = new BackendImpacts(compiler), |
| 493 frontend = new JSFrontendAccess(compiler), | 493 frontend = new JSFrontendAccess(compiler), |
| 494 mirrorsData = new MirrorsData(compiler), | 494 mirrorsData = new MirrorsData(compiler), |
| 495 this.compiler = compiler { | 495 this.compiler = compiler { |
| 496 helpers = new BackendHelpers(compiler.elementEnvironment, commonElements); | 496 helpers = new BackendHelpers(compiler.elementEnvironment, commonElements); |
| 497 _backendUsage = new BackendUsage( | 497 _backendUsage = new BackendUsage(commonElements, helpers, resolution); |
| 498 commonElements, helpers, resolution, compiler.globalDependencies); | |
| 499 _checkedModeHelpers = new CheckedModeHelpers(commonElements, helpers); | 498 _checkedModeHelpers = new CheckedModeHelpers(commonElements, helpers); |
| 500 emitter = | 499 emitter = |
| 501 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter); | 500 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter); |
| 502 typeVariableHandler = new TypeVariableHandler(compiler); | 501 typeVariableHandler = new TypeVariableHandler(compiler); |
| 503 customElementsAnalysis = new CustomElementsAnalysis(this); | 502 customElementsAnalysis = new CustomElementsAnalysis(this); |
| 504 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); | 503 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); |
| 505 jsInteropAnalysis = new JsInteropAnalysis(this); | 504 jsInteropAnalysis = new JsInteropAnalysis(this); |
| 506 mirrorsAnalysis = new MirrorsAnalysis(this, compiler.resolution); | 505 mirrorsAnalysis = new MirrorsAnalysis(this, compiler.resolution); |
| 507 | 506 |
| 508 noSuchMethodRegistry = new NoSuchMethodRegistry(this); | 507 noSuchMethodRegistry = new NoSuchMethodRegistry(this); |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 | 925 |
| 927 customElementsAnalysis.registerInstantiatedClass(cls, | 926 customElementsAnalysis.registerInstantiatedClass(cls, |
| 928 forResolution: forResolution); | 927 forResolution: forResolution); |
| 929 if (!forResolution) { | 928 if (!forResolution) { |
| 930 lookupMapAnalysis.registerInstantiatedClass(cls); | 929 lookupMapAnalysis.registerInstantiatedClass(cls); |
| 931 } | 930 } |
| 932 | 931 |
| 933 return impactBuilder; | 932 return impactBuilder; |
| 934 } | 933 } |
| 935 | 934 |
| 936 void registerInstantiatedType(ResolutionInterfaceType type) { | 935 void registerInstantiatedType(ResolutionInterfaceType type, |
| 936 {bool isGlobal: false}) { |
| 937 if (isGlobal) { |
| 938 backendUsage.registerGlobalDependency(type.element); |
| 939 } |
| 937 lookupMapAnalysis.registerInstantiatedType(type); | 940 lookupMapAnalysis.registerInstantiatedType(type); |
| 938 } | 941 } |
| 939 | 942 |
| 940 /// Compute the [WorldImpact] for backend helper methods. | 943 /// Compute the [WorldImpact] for backend helper methods. |
| 941 WorldImpact computeHelpersImpact() { | 944 WorldImpact computeHelpersImpact() { |
| 942 assert(helpers.interceptorsLibrary != null); | 945 assert(helpers.interceptorsLibrary != null); |
| 943 WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl(); | 946 WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl(); |
| 944 // TODO(ngeoffray): Not enqueuing those two classes currently make | 947 // TODO(ngeoffray): Not enqueuing those two classes currently make |
| 945 // the compiler potentially crash. However, any reasonable program | 948 // the compiler potentially crash. However, any reasonable program |
| 946 // will instantiate those two classes. | 949 // will instantiate those two classes. |
| (...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2561 } | 2564 } |
| 2562 | 2565 |
| 2563 @override | 2566 @override |
| 2564 FieldEntity get symbolField => helpers.symbolImplementationField; | 2567 FieldEntity get symbolField => helpers.symbolImplementationField; |
| 2565 | 2568 |
| 2566 @override | 2569 @override |
| 2567 InterfaceType get symbolType { | 2570 InterfaceType get symbolType { |
| 2568 return _env.getRawType(helpers.symbolImplementationClass); | 2571 return _env.getRawType(helpers.symbolImplementationClass); |
| 2569 } | 2572 } |
| 2570 } | 2573 } |
| OLD | NEW |