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

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

Issue 2930973002: Remove ClassHierarchy factory constructor. (Closed)
Patch Set: 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_bench.dart ('k') | pkg/kernel/test/type_subtype_test.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 21 matching lines...) Expand all
32 } 32 }
33 ArgResults options = argParser.parse(args); 33 ArgResults options = argParser.parse(args);
34 if (options.rest.length != 1) { 34 if (options.rest.length != 1) {
35 print('Exactly one file should be given'); 35 print('Exactly one file should be given');
36 exit(1); 36 exit(1);
37 } 37 }
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 ClosedWorldClassHierarchy(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(coreTypes, hierarchy, program, 48 return new TreeShaker(coreTypes, hierarchy, program,
49 strongMode: strongMode); 49 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(coreTypes.objectClass); 62 treeShaker.getClassRetention(coreTypes.objectClass);
63 } 63 }
64 } 64 }
65 } 65 }
OLDNEW
« no previous file with comments | « pkg/kernel/test/treeshaker_bench.dart ('k') | pkg/kernel/test/type_subtype_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698