| 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'; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 'dart:typed_data', | 49 'dart:typed_data', |
| 50 'dart:vmservice_io', | 50 'dart:vmservice_io', |
| 51 'dart:_vmservice', | 51 'dart:_vmservice', |
| 52 'dart:_builtin', | 52 'dart:_builtin', |
| 53 'dart:nativewrappers', | 53 'dart:nativewrappers', |
| 54 'dart:io', | 54 'dart:io', |
| 55 ]; | 55 ]; |
| 56 | 56 |
| 57 ClassHierarchy _hierarchy; | 57 ClassHierarchy _hierarchy; |
| 58 | 58 |
| 59 void performModularTransformations(CoreTypes coreTypes, Program program) { | 59 void performModularTransformations( |
| 60 var mixins = new mix.MixinFullResolution(this, coreTypes) | 60 CoreTypes coreTypes, ClassHierarchy hierarchy, Program program) { |
| 61 var mixins = new mix.MixinFullResolution(this, coreTypes, hierarchy) |
| 61 ..transform(program.libraries); | 62 ..transform(program.libraries); |
| 62 | 63 |
| 63 _hierarchy = mixins.hierarchy; | 64 _hierarchy = mixins.hierarchy; |
| 64 } | 65 } |
| 65 | 66 |
| 66 void performGlobalTransformations(CoreTypes coreTypes, Program program) { | 67 void performGlobalTransformations(CoreTypes coreTypes, Program program) { |
| 67 if (strongMode) { | 68 if (strongMode) { |
| 68 new InsertTypeChecks(coreTypes, hierarchy: _hierarchy) | 69 new InsertTypeChecks(coreTypes, _hierarchy).transformProgram(program); |
| 69 .transformProgram(program); | 70 new InsertCovarianceChecks(coreTypes, _hierarchy) |
| 70 new InsertCovarianceChecks(coreTypes, hierarchy: _hierarchy) | |
| 71 .transformProgram(program); | 71 .transformProgram(program); |
| 72 } | 72 } |
| 73 | 73 |
| 74 if (flags.treeShake) { | 74 if (flags.treeShake) { |
| 75 performTreeShaking(coreTypes, program); | 75 performTreeShaking(coreTypes, program); |
| 76 } | 76 } |
| 77 | 77 |
| 78 cont.transformProgram(coreTypes, program); | 78 cont.transformProgram(coreTypes, program); |
| 79 | 79 |
| 80 if (strongMode) { | 80 if (strongMode) { |
| 81 performErasure(program); | 81 performErasure(program); |
| 82 } | 82 } |
| 83 | 83 |
| 84 new SanitizeForVM().transform(program); | 84 new SanitizeForVM().transform(program); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void performTreeShaking(CoreTypes coreTypes, Program program) { | 87 void performTreeShaking(CoreTypes coreTypes, Program program) { |
| 88 new TreeShaker(coreTypes, program, | 88 new TreeShaker(coreTypes, _hierarchy, program, |
| 89 hierarchy: _hierarchy, | 89 strongMode: strongMode, programRoots: flags.programRoots) |
| 90 strongMode: strongMode, | |
| 91 programRoots: flags.programRoots) | |
| 92 .transform(program); | 90 .transform(program); |
| 93 _hierarchy = null; // Hierarchy must be recomputed. | 91 _hierarchy = null; // Hierarchy must be recomputed. |
| 94 } | 92 } |
| 95 | 93 |
| 96 void performErasure(Program program) { | 94 void performErasure(Program program) { |
| 97 new Erasure().transform(program); | 95 new Erasure().transform(program); |
| 98 } | 96 } |
| 99 | 97 |
| 100 @override | 98 @override |
| 101 Expression instantiateInvocation(Member target, Expression receiver, | 99 Expression instantiateInvocation(Member target, Expression receiver, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // this is currently only used in (statically resolved) no-such-method | 152 // this is currently only used in (statically resolved) no-such-method |
| 155 // handling, the current approach seems sufficient. | 153 // handling, the current approach seems sufficient. |
| 156 return new MethodInvocation( | 154 return new MethodInvocation( |
| 157 new ListLiteral(elements)..fileOffset = charOffset, | 155 new ListLiteral(elements)..fileOffset = charOffset, |
| 158 new Name("toList"), | 156 new Name("toList"), |
| 159 new Arguments(<Expression>[], named: <NamedExpression>[ | 157 new Arguments(<Expression>[], named: <NamedExpression>[ |
| 160 new NamedExpression("growable", new BoolLiteral(false)) | 158 new NamedExpression("growable", new BoolLiteral(false)) |
| 161 ])); | 159 ])); |
| 162 } | 160 } |
| 163 } | 161 } |
| OLD | NEW |