| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Computes statistical data about a program. See `stats.dart` for more details | 5 /// Computes statistical data about a program. See `stats.dart` for more details |
| 6 /// on the kind of data we collect. | 6 /// on the kind of data we collect. |
| 7 library compiler.src.stats.stats_builder; | 7 library compiler.src.stats.stats_builder; |
| 8 | 8 |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'package:dart2js_info/src/measurements.dart'; | 10 import 'package:dart2js_info/src/measurements.dart'; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 import 'analysis_result.dart'; | 30 import 'analysis_result.dart'; |
| 31 import 'naive_analysis_result.dart'; | 31 import 'naive_analysis_result.dart'; |
| 32 import 'trusted_types_analysis_result.dart'; | 32 import 'trusted_types_analysis_result.dart'; |
| 33 | 33 |
| 34 /// Collects a set of [Measurements] about send expressions in the function [f]. | 34 /// Collects a set of [Measurements] about send expressions in the function [f]. |
| 35 // TODO(sigmund): collect information on initializers too. | 35 // TODO(sigmund): collect information on initializers too. |
| 36 Measurements collectSendMeasurements(FunctionElement f, Compiler compiler) { | 36 Measurements collectSendMeasurements(FunctionElement f, Compiler compiler) { |
| 37 return compiler.withCurrentElement(f, () { | 37 return compiler.withCurrentElement(f, () { |
| 38 // TODO(sigmund): enable for platform too. | 38 // TODO(sigmund): enable for platform too. |
| 39 if (f.library.isPlatformLibrary) return; | 39 if (f.library.isPlatformLibrary) return null; |
| 40 var name = _qualifiedName(f); | 40 var name = _qualifiedName(f); |
| 41 if (!f.hasNode) { | 41 if (!f.hasNode) { |
| 42 if (f is PartialElement) return const Measurements.unreachableFunction(); | 42 if (f is PartialElement) return const Measurements.unreachableFunction(); |
| 43 assert (f is ConstructorElement && f.isSynthesized); | 43 assert (f is ConstructorElement && f.isSynthesized); |
| 44 // TODO(sigmund): measure synthethic forwarding sends, measure | 44 // TODO(sigmund): measure synthethic forwarding sends, measure |
| 45 // initializers | 45 // initializers |
| 46 return new Measurements.reachableFunction(); | 46 return new Measurements.reachableFunction(); |
| 47 } | 47 } |
| 48 if (!f.hasResolvedAst) { | 48 if (!f.hasResolvedAst) { |
| 49 _debug('no resolved ast ${f.runtimeType}'); | 49 _debug('no resolved ast ${f.runtimeType}'); |
| (...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 @override | 2372 @override |
| 2373 R visitClosureFieldElement(ClosureFieldElement e, A arg) { | 2373 R visitClosureFieldElement(ClosureFieldElement e, A arg) { |
| 2374 return visitVariableElement(e, arg); | 2374 return visitVariableElement(e, arg); |
| 2375 } | 2375 } |
| 2376 } | 2376 } |
| 2377 | 2377 |
| 2378 // TODO(sigmund): get rid of debug messages. | 2378 // TODO(sigmund): get rid of debug messages. |
| 2379 _debug(String message) { | 2379 _debug(String message) { |
| 2380 print('[33mdebug:[0m $message'); | 2380 print('[33mdebug:[0m $message'); |
| 2381 } | 2381 } |
| OLD | NEW |