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

Side by Side Diff: bin/debug_info.dart

Issue 2402473002: Add ClosureInfo for closures. (Closed)
Patch Set: update parse test Created 4 years, 2 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 | lib/info.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) 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 /// Tool used mainly by dart2js developers to debug the generated info and check 5 /// Tool used mainly by dart2js developers to debug the generated info and check
6 /// that it is consistent and that it covers all the data we expect it to cover. 6 /// that it is consistent and that it covers all the data we expect it to cover.
7 library dart2js_info.bin.debug_info; 7 library dart2js_info.bin.debug_info;
8 8
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 int totalLib = info.libraries.fold(0, (n, lib) => n + lib.size); 60 int totalLib = info.libraries.fold(0, (n, lib) => n + lib.size);
61 int constantsSize = info.constants.fold(0, (n, c) => n + c.size); 61 int constantsSize = info.constants.fold(0, (n, c) => n + c.size);
62 int accounted = totalLib + constantsSize; 62 int accounted = totalLib + constantsSize;
63 63
64 if (accounted != realTotal) { 64 if (accounted != realTotal) {
65 var percent = 65 var percent =
66 ((realTotal - accounted) * 100 / realTotal).toStringAsFixed(2); 66 ((realTotal - accounted) * 100 / realTotal).toStringAsFixed(2);
67 _fail('$percent% size missing: $accounted (all libs + consts) ' 67 _fail('$percent% size missing: $accounted (all libs + consts) '
68 '< $realTotal (total)'); 68 '< $realTotal (total)');
69 } 69 }
70 var missingTotal = tracker.missing.values.fold(0, (a, b) => a + b); 70 int missingTotal = tracker.missing.values.fold(0, (a, b) => a + b);
71 if (missingTotal > 0) { 71 if (missingTotal > 0) {
72 var percent = (missingTotal * 100 / realTotal).toStringAsFixed(2); 72 var percent = (missingTotal * 100 / realTotal).toStringAsFixed(2);
73 _fail('$percent% size missing in libraries (sum of elements > lib.size)'); 73 _fail('$percent% size missing in libraries (sum of elements > lib.size)');
74 } 74 }
75 } 75 }
76 76
77 class _SizeTracker extends RecursiveInfoVisitor { 77 class _SizeTracker extends RecursiveInfoVisitor {
78 /// A library name for which to print debugging information (if not null). 78 /// A library name for which to print debugging information (if not null).
79 final String _debugLibName; 79 final String _debugLibName;
80 80
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 if (unreachables.isNotEmpty) { 274 if (unreachables.isNotEmpty) {
275 _fail('${unreachables.length} elements are unreachable from the ' 275 _fail('${unreachables.length} elements are unreachable from the '
276 'entrypoint'); 276 'entrypoint');
277 } else { 277 } else {
278 _pass('all elements are reachable from the entrypoint'); 278 _pass('all elements are reachable from the entrypoint');
279 } 279 }
280 } 280 }
281 281
282 _pass(String msg) => print('\x1b[32mPASS\x1b[0m: $msg'); 282 _pass(String msg) => print('\x1b[32mPASS\x1b[0m: $msg');
283 _fail(String msg) => print('\x1b[31mFAIL\x1b[0m: $msg'); 283 _fail(String msg) => print('\x1b[31mFAIL\x1b[0m: $msg');
OLDNEW
« no previous file with comments | « no previous file | lib/info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698