| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 universe; | 5 library universe; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 /// Strategy for computing the constraints on potential receivers of dynamic | 97 /// Strategy for computing the constraints on potential receivers of dynamic |
| 98 /// call sites. | 98 /// call sites. |
| 99 abstract class SelectorConstraintsStrategy { | 99 abstract class SelectorConstraintsStrategy { |
| 100 /// Create a [UniverseSelectorConstraints] to represent the global receiver | 100 /// Create a [UniverseSelectorConstraints] to represent the global receiver |
| 101 /// constraints for dynamic call sites with [selector]. | 101 /// constraints for dynamic call sites with [selector]. |
| 102 UniverseSelectorConstraints createSelectorConstraints(Selector selector); | 102 UniverseSelectorConstraints createSelectorConstraints(Selector selector); |
| 103 } | 103 } |
| 104 | 104 |
| 105 /// The [Universe] is an auxiliary class used in the process of computing the |
| 106 /// [ClassWorld]. The concepts here and in [ClassWorld] are very similar -- in |
| 107 /// the same way that the "universe expands" you can think of this as a mutable |
| 108 /// world that is expanding as we visit and discover parts of the program. |
| 109 /// TODO(sigmund): rename to "growing/expanding/mutable world"? |
| 105 class Universe { | 110 class Universe { |
| 106 /// The set of all directly instantiated classes, that is, classes with a | 111 /// The set of all directly instantiated classes, that is, classes with a |
| 107 /// generative constructor that has been called directly and not only through | 112 /// generative constructor that has been called directly and not only through |
| 108 /// a super-call. | 113 /// a super-call. |
| 109 /// | 114 /// |
| 110 /// Invariant: Elements are declaration elements. | 115 /// Invariant: Elements are declaration elements. |
| 111 // TODO(johnniwinther): [_directlyInstantiatedClasses] and | 116 // TODO(johnniwinther): [_directlyInstantiatedClasses] and |
| 112 // [_instantiatedTypes] sets should be merged. | 117 // [_instantiatedTypes] sets should be merged. |
| 113 final Set<ClassElement> _directlyInstantiatedClasses = | 118 final Set<ClassElement> _directlyInstantiatedClasses = |
| 114 new Set<ClassElement>(); | 119 new Set<ClassElement>(); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // TODO(ahe): Replace this method with something that is O(1), for example, | 394 // TODO(ahe): Replace this method with something that is O(1), for example, |
| 390 // by using a map. | 395 // by using a map. |
| 391 List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) { | 396 List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) { |
| 392 // Return new list to guard against concurrent modifications. | 397 // Return new list to guard against concurrent modifications. |
| 393 return new List<LocalFunctionElement>.from( | 398 return new List<LocalFunctionElement>.from( |
| 394 allClosures.where((LocalFunctionElement closure) { | 399 allClosures.where((LocalFunctionElement closure) { |
| 395 return closure.executableContext == element; | 400 return closure.executableContext == element; |
| 396 })); | 401 })); |
| 397 } | 402 } |
| 398 } | 403 } |
| OLD | NEW |