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

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

Issue 2904203003: Don't recreate CoreTypes in transformers. Pass it in. (Closed)
Patch Set: Created 3 years, 7 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'; 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
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(Program program) { 59 void performModularTransformations(CoreTypes coreTypes, Program program) {
60 var mixins = new mix.MixinFullResolution(this)..transform(program); 60 var mixins = new mix.MixinFullResolution(this, coreTypes)
61 ..transform(program);
61 62
62 _hierarchy = mixins.hierarchy; 63 _hierarchy = mixins.hierarchy;
63 } 64 }
64 65
65 void performGlobalTransformations(Program program) { 66 void performGlobalTransformations(CoreTypes coreTypes, Program program) {
66 var coreTypes = new CoreTypes(program);
67
68 if (strongMode) { 67 if (strongMode) {
69 new InsertTypeChecks(hierarchy: _hierarchy, coreTypes: coreTypes) 68 new InsertTypeChecks(coreTypes, hierarchy: _hierarchy)
70 .transformProgram(program); 69 .transformProgram(program);
71 new InsertCovarianceChecks(hierarchy: _hierarchy, coreTypes: coreTypes) 70 new InsertCovarianceChecks(coreTypes, hierarchy: _hierarchy)
72 .transformProgram(program); 71 .transformProgram(program);
73 } 72 }
74 73
75 if (flags.treeShake) { 74 if (flags.treeShake) {
76 performTreeShaking(program); 75 performTreeShaking(coreTypes, program);
77 } 76 }
78 77
79 cont.transformProgram(program); 78 cont.transformProgram(coreTypes, program);
80 79
81 if (strongMode) { 80 if (strongMode) {
82 performErasure(program); 81 performErasure(program);
83 } 82 }
84 83
85 new SanitizeForVM().transform(program); 84 new SanitizeForVM().transform(program);
86 } 85 }
87 86
88 void performTreeShaking(Program program) { 87 void performTreeShaking(CoreTypes coreTypes, Program program) {
89 var coreTypes = new CoreTypes(program); 88 new TreeShaker(coreTypes, program,
90 new TreeShaker(program,
91 hierarchy: _hierarchy, 89 hierarchy: _hierarchy,
92 coreTypes: coreTypes,
93 strongMode: strongMode, 90 strongMode: strongMode,
94 programRoots: flags.programRoots) 91 programRoots: flags.programRoots)
95 .transform(program); 92 .transform(program);
96 _hierarchy = null; // Hierarchy must be recomputed. 93 _hierarchy = null; // Hierarchy must be recomputed.
97 } 94 }
98 95
99 void performErasure(Program program) { 96 void performErasure(Program program) {
100 new Erasure().transform(program); 97 new Erasure().transform(program);
101 } 98 }
102 99
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // this is currently only used in (statically resolved) no-such-method 154 // this is currently only used in (statically resolved) no-such-method
158 // handling, the current approach seems sufficient. 155 // handling, the current approach seems sufficient.
159 return new MethodInvocation( 156 return new MethodInvocation(
160 new ListLiteral(elements)..fileOffset = charOffset, 157 new ListLiteral(elements)..fileOffset = charOffset,
161 new Name("toList"), 158 new Name("toList"),
162 new Arguments(<Expression>[], named: <NamedExpression>[ 159 new Arguments(<Expression>[], named: <NamedExpression>[
163 new NamedExpression("growable", new BoolLiteral(false)) 160 new NamedExpression("growable", new BoolLiteral(false))
164 ])); 161 ]));
165 } 162 }
166 } 163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698