| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.impact_transformer; | 5 library js_backend.backend.impact_transformer; |
| 6 | 6 |
| 7 import '../closure.dart'; |
| 7 import '../common.dart'; | 8 import '../common.dart'; |
| 8 import '../common_elements.dart'; | 9 import '../common_elements.dart'; |
| 9 import '../common/backend_api.dart' show ImpactTransformer; | 10 import '../common/backend_api.dart' show ImpactTransformer; |
| 10 import '../common/codegen.dart' show CodegenImpact; | 11 import '../common/codegen.dart' show CodegenImpact; |
| 11 import '../common/resolution.dart' show ResolutionImpact; | 12 import '../common/resolution.dart' show ResolutionImpact; |
| 13 import '../common_elements.dart' show ElementEnvironment; |
| 12 import '../constants/expressions.dart'; | 14 import '../constants/expressions.dart'; |
| 13 import '../common_elements.dart' show ElementEnvironment; | |
| 14 import '../elements/entities.dart'; | 15 import '../elements/entities.dart'; |
| 15 import '../elements/types.dart'; | 16 import '../elements/types.dart'; |
| 16 import '../native/enqueue.dart'; | 17 import '../native/enqueue.dart'; |
| 17 import '../native/native.dart' as native; | 18 import '../native/native.dart' as native; |
| 18 import '../options.dart'; | 19 import '../options.dart'; |
| 19 import '../universe/feature.dart'; | 20 import '../universe/feature.dart'; |
| 20 import '../universe/use.dart' | 21 import '../universe/use.dart' |
| 21 show StaticUse, StaticUseKind, TypeUse, TypeUseKind; | 22 show StaticUse, StaticUseKind, TypeUse, TypeUseKind; |
| 22 import '../universe/world_impact.dart' show TransformedWorldImpact, WorldImpact; | 23 import '../universe/world_impact.dart' show TransformedWorldImpact, WorldImpact; |
| 23 import '../util/util.dart'; | 24 import '../util/util.dart'; |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 421 } |
| 421 | 422 |
| 422 for (Pair<DartType, DartType> check | 423 for (Pair<DartType, DartType> check |
| 423 in impact.typeVariableBoundsSubtypeChecks) { | 424 in impact.typeVariableBoundsSubtypeChecks) { |
| 424 _rtiChecksBuilder.registerTypeVariableBoundsSubtypeCheck( | 425 _rtiChecksBuilder.registerTypeVariableBoundsSubtypeCheck( |
| 425 check.a, check.b); | 426 check.a, check.b); |
| 426 } | 427 } |
| 427 | 428 |
| 428 for (StaticUse staticUse in impact.staticUses) { | 429 for (StaticUse staticUse in impact.staticUses) { |
| 429 switch (staticUse.kind) { | 430 switch (staticUse.kind) { |
| 430 case StaticUseKind.CLOSURE: | 431 case StaticUseKind.CALL_METHOD: |
| 431 Local closure = staticUse.element; | 432 FunctionEntity callMethod = staticUse.element; |
| 432 if (_rtiNeed.localFunctionNeedsRti(closure)) { | 433 // TODO(johnniwinther): Remove [localFunctionNeedsRti] and use |
| 434 // the call method instead. |
| 435 if (_rtiNeed.methodNeedsRti(callMethod)) { |
| 433 _impacts.computeSignature | 436 _impacts.computeSignature |
| 434 .registerImpact(transformed, _elementEnvironment); | 437 .registerImpact(transformed, _elementEnvironment); |
| 438 } else if (callMethod is SynthesizedCallMethodElementX) { |
| 439 if (_rtiNeed.localFunctionNeedsRti(callMethod.expression)) { |
| 440 _impacts.computeSignature |
| 441 .registerImpact(transformed, _elementEnvironment); |
| 442 } |
| 435 } | 443 } |
| 436 break; | 444 break; |
| 437 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: | 445 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: |
| 438 case StaticUseKind.CONSTRUCTOR_INVOKE: | 446 case StaticUseKind.CONSTRUCTOR_INVOKE: |
| 439 _lookupMapAnalysis.registerInstantiatedType(staticUse.type); | 447 _lookupMapAnalysis.registerInstantiatedType(staticUse.type); |
| 440 break; | 448 break; |
| 441 default: | 449 default: |
| 442 } | 450 } |
| 443 } | 451 } |
| 444 | 452 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 470 _impacts.asyncStarBody | 478 _impacts.asyncStarBody |
| 471 .registerImpact(transformed, _elementEnvironment); | 479 .registerImpact(transformed, _elementEnvironment); |
| 472 break; | 480 break; |
| 473 } | 481 } |
| 474 } | 482 } |
| 475 | 483 |
| 476 // TODO(johnniwinther): Remove eager registration. | 484 // TODO(johnniwinther): Remove eager registration. |
| 477 return transformed; | 485 return transformed; |
| 478 } | 486 } |
| 479 } | 487 } |
| OLD | NEW |