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

Side by Side Diff: pkg/kernel/test/treeshaker_membench.dart

Issue 2904203003: Don't recreate CoreTypes in transformers. Pass it in. (Closed)
Patch Set: Don't create CoreTypes in createOutlines() on InputError. Created 3 years, 6 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 | « pkg/kernel/test/treeshaker_dump.dart ('k') | pkg/kernel/tool/dartk.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 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 library kernel.treeshaker_membench; 5 library kernel.treeshaker_membench;
6 6
7 import 'package:kernel/kernel.dart'; 7 import 'package:kernel/kernel.dart';
8 import 'package:kernel/transformations/treeshaker.dart'; 8 import 'package:kernel/transformations/treeshaker.dart';
9 import 'package:kernel/class_hierarchy.dart'; 9 import 'package:kernel/class_hierarchy.dart';
10 import 'package:kernel/core_types.dart'; 10 import 'package:kernel/core_types.dart';
(...skipping 27 matching lines...) Expand all
38 String filename = options.rest.single; 38 String filename = options.rest.single;
39 bool strongMode = options['strong']; 39 bool strongMode = options['strong'];
40 40
41 Program program = loadProgramFromBinary(filename); 41 Program program = loadProgramFromBinary(filename);
42 ClassHierarchy hierarchy = new ClassHierarchy(program); 42 ClassHierarchy hierarchy = new ClassHierarchy(program);
43 CoreTypes coreTypes = new CoreTypes(program); 43 CoreTypes coreTypes = new CoreTypes(program);
44 44
45 int copyCount = int.parse(options['count']); 45 int copyCount = int.parse(options['count']);
46 46
47 TreeShaker buildTreeShaker() { 47 TreeShaker buildTreeShaker() {
48 return new TreeShaker(program, 48 return new TreeShaker(coreTypes, program,
49 hierarchy: hierarchy, coreTypes: coreTypes, strongMode: strongMode); 49 hierarchy: hierarchy, strongMode: strongMode);
50 } 50 }
51 51
52 List<TreeShaker> keepAlive = <TreeShaker>[]; 52 List<TreeShaker> keepAlive = <TreeShaker>[];
53 for (int i = 0; i < copyCount; ++i) { 53 for (int i = 0; i < copyCount; ++i) {
54 keepAlive.add(buildTreeShaker()); 54 keepAlive.add(buildTreeShaker());
55 } 55 }
56 56
57 print('$copyCount copies built'); 57 print('$copyCount copies built');
58 58
59 if (args.contains('-v')) { 59 if (args.contains('-v')) {
60 // Use of the list for something to avoid premature GC. 60 // Use of the list for something to avoid premature GC.
61 for (var treeShaker in keepAlive) { 61 for (var treeShaker in keepAlive) {
62 treeShaker.getClassRetention(hierarchy.rootClass); 62 treeShaker.getClassRetention(hierarchy.rootClass);
63 } 63 }
64 } 64 }
65 } 65 }
OLDNEW
« no previous file with comments | « pkg/kernel/test/treeshaker_dump.dart ('k') | pkg/kernel/tool/dartk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698