| 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 CodegenWorkItem; | 10 import '../common/codegen.dart' show CodegenWorkItem; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 import '../elements/names.dart'; | 23 import '../elements/names.dart'; |
| 24 import '../elements/resolution_types.dart'; | 24 import '../elements/resolution_types.dart'; |
| 25 import '../enqueue.dart' | 25 import '../enqueue.dart' |
| 26 show | 26 show |
| 27 DirectEnqueuerStrategy, | 27 DirectEnqueuerStrategy, |
| 28 Enqueuer, | 28 Enqueuer, |
| 29 EnqueueTask, | 29 EnqueueTask, |
| 30 ResolutionEnqueuer, | 30 ResolutionEnqueuer, |
| 31 TreeShakingEnqueuerStrategy; | 31 TreeShakingEnqueuerStrategy; |
| 32 import '../frontend_strategy.dart'; | 32 import '../frontend_strategy.dart'; |
| 33 import '../io/multi_information.dart' show MultiSourceInformationStrategy; | |
| 34 import '../io/position_information.dart' show PositionSourceInformationStrategy; | |
| 35 import '../io/source_information.dart' show SourceInformationStrategy; | 33 import '../io/source_information.dart' show SourceInformationStrategy; |
| 36 import '../io/start_end_information.dart' | |
| 37 show StartEndSourceInformationStrategy; | |
| 38 import '../js/js.dart' as jsAst; | 34 import '../js/js.dart' as jsAst; |
| 39 import '../js/js.dart' show js; | 35 import '../js/js.dart' show js; |
| 40 import '../js/js_source_mapping.dart' show JavaScriptSourceInformationStrategy; | |
| 41 import '../js/rewrite_async.dart'; | 36 import '../js/rewrite_async.dart'; |
| 42 import '../js_emitter/js_emitter.dart' show CodeEmitterTask; | 37 import '../js_emitter/js_emitter.dart' show CodeEmitterTask; |
| 43 import '../kernel/task.dart'; | 38 import '../kernel/task.dart'; |
| 44 import '../library_loader.dart' show LoadedLibraries; | 39 import '../library_loader.dart' show LoadedLibraries; |
| 45 import '../native/native.dart' as native; | 40 import '../native/native.dart' as native; |
| 46 import '../native/resolver.dart'; | 41 import '../native/resolver.dart'; |
| 47 import '../ssa/ssa.dart' show SsaFunctionCompiler; | 42 import '../ssa/ssa.dart' show SsaFunctionCompiler; |
| 48 import '../tracer.dart'; | 43 import '../tracer.dart'; |
| 49 import '../tree/tree.dart'; | 44 import '../tree/tree.dart'; |
| 50 import '../types/types.dart'; | 45 import '../types/types.dart'; |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 | 442 |
| 448 native.NativeResolutionEnqueuer _nativeResolutionEnqueuer; | 443 native.NativeResolutionEnqueuer _nativeResolutionEnqueuer; |
| 449 native.NativeCodegenEnqueuer _nativeCodegenEnqueuer; | 444 native.NativeCodegenEnqueuer _nativeCodegenEnqueuer; |
| 450 | 445 |
| 451 BackendImpacts impacts; | 446 BackendImpacts impacts; |
| 452 | 447 |
| 453 Target _target; | 448 Target _target; |
| 454 | 449 |
| 455 Tracer tracer; | 450 Tracer tracer; |
| 456 | 451 |
| 457 static SourceInformationStrategy createSourceInformationStrategy( | |
| 458 {bool generateSourceMap: false, | |
| 459 bool useMultiSourceInfo: false, | |
| 460 bool useNewSourceInfo: false}) { | |
| 461 if (!generateSourceMap) return const JavaScriptSourceInformationStrategy(); | |
| 462 if (useMultiSourceInfo) { | |
| 463 if (useNewSourceInfo) { | |
| 464 return const MultiSourceInformationStrategy(const [ | |
| 465 const PositionSourceInformationStrategy(), | |
| 466 const StartEndSourceInformationStrategy() | |
| 467 ]); | |
| 468 } else { | |
| 469 return const MultiSourceInformationStrategy(const [ | |
| 470 const StartEndSourceInformationStrategy(), | |
| 471 const PositionSourceInformationStrategy() | |
| 472 ]); | |
| 473 } | |
| 474 } else if (useNewSourceInfo) { | |
| 475 return const PositionSourceInformationStrategy(); | |
| 476 } else { | |
| 477 return const StartEndSourceInformationStrategy(); | |
| 478 } | |
| 479 } | |
| 480 | |
| 481 JavaScriptBackend(this.compiler, | 452 JavaScriptBackend(this.compiler, |
| 482 {bool generateSourceMap: true, | 453 {bool generateSourceMap: true, |
| 483 bool useStartupEmitter: false, | 454 bool useStartupEmitter: false, |
| 484 bool useMultiSourceInfo: false, | 455 bool useMultiSourceInfo: false, |
| 485 bool useNewSourceInfo: false, | 456 bool useNewSourceInfo: false, |
| 486 bool useKernel: false}) | 457 bool useKernel: false}) |
| 487 : _rti = new RuntimeTypesImpl( | 458 : _rti = new RuntimeTypesImpl( |
| 488 compiler.elementEnvironment, compiler.frontEndStrategy.dartTypes), | 459 compiler.elementEnvironment, compiler.frontEndStrategy.dartTypes), |
| 489 optimizerHints = new OptimizerHintsForTests( | 460 optimizerHints = new OptimizerHintsForTests( |
| 490 compiler.elementEnvironment, compiler.commonElements), | 461 compiler.elementEnvironment, compiler.commonElements), |
| 491 this.sourceInformationStrategy = createSourceInformationStrategy( | 462 this.sourceInformationStrategy = |
| 492 generateSourceMap: generateSourceMap, | 463 compiler.backendStrategy.sourceInformationStrategy, |
| 493 useMultiSourceInfo: useMultiSourceInfo, | |
| 494 useNewSourceInfo: useNewSourceInfo), | |
| 495 constantCompilerTask = new JavaScriptConstantTask(compiler), | 464 constantCompilerTask = new JavaScriptConstantTask(compiler), |
| 496 _nativeDataResolver = new NativeDataResolverImpl(compiler), | 465 _nativeDataResolver = new NativeDataResolverImpl(compiler), |
| 497 _rtiNeedBuilder = | 466 _rtiNeedBuilder = |
| 498 compiler.frontEndStrategy.createRuntimeTypesNeedBuilder() { | 467 compiler.frontEndStrategy.createRuntimeTypesNeedBuilder() { |
| 499 _target = new JavaScriptBackendTarget(this); | 468 _target = new JavaScriptBackendTarget(this); |
| 500 impacts = new BackendImpacts(compiler.options, commonElements); | 469 impacts = new BackendImpacts(compiler.options, commonElements); |
| 501 _mirrorsData = compiler.frontEndStrategy.createMirrorsDataBuilder(); | 470 _mirrorsData = compiler.frontEndStrategy.createMirrorsDataBuilder(); |
| 502 _backendUsageBuilder = new BackendUsageBuilderImpl(commonElements); | 471 _backendUsageBuilder = new BackendUsageBuilderImpl(commonElements); |
| 503 _checkedModeHelpers = new CheckedModeHelpers(commonElements); | 472 _checkedModeHelpers = new CheckedModeHelpers(commonElements); |
| 504 emitter = | 473 emitter = |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 | 1365 |
| 1397 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { | 1366 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { |
| 1398 return !selector.isGetter; | 1367 return !selector.isGetter; |
| 1399 } | 1368 } |
| 1400 | 1369 |
| 1401 /// Returns `true` if [member] is called from a subclass via `super`. | 1370 /// Returns `true` if [member] is called from a subclass via `super`. |
| 1402 bool isAliasedSuperMember(MemberEntity member) { | 1371 bool isAliasedSuperMember(MemberEntity member) { |
| 1403 return _aliasedSuperMembers.contains(member); | 1372 return _aliasedSuperMembers.contains(member); |
| 1404 } | 1373 } |
| 1405 } | 1374 } |
| OLD | NEW |