OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library type_graph_inferrer; | 5 library type_graph_inferrer; |
6 | 6 |
7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/names.dart' show | 10 import '../common/names.dart' show |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 | 1280 |
1281 List<Element> result = <Element>[]; | 1281 List<Element> result = <Element>[]; |
1282 for (int i = 0; i <= max; i++) { | 1282 for (int i = 0; i <= max; i++) { |
1283 Setlet<Element> set = methodSizes[i]; | 1283 Setlet<Element> set = methodSizes[i]; |
1284 if (set != null) result.addAll(set); | 1284 if (set != null) result.addAll(set); |
1285 } | 1285 } |
1286 return result; | 1286 return result; |
1287 } | 1287 } |
1288 | 1288 |
1289 void clear() { | 1289 void clear() { |
1290 void cleanup(TypeInformation info) => info.cleanup(); | |
1291 | |
1292 allocatedCalls.forEach(cleanup); | |
1293 allocatedCalls.clear(); | 1290 allocatedCalls.clear(); |
1294 | |
1295 defaultTypeOfParameter.clear(); | 1291 defaultTypeOfParameter.clear(); |
1296 | 1292 types.typeInformations.values.forEach((info) => info.clear()); |
1297 types.typeInformations.values.forEach(cleanup); | |
1298 | |
1299 types.allocatedTypes.forEach(cleanup); | |
1300 types.allocatedTypes.clear(); | 1293 types.allocatedTypes.clear(); |
1301 | |
1302 types.concreteTypes.clear(); | 1294 types.concreteTypes.clear(); |
1303 | |
1304 types.allocatedClosures.forEach(cleanup); | |
1305 types.allocatedClosures.clear(); | 1295 types.allocatedClosures.clear(); |
1306 | |
1307 analyzedElements.clear(); | 1296 analyzedElements.clear(); |
1308 generativeConstructorsExposingThis.clear(); | 1297 generativeConstructorsExposingThis.clear(); |
1309 | |
1310 types.allocatedMaps.values.forEach(cleanup); | |
1311 types.allocatedLists.values.forEach(cleanup); | |
1312 } | 1298 } |
1313 | 1299 |
1314 Iterable<Element> getCallersOf(Element element) { | 1300 Iterable<Element> getCallersOf(Element element) { |
1315 if (compiler.disableTypeInference) { | 1301 if (compiler.disableTypeInference) { |
1316 throw new UnsupportedError( | 1302 throw new UnsupportedError( |
1317 "Cannot query the type inferrer when type inference is disabled."); | 1303 "Cannot query the type inferrer when type inference is disabled."); |
1318 } | 1304 } |
1319 MemberTypeInformation info = types.getInferredTypeOf(element); | 1305 MemberTypeInformation info = types.getInferredTypeOf(element); |
1320 return info.callers; | 1306 return info.callers; |
1321 } | 1307 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 bool isCalledOnce(Element element) { | 1423 bool isCalledOnce(Element element) { |
1438 if (compiler.disableTypeInference) return false; | 1424 if (compiler.disableTypeInference) return false; |
1439 MemberTypeInformation info = inferrer.types.getInferredTypeOf(element); | 1425 MemberTypeInformation info = inferrer.types.getInferredTypeOf(element); |
1440 return info.isCalledOnce(); | 1426 return info.isCalledOnce(); |
1441 } | 1427 } |
1442 | 1428 |
1443 void clear() { | 1429 void clear() { |
1444 inferrer.clear(); | 1430 inferrer.clear(); |
1445 } | 1431 } |
1446 } | 1432 } |
OLD | NEW |