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

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

Issue 2308983002: Revert "Refactor how we read global-type-inference data from ssa" (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 TypedefInfo visitTypedefElement(TypedefElement element, _) { 108 TypedefInfo visitTypedefElement(TypedefElement element, _) {
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 = compiler.globalInference.results.typeOf(element); 118 TypeMask inferredType =
119 compiler.globalInference.getGuaranteedTypeOfElement(element);
119 // 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.
120 if (inferredType == null || inferredType.isEmpty) return null; 121 if (inferredType == null || inferredType.isEmpty) return null;
121 122
122 int size = compiler.dumpInfoTask.sizeOf(element); 123 int size = compiler.dumpInfoTask.sizeOf(element);
123 String code = compiler.dumpInfoTask.codeOf(element); 124 String code = compiler.dumpInfoTask.codeOf(element);
124 if (code != null) size += code.length; 125 if (code != null) size += code.length;
125 126
126 FieldInfo info = new FieldInfo( 127 FieldInfo info = new FieldInfo(
127 name: element.name, 128 name: element.name,
128 // 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
249 isFactory: element.isFactoryConstructor, 250 isFactory: element.isFactoryConstructor,
250 isExternal: element.isPatched); 251 isExternal: element.isPatched);
251 String code = compiler.dumpInfoTask.codeOf(element); 252 String code = compiler.dumpInfoTask.codeOf(element);
252 253
253 List<ParameterInfo> parameters = <ParameterInfo>[]; 254 List<ParameterInfo> parameters = <ParameterInfo>[];
254 if (element.hasFunctionSignature) { 255 if (element.hasFunctionSignature) {
255 FunctionSignature signature = element.functionSignature; 256 FunctionSignature signature = element.functionSignature;
256 signature.forEachParameter((parameter) { 257 signature.forEachParameter((parameter) {
257 parameters.add(new ParameterInfo( 258 parameters.add(new ParameterInfo(
258 parameter.name, 259 parameter.name,
259 '${compiler.globalInference.results.typeOf(parameter)}', 260 '${compiler.globalInference.getGuaranteedTypeOfElement(parameter)}',
260 '${parameter.node.type}')); 261 '${parameter.node.type}'));
261 }); 262 });
262 } 263 }
263 264
264 String returnType = null; 265 String returnType = null;
265 // TODO(sigmund): why all these checks? 266 // TODO(sigmund): why all these checks?
266 if (element.isInstanceMember && 267 if (element.isInstanceMember &&
267 !element.isAbstract && 268 !element.isAbstract &&
268 compiler.world.allFunctions.contains(element)) { 269 compiler.world.allFunctions.contains(element)) {
269 returnType = '${element.type.returnType}'; 270 returnType = '${element.type.returnType}';
270 } 271 }
271 String inferredReturnType = 272 String inferredReturnType =
272 '${compiler.globalInference.results.returnTypeOf(element)}'; 273 '${compiler.globalInference.getGuaranteedReturnTypeOfElement(element)}';
273 String sideEffects = '${compiler.world.getSideEffectsOfElement(element)}'; 274 String sideEffects = '${compiler.world.getSideEffectsOfElement(element)}';
274 275
275 int inlinedCount = compiler.dumpInfoTask.inlineCount[element]; 276 int inlinedCount = compiler.dumpInfoTask.inlineCount[element];
276 if (inlinedCount == null) inlinedCount = 0; 277 if (inlinedCount == null) inlinedCount = 0;
277 278
278 FunctionInfo info = new FunctionInfo( 279 FunctionInfo info = new FunctionInfo(
279 name: name, 280 name: name,
280 functionKind: kind, 281 functionKind: kind,
281 // 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
282 // 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
585 586
586 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 587 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
587 new StringConversionSink.fromStringSink(buffer)); 588 new StringConversionSink.fromStringSink(buffer));
588 sink.add(new AllInfoJsonCodec().encode(result)); 589 sink.add(new AllInfoJsonCodec().encode(result));
589 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 590 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
590 'text': "View the dumped .info.json file at " 591 'text': "View the dumped .info.json file at "
591 "https://dart-lang.github.io/dump-info-visualizer" 592 "https://dart-lang.github.io/dump-info-visualizer"
592 }); 593 });
593 } 594 }
594 } 595 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698