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); |
1290 allocatedCalls.clear(); | 1293 allocatedCalls.clear(); |
| 1294 |
1291 defaultTypeOfParameter.clear(); | 1295 defaultTypeOfParameter.clear(); |
1292 types.typeInformations.values.forEach((info) => info.clear()); | 1296 |
| 1297 types.typeInformations.values.forEach(cleanup); |
| 1298 |
| 1299 types.allocatedTypes.forEach(cleanup); |
1293 types.allocatedTypes.clear(); | 1300 types.allocatedTypes.clear(); |
| 1301 |
1294 types.concreteTypes.clear(); | 1302 types.concreteTypes.clear(); |
| 1303 |
| 1304 types.allocatedClosures.forEach(cleanup); |
1295 types.allocatedClosures.clear(); | 1305 types.allocatedClosures.clear(); |
| 1306 |
1296 analyzedElements.clear(); | 1307 analyzedElements.clear(); |
1297 generativeConstructorsExposingThis.clear(); | 1308 generativeConstructorsExposingThis.clear(); |
| 1309 |
| 1310 types.allocatedMaps.values.forEach(cleanup); |
| 1311 types.allocatedLists.values.forEach(cleanup); |
1298 } | 1312 } |
1299 | 1313 |
1300 Iterable<Element> getCallersOf(Element element) { | 1314 Iterable<Element> getCallersOf(Element element) { |
1301 if (compiler.disableTypeInference) { | 1315 if (compiler.disableTypeInference) { |
1302 throw new UnsupportedError( | 1316 throw new UnsupportedError( |
1303 "Cannot query the type inferrer when type inference is disabled."); | 1317 "Cannot query the type inferrer when type inference is disabled."); |
1304 } | 1318 } |
1305 MemberTypeInformation info = types.getInferredTypeOf(element); | 1319 MemberTypeInformation info = types.getInferredTypeOf(element); |
1306 return info.callers; | 1320 return info.callers; |
1307 } | 1321 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 bool isCalledOnce(Element element) { | 1437 bool isCalledOnce(Element element) { |
1424 if (compiler.disableTypeInference) return false; | 1438 if (compiler.disableTypeInference) return false; |
1425 MemberTypeInformation info = inferrer.types.getInferredTypeOf(element); | 1439 MemberTypeInformation info = inferrer.types.getInferredTypeOf(element); |
1426 return info.isCalledOnce(); | 1440 return info.isCalledOnce(); |
1427 } | 1441 } |
1428 | 1442 |
1429 void clear() { | 1443 void clear() { |
1430 inferrer.clear(); | 1444 inferrer.clear(); |
1431 } | 1445 } |
1432 } | 1446 } |
OLD | NEW |