Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Side by Side Diff: pkg/kernel/lib/target/vm.dart

Issue 2671653003: Split the Kernel transformations into modular and global ones (Closed)
Patch Set: Revert inadvertent change Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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' show ClassHierarchy;
7 import '../core_types.dart'; 8 import '../core_types.dart';
8 import '../transformations/continuation.dart' as cont; 9 import '../transformations/continuation.dart' as cont;
9 import '../transformations/erasure.dart'; 10 import '../transformations/erasure.dart';
10 import '../transformations/insert_covariance_checks.dart'; 11 import '../transformations/insert_covariance_checks.dart';
11 import '../transformations/insert_type_checks.dart'; 12 import '../transformations/insert_type_checks.dart';
12 import '../transformations/mixin_full_resolution.dart' as mix; 13 import '../transformations/mixin_full_resolution.dart' as mix;
13 import '../transformations/sanitize_for_vm.dart'; 14 import '../transformations/sanitize_for_vm.dart';
14 import '../transformations/setup_builtin_library.dart' as setup_builtin_library; 15 import '../transformations/setup_builtin_library.dart' as setup_builtin_library;
15 import '../transformations/treeshaker.dart'; 16 import '../transformations/treeshaker.dart';
16 import 'targets.dart'; 17 import 'targets.dart';
(...skipping 30 matching lines...) Expand all
47 48
48 'dart:profiler', 49 'dart:profiler',
49 'dart:typed_data', 50 'dart:typed_data',
50 'dart:vmservice_io', 51 'dart:vmservice_io',
51 'dart:_vmservice', 52 'dart:_vmservice',
52 'dart:_builtin', 53 'dart:_builtin',
53 'dart:nativewrappers', 54 'dart:nativewrappers',
54 'dart:io', 55 'dart:io',
55 ]; 56 ];
56 57
57 void transformProgram(Program program) { 58 ClassHierarchy _hierarchy;
59
60 void performModularTransformations(Program program) {
58 var mixins = new mix.MixinFullResolution(); 61 var mixins = new mix.MixinFullResolution();
59 mixins.transform(program); 62 mixins.transform(program);
60 63
61 var hierarchy = mixins.hierarchy; 64 _hierarchy = mixins.hierarchy;
65 }
66
67 void performGlobalTransformations(Program program) {
62 var coreTypes = new CoreTypes(program); 68 var coreTypes = new CoreTypes(program);
63 69
64 if (strongMode) { 70 if (strongMode) {
65 new InsertTypeChecks(hierarchy: hierarchy, coreTypes: coreTypes) 71 new InsertTypeChecks(hierarchy: _hierarchy, coreTypes: coreTypes)
66 .transformProgram(program); 72 .transformProgram(program);
67 new InsertCovarianceChecks(hierarchy: hierarchy, coreTypes: coreTypes) 73 new InsertCovarianceChecks(hierarchy: _hierarchy, coreTypes: coreTypes)
68 .transformProgram(program); 74 .transformProgram(program);
69 } 75 }
70 76
71 if (program.mainMethod != null) { 77 if (program.mainMethod != null) {
72 new TreeShaker(program, 78 new TreeShaker(program,
73 hierarchy: hierarchy, coreTypes: coreTypes, 79 hierarchy: _hierarchy, coreTypes: coreTypes,
74 strongMode: strongMode) 80 strongMode: strongMode)
75 .transform(program); 81 .transform(program);
76 } 82 }
77 83
78 cont.transformProgram(program); 84 cont.transformProgram(program);
79 85
80 // Repair `_getMainClosure()` function in dart:_builtin. 86 // Repair `_getMainClosure()` function in dart:_builtin.
81 setup_builtin_library.transformProgram(program); 87 setup_builtin_library.transformProgram(program);
82 88
83 if (strongMode) { 89 if (strongMode) {
84 new Erasure().transform(program); 90 new Erasure().transform(program);
85 } 91 }
86 92
87 new SanitizeForVM().transform(program); 93 new SanitizeForVM().transform(program);
88 } 94 }
89 } 95 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698