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

Side by Side Diff: bin/debug_info.dart

Issue 1300513005: Add constant info to the dart2js_info model (Closed) Base URL: git@github.com:dart-lang/dart2js_info.git@master
Patch Set: Created 5 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 | « README.md ('k') | bin/library_size_split.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:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 if (diff2.length > 0) { 47 if (diff2.length > 0) {
48 _fail("some elements found in libraries weren't part of the global list" 48 _fail("some elements found in libraries weren't part of the global list"
49 " (non-zero ${diff2.where((f) => f.size > 0).length})"); 49 " (non-zero ${diff2.where((f) => f.size > 0).length})");
50 } 50 }
51 } 51 }
52 52
53 // Validate that code-size adds up. 53 // Validate that code-size adds up.
54 int realTotal = info.program.size; 54 int realTotal = info.program.size;
55 int totalLib = info.libraries.fold(0, (n, lib) => n + lib.size); 55 int totalLib = info.libraries.fold(0, (n, lib) => n + lib.size);
56 if (totalLib != realTotal) { 56 int constantsSize = info.constants.fold(0, (n, c) => n + c.size);
57 var percent = ((realTotal - totalLib) * 100 / realTotal).toStringAsFixed(2); 57 int accounted = totalLib + constantsSize;
58 _fail('$percent% size missing (sum of all libs < total)'); 58
59 if (accounted != realTotal) {
60 var percent = ((realTotal - accounted) * 100 / realTotal)
61 .toStringAsFixed(2);
62 _fail('$percent% size missing: $accounted (all libs + consts) '
63 '< $realTotal (total)');
59 } 64 }
60 var missingTotal = tracker.missing.values.fold(0, (a, b) => a + b); 65 var missingTotal = tracker.missing.values.fold(0, (a, b) => a + b);
61 if (missingTotal > 0) { 66 if (missingTotal > 0) {
62 var percent = (missingTotal * 100 / realTotal).toStringAsFixed(2); 67 var percent = (missingTotal * 100 / realTotal).toStringAsFixed(2);
63 _fail('$percent% size missing in libraries (sum of elements > lib.size)'); 68 _fail('$percent% size missing in libraries (sum of elements > lib.size)');
64 } 69 }
65 70
66 // Validate dependency data. 71 // Validate dependency data.
67 compareGraphs(info); 72 compareGraphs(info);
68 } 73 }
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 _pass('dependency data is consistent'); 253 _pass('dependency data is consistent');
249 } else { 254 } else {
250 _fail('inconsistencies in dependency data:\n' 255 _fail('inconsistencies in dependency data:\n'
251 ' $inUsesNotInDependencies edges missing from "dependencies" graph\n' 256 ' $inUsesNotInDependencies edges missing from "dependencies" graph\n'
252 ' $inDependenciesNotInUses edges missing from "uses" graph'); 257 ' $inDependenciesNotInUses edges missing from "uses" graph');
253 } 258 }
254 } 259 }
255 260
256 _pass(String msg) => print('\x1b[32mPASS\x1b[0m: $msg'); 261 _pass(String msg) => print('\x1b[32mPASS\x1b[0m: $msg');
257 _fail(String msg) => print('\x1b[31mFAIL\x1b[0m: $msg'); 262 _fail(String msg) => print('\x1b[31mFAIL\x1b[0m: $msg');
OLDNEW
« no previous file with comments | « README.md ('k') | bin/library_size_split.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698