| 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 '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/backend_api.dart' | 8 import '../common/backend_api.dart' |
| 9 show ForeignResolver, NativeRegistry, ImpactTransformer; | 9 show ForeignResolver, NativeRegistry, ImpactTransformer; |
| 10 import '../common/codegen.dart' show CodegenImpact, CodegenWorkItem; | 10 import '../common/codegen.dart' show CodegenImpact, CodegenWorkItem; |
| 11 import '../common/names.dart' show Uris; | 11 import '../common/names.dart' show Uris; |
| 12 import '../common/resolution.dart' | 12 import '../common/resolution.dart' show Resolution, Target; |
| 13 show Frontend, Resolution, ResolutionImpact, Target; | |
| 14 import '../common/tasks.dart' show CompilerTask; | 13 import '../common/tasks.dart' show CompilerTask; |
| 15 import '../compiler.dart' show Compiler; | 14 import '../compiler.dart' show Compiler; |
| 16 import '../constants/constant_system.dart'; | 15 import '../constants/constant_system.dart'; |
| 17 import '../constants/expressions.dart'; | 16 import '../constants/expressions.dart'; |
| 18 import '../constants/values.dart'; | 17 import '../constants/values.dart'; |
| 19 import '../common_elements.dart' show CommonElements; | 18 import '../common_elements.dart' show CommonElements; |
| 20 import '../deferred_load.dart' show DeferredLoadTask; | 19 import '../deferred_load.dart' show DeferredLoadTask; |
| 21 import '../dump_info.dart' show DumpInfoTask; | 20 import '../dump_info.dart' show DumpInfoTask; |
| 22 import '../elements/elements.dart'; | 21 import '../elements/elements.dart'; |
| 23 import '../elements/entities.dart'; | 22 import '../elements/entities.dart'; |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 MirrorsDataImpl _mirrorsData; | 437 MirrorsDataImpl _mirrorsData; |
| 439 CheckedModeHelpers _checkedModeHelpers; | 438 CheckedModeHelpers _checkedModeHelpers; |
| 440 | 439 |
| 441 final SuperMemberData superMemberData = new SuperMemberData(); | 440 final SuperMemberData superMemberData = new SuperMemberData(); |
| 442 | 441 |
| 443 native.NativeResolutionEnqueuer _nativeResolutionEnqueuer; | 442 native.NativeResolutionEnqueuer _nativeResolutionEnqueuer; |
| 444 native.NativeCodegenEnqueuer _nativeCodegenEnqueuer; | 443 native.NativeCodegenEnqueuer _nativeCodegenEnqueuer; |
| 445 | 444 |
| 446 BackendImpacts impacts; | 445 BackendImpacts impacts; |
| 447 | 446 |
| 448 /// Backend access to the front-end. | |
| 449 final JSFrontendAccess frontend; | |
| 450 | |
| 451 Target _target; | 447 Target _target; |
| 452 | 448 |
| 453 Tracer tracer; | 449 Tracer tracer; |
| 454 | 450 |
| 455 static SourceInformationStrategy createSourceInformationStrategy( | 451 static SourceInformationStrategy createSourceInformationStrategy( |
| 456 {bool generateSourceMap: false, | 452 {bool generateSourceMap: false, |
| 457 bool useMultiSourceInfo: false, | 453 bool useMultiSourceInfo: false, |
| 458 bool useNewSourceInfo: false}) { | 454 bool useNewSourceInfo: false}) { |
| 459 if (!generateSourceMap) return const JavaScriptSourceInformationStrategy(); | 455 if (!generateSourceMap) return const JavaScriptSourceInformationStrategy(); |
| 460 if (useMultiSourceInfo) { | 456 if (useMultiSourceInfo) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 481 bool useStartupEmitter: false, | 477 bool useStartupEmitter: false, |
| 482 bool useMultiSourceInfo: false, | 478 bool useMultiSourceInfo: false, |
| 483 bool useNewSourceInfo: false, | 479 bool useNewSourceInfo: false, |
| 484 bool useKernel: false}) | 480 bool useKernel: false}) |
| 485 : _rti = new _RuntimeTypes(compiler), | 481 : _rti = new _RuntimeTypes(compiler), |
| 486 annotations = new Annotations(compiler), | 482 annotations = new Annotations(compiler), |
| 487 this.sourceInformationStrategy = createSourceInformationStrategy( | 483 this.sourceInformationStrategy = createSourceInformationStrategy( |
| 488 generateSourceMap: generateSourceMap, | 484 generateSourceMap: generateSourceMap, |
| 489 useMultiSourceInfo: useMultiSourceInfo, | 485 useMultiSourceInfo: useMultiSourceInfo, |
| 490 useNewSourceInfo: useNewSourceInfo), | 486 useNewSourceInfo: useNewSourceInfo), |
| 491 frontend = new JSFrontendAccess(compiler), | |
| 492 constantCompilerTask = new JavaScriptConstantTask(compiler), | 487 constantCompilerTask = new JavaScriptConstantTask(compiler), |
| 493 _nativeDataResolver = new NativeDataResolverImpl(compiler) { | 488 _nativeDataResolver = new NativeDataResolverImpl(compiler) { |
| 494 _target = new JavaScriptBackendTarget(this); | 489 _target = new JavaScriptBackendTarget(this); |
| 495 impacts = new BackendImpacts(compiler.options, commonElements); | 490 impacts = new BackendImpacts(compiler.options, commonElements); |
| 496 _mirrorsData = new MirrorsDataImpl( | 491 _mirrorsData = new MirrorsDataImpl( |
| 497 compiler, compiler.options, commonElements, constants); | 492 compiler, compiler.options, commonElements, constants); |
| 498 _backendUsageBuilder = new BackendUsageBuilderImpl(commonElements); | 493 _backendUsageBuilder = new BackendUsageBuilderImpl(commonElements); |
| 499 _checkedModeHelpers = new CheckedModeHelpers(commonElements); | 494 _checkedModeHelpers = new CheckedModeHelpers(commonElements); |
| 500 emitter = | 495 emitter = |
| 501 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter); | 496 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter); |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 bool supportSerialization: true}) { | 1337 bool supportSerialization: true}) { |
| 1343 return new JavaScriptImpactStrategy(resolution, compiler.dumpInfoTask, | 1338 return new JavaScriptImpactStrategy(resolution, compiler.dumpInfoTask, |
| 1344 supportDeferredLoad: supportDeferredLoad, | 1339 supportDeferredLoad: supportDeferredLoad, |
| 1345 supportDumpInfo: supportDumpInfo, | 1340 supportDumpInfo: supportDumpInfo, |
| 1346 supportSerialization: supportSerialization); | 1341 supportSerialization: supportSerialization); |
| 1347 } | 1342 } |
| 1348 | 1343 |
| 1349 EnqueueTask makeEnqueuer() => new EnqueueTask(compiler); | 1344 EnqueueTask makeEnqueuer() => new EnqueueTask(compiler); |
| 1350 } | 1345 } |
| 1351 | 1346 |
| 1352 class JSFrontendAccess implements Frontend { | |
| 1353 final Compiler compiler; | |
| 1354 | |
| 1355 JSFrontendAccess(this.compiler); | |
| 1356 | |
| 1357 Resolution get resolution => compiler.resolution; | |
| 1358 | |
| 1359 @override | |
| 1360 ResolutionImpact getResolutionImpact(Element element) { | |
| 1361 return resolution.getResolutionImpact(element); | |
| 1362 } | |
| 1363 } | |
| 1364 | |
| 1365 class JavaScriptImpactStrategy extends ImpactStrategy { | 1347 class JavaScriptImpactStrategy extends ImpactStrategy { |
| 1366 final Resolution resolution; | 1348 final Resolution resolution; |
| 1367 final DumpInfoTask dumpInfoTask; | 1349 final DumpInfoTask dumpInfoTask; |
| 1368 final bool supportDeferredLoad; | 1350 final bool supportDeferredLoad; |
| 1369 final bool supportDumpInfo; | 1351 final bool supportDumpInfo; |
| 1370 final bool supportSerialization; | 1352 final bool supportSerialization; |
| 1371 | 1353 |
| 1372 JavaScriptImpactStrategy(this.resolution, this.dumpInfoTask, | 1354 JavaScriptImpactStrategy(this.resolution, this.dumpInfoTask, |
| 1373 {this.supportDeferredLoad, | 1355 {this.supportDeferredLoad, |
| 1374 this.supportDumpInfo, | 1356 this.supportDumpInfo, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 | 1451 |
| 1470 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { | 1452 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { |
| 1471 return !selector.isGetter; | 1453 return !selector.isGetter; |
| 1472 } | 1454 } |
| 1473 | 1455 |
| 1474 /// Returns `true` if [member] is called from a subclass via `super`. | 1456 /// Returns `true` if [member] is called from a subclass via `super`. |
| 1475 bool isAliasedSuperMember(MemberEntity member) { | 1457 bool isAliasedSuperMember(MemberEntity member) { |
| 1476 return _aliasedSuperMembers.contains(member); | 1458 return _aliasedSuperMembers.contains(member); |
| 1477 } | 1459 } |
| 1478 } | 1460 } |
| OLD | NEW |