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

Side by Side Diff: lib/src/measurements.dart

Issue 2233093003: make dart2js_info strong-mode clean (Closed) Base URL: git@github.com:dart-lang/dart2js_info.git@master
Patch Set: update version Created 4 years, 4 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 | « lib/src/graph.dart ('k') | pubspec.yaml » ('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) 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 /// Measurements collected about individual functions. Currently we compute 5 /// Measurements collected about individual functions. Currently we compute
6 /// data about "sends", to classify whether we know the target or not. 6 /// data about "sends", to classify whether we know the target or not.
7 library dart2js_info.src.measurements; 7 library dart2js_info.src.measurements;
8 8
9 /// Top-level set of metrics 9 /// Top-level set of metrics
10 const List<Metric> _topLevelMetrics = const [Metric.functions, Metric.send]; 10 const List<Metric> _topLevelMetrics = const [Metric.functions, Metric.send];
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 /// Metyric for calls to more than one possible interceptor, see [send] for 129 /// Metyric for calls to more than one possible interceptor, see [send] for
130 /// details. 130 /// details.
131 static const Metric multiInterceptorSend = const Metric('interceptor multi'); 131 static const Metric multiInterceptorSend = const Metric('interceptor multi');
132 132
133 /// Metyric for dynamic calls for which we know nothing about the target 133 /// Metyric for dynamic calls for which we know nothing about the target
134 /// method. See [send] for details. 134 /// method. See [send] for details.
135 static const Metric dynamicSend = const Metric('dynamic'); 135 static const Metric dynamicSend = const Metric('dynamic');
136 136
137 static Map<String, Metric> _nameToMetricMap = () { 137 static Map<String, Metric> _nameToMetricMap = () {
138 var res = {}; 138 var res = <String, Metric>{};
139 visitAllMetrics((m, _) => res[m.name] = m); 139 visitAllMetrics((m, _) => res[m.name] = m);
140 return res; 140 return res;
141 }(); 141 }();
142 } 142 }
143 143
144 /// A metric that is subdivided in smaller metrics. 144 /// A metric that is subdivided in smaller metrics.
145 class GroupedMetric extends Metric { 145 class GroupedMetric extends Metric {
146 final List<Metric> submetrics; 146 final List<Metric> submetrics;
147 147
148 const GroupedMetric(String name, this.submetrics) : super(name); 148 const GroupedMetric(String name, this.submetrics) : super(name);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 bool checkInvariant(GroupedMetric key) { 212 bool checkInvariant(GroupedMetric key) {
213 int total = counters[key] ?? 0; 213 int total = counters[key] ?? 0;
214 int submetricTotal = 0; 214 int submetricTotal = 0;
215 for (var metric in key.submetrics) { 215 for (var metric in key.submetrics) {
216 var n = counters[metric]; 216 var n = counters[metric];
217 if (n != null) submetricTotal += n; 217 if (n != null) submetricTotal += n;
218 } 218 }
219 return total == submetricTotal; 219 return total == submetricTotal;
220 } 220 }
221 } 221 }
OLDNEW
« no previous file with comments | « lib/src/graph.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698