| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.target.vm; | 4 library kernel.target.vm; |
| 5 | 5 |
| 6 import '../ast.dart'; | 6 import '../ast.dart'; |
| 7 import '../class_hierarchy.dart'; | 7 import '../class_hierarchy.dart'; |
| 8 import '../core_types.dart'; | 8 import '../core_types.dart'; |
| 9 import '../transformations/continuation.dart' as cont; | 9 import '../transformations/continuation.dart' as cont; |
| 10 import '../transformations/erasure.dart'; | 10 import '../transformations/erasure.dart'; |
| 11 import '../transformations/insert_covariance_checks.dart'; | 11 import '../transformations/insert_covariance_checks.dart'; |
| 12 import '../transformations/insert_type_checks.dart'; | 12 import '../transformations/insert_type_checks.dart'; |
| 13 import '../transformations/mixin_full_resolution.dart' as mix; | 13 import '../transformations/mixin_full_resolution.dart' as mix; |
| 14 import '../transformations/sanitize_for_vm.dart'; | 14 import '../transformations/sanitize_for_vm.dart'; |
| 15 import '../transformations/setup_builtin_library.dart' as setup_builtin_library; | |
| 16 import '../transformations/treeshaker.dart'; | 15 import '../transformations/treeshaker.dart'; |
| 17 import 'targets.dart'; | 16 import 'targets.dart'; |
| 18 | 17 |
| 19 /// Specializes the kernel IR to the Dart VM. | 18 /// Specializes the kernel IR to the Dart VM. |
| 20 class VmTarget extends Target { | 19 class VmTarget extends Target { |
| 21 final TargetFlags flags; | 20 final TargetFlags flags; |
| 22 | 21 |
| 23 VmTarget(this.flags); | 22 VmTarget(this.flags); |
| 24 | 23 |
| 25 bool get strongMode => flags.strongMode; | 24 bool get strongMode => flags.strongMode; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 new InsertCovarianceChecks(hierarchy: _hierarchy, coreTypes: coreTypes) | 71 new InsertCovarianceChecks(hierarchy: _hierarchy, coreTypes: coreTypes) |
| 73 .transformProgram(program); | 72 .transformProgram(program); |
| 74 } | 73 } |
| 75 | 74 |
| 76 if (flags.treeShake) { | 75 if (flags.treeShake) { |
| 77 performTreeShaking(program); | 76 performTreeShaking(program); |
| 78 } | 77 } |
| 79 | 78 |
| 80 cont.transformProgram(program); | 79 cont.transformProgram(program); |
| 81 | 80 |
| 82 // Repair `_getMainClosure()` function in dart:_builtin. | |
| 83 setup_builtin_library.transformProgram(program); | |
| 84 | |
| 85 if (strongMode) { | 81 if (strongMode) { |
| 86 performErasure(program); | 82 performErasure(program); |
| 87 } | 83 } |
| 88 | 84 |
| 89 new SanitizeForVM().transform(program); | 85 new SanitizeForVM().transform(program); |
| 90 } | 86 } |
| 91 | 87 |
| 92 void performTreeShaking(Program program) { | 88 void performTreeShaking(Program program) { |
| 93 var coreTypes = new CoreTypes(program); | 89 var coreTypes = new CoreTypes(program); |
| 94 new TreeShaker(program, | 90 new TreeShaker(program, |
| 95 hierarchy: _hierarchy, | 91 hierarchy: _hierarchy, |
| 96 coreTypes: coreTypes, | 92 coreTypes: coreTypes, |
| 97 strongMode: strongMode, | 93 strongMode: strongMode, |
| 98 programRoots: flags.programRoots) | 94 programRoots: flags.programRoots) |
| 99 .transform(program); | 95 .transform(program); |
| 100 _hierarchy = null; // Hierarchy must be recomputed. | 96 _hierarchy = null; // Hierarchy must be recomputed. |
| 101 } | 97 } |
| 102 | 98 |
| 103 void performErasure(Program program) { | 99 void performErasure(Program program) { |
| 104 new Erasure().transform(program); | 100 new Erasure().transform(program); |
| 105 } | 101 } |
| 106 } | 102 } |
| OLD | NEW |