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

Side by Side Diff: pkg/compiler/lib/src/dump_info.dart

Issue 2278213003: Rename the global inference task and reduce it's API surface by introducing the (Closed)
Patch Set: cl comments Created 4 years, 3 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dump_info; 5 library dump_info;
6 6
7 import 'dart:convert' 7 import 'dart:convert'
8 show ChunkedConversionSink, JsonEncoder, StringConversionSink; 8 show ChunkedConversionSink, JsonEncoder, StringConversionSink;
9 9
10 import 'package:dart2js_info/info.dart'; 10 import 'package:dart2js_info/info.dart';
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 if (!element.isResolved) return null; 109 if (!element.isResolved) return null;
110 TypedefInfo info = new TypedefInfo( 110 TypedefInfo info = new TypedefInfo(
111 element.name, '${element.alias}', _unitInfoForElement(element)); 111 element.name, '${element.alias}', _unitInfoForElement(element));
112 _elementToInfo[element] = info; 112 _elementToInfo[element] = info;
113 result.typedefs.add(info); 113 result.typedefs.add(info);
114 return info; 114 return info;
115 } 115 }
116 116
117 FieldInfo visitFieldElement(FieldElement element, _) { 117 FieldInfo visitFieldElement(FieldElement element, _) {
118 TypeMask inferredType = 118 TypeMask inferredType =
119 compiler.typesTask.getGuaranteedTypeOfElement(element); 119 compiler.globalInference.getGuaranteedTypeOfElement(element);
120 // If a field has an empty inferred type it is never used. 120 // If a field has an empty inferred type it is never used.
121 if (inferredType == null || inferredType.isEmpty) return null; 121 if (inferredType == null || inferredType.isEmpty) return null;
122 122
123 int size = compiler.dumpInfoTask.sizeOf(element); 123 int size = compiler.dumpInfoTask.sizeOf(element);
124 String code = compiler.dumpInfoTask.codeOf(element); 124 String code = compiler.dumpInfoTask.codeOf(element);
125 if (code != null) size += code.length; 125 if (code != null) size += code.length;
126 126
127 FieldInfo info = new FieldInfo( 127 FieldInfo info = new FieldInfo(
128 name: element.name, 128 name: element.name,
129 // We use element.hashCode because it is globally unique and it is 129 // We use element.hashCode because it is globally unique and it is
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 isFactory: element.isFactoryConstructor, 250 isFactory: element.isFactoryConstructor,
251 isExternal: element.isPatched); 251 isExternal: element.isPatched);
252 String code = compiler.dumpInfoTask.codeOf(element); 252 String code = compiler.dumpInfoTask.codeOf(element);
253 253
254 List<ParameterInfo> parameters = <ParameterInfo>[]; 254 List<ParameterInfo> parameters = <ParameterInfo>[];
255 if (element.hasFunctionSignature) { 255 if (element.hasFunctionSignature) {
256 FunctionSignature signature = element.functionSignature; 256 FunctionSignature signature = element.functionSignature;
257 signature.forEachParameter((parameter) { 257 signature.forEachParameter((parameter) {
258 parameters.add(new ParameterInfo( 258 parameters.add(new ParameterInfo(
259 parameter.name, 259 parameter.name,
260 '${compiler.typesTask.getGuaranteedTypeOfElement(parameter)}', 260 '${compiler.globalInference.getGuaranteedTypeOfElement(parameter)}',
261 '${parameter.node.type}')); 261 '${parameter.node.type}'));
262 }); 262 });
263 } 263 }
264 264
265 String returnType = null; 265 String returnType = null;
266 // TODO(sigmund): why all these checks? 266 // TODO(sigmund): why all these checks?
267 if (element.isInstanceMember && 267 if (element.isInstanceMember &&
268 !element.isAbstract && 268 !element.isAbstract &&
269 compiler.world.allFunctions.contains(element)) { 269 compiler.world.allFunctions.contains(element)) {
270 returnType = '${element.type.returnType}'; 270 returnType = '${element.type.returnType}';
271 } 271 }
272 String inferredReturnType = 272 String inferredReturnType =
273 '${compiler.typesTask.getGuaranteedReturnTypeOfElement(element)}'; 273 '${compiler.globalInference.getGuaranteedReturnTypeOfElement(element)}';
274 String sideEffects = '${compiler.world.getSideEffectsOfElement(element)}'; 274 String sideEffects = '${compiler.world.getSideEffectsOfElement(element)}';
275 275
276 int inlinedCount = compiler.dumpInfoTask.inlineCount[element]; 276 int inlinedCount = compiler.dumpInfoTask.inlineCount[element];
277 if (inlinedCount == null) inlinedCount = 0; 277 if (inlinedCount == null) inlinedCount = 0;
278 278
279 FunctionInfo info = new FunctionInfo( 279 FunctionInfo info = new FunctionInfo(
280 name: name, 280 name: name,
281 functionKind: kind, 281 functionKind: kind,
282 // We use element.hashCode because it is globally unique and it is 282 // We use element.hashCode because it is globally unique and it is
283 // available while we are doing codegen. 283 // available while we are doing codegen.
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 586
587 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 587 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
588 new StringConversionSink.fromStringSink(buffer)); 588 new StringConversionSink.fromStringSink(buffer));
589 sink.add(new AllInfoJsonCodec().encode(result)); 589 sink.add(new AllInfoJsonCodec().encode(result));
590 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 590 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
591 'text': "View the dumped .info.json file at " 591 'text': "View the dumped .info.json file at "
592 "https://dart-lang.github.io/dump-info-visualizer" 592 "https://dart-lang.github.io/dump-info-visualizer"
593 }); 593 });
594 } 594 }
595 } 595 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698