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 dart2js.world; | 5 library dart2js.world; |
6 | 6 |
7 import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX; | 7 import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX; |
8 import 'common/backend_api.dart' show BackendClasses; | |
9 import 'common.dart'; | 8 import 'common.dart'; |
10 import 'constants/constant_system.dart'; | 9 import 'constants/constant_system.dart'; |
11 import 'common_elements.dart' show CommonElements; | 10 import 'common_elements.dart' show CommonElements; |
12 import 'elements/entities.dart'; | 11 import 'elements/entities.dart'; |
13 import 'elements/elements.dart' | 12 import 'elements/elements.dart' |
14 show | 13 show |
15 ClassElement, | 14 ClassElement, |
16 Element, | 15 Element, |
17 FunctionElement, | 16 FunctionElement, |
18 MemberElement, | 17 MemberElement, |
(...skipping 17 matching lines...) Expand all Loading... |
36 | 35 |
37 /// The [ClosedWorld] represents the information known about a program when | 36 /// The [ClosedWorld] represents the information known about a program when |
38 /// compiling with closed-world semantics. | 37 /// compiling with closed-world semantics. |
39 /// | 38 /// |
40 /// Given the entrypoint of an application, we can track what's reachable from | 39 /// Given the entrypoint of an application, we can track what's reachable from |
41 /// it, what functions are called, what classes are allocated, which native | 40 /// it, what functions are called, what classes are allocated, which native |
42 /// JavaScript types are touched, what language features are used, and so on. | 41 /// JavaScript types are touched, what language features are used, and so on. |
43 /// This precise knowledge about what's live in the program is later used in | 42 /// This precise knowledge about what's live in the program is later used in |
44 /// optimizations and other compiler decisions during code generation. | 43 /// optimizations and other compiler decisions during code generation. |
45 abstract class ClosedWorld implements World { | 44 abstract class ClosedWorld implements World { |
46 /// Access to core classes used by the backend. | |
47 BackendClasses get backendClasses; | |
48 | |
49 NativeData get nativeData; | 45 NativeData get nativeData; |
50 | 46 |
51 InterceptorData get interceptorData; | 47 InterceptorData get interceptorData; |
52 | 48 |
53 CommonElements get commonElements; | 49 CommonElements get commonElements; |
54 | 50 |
55 CommonMasks get commonMasks; | 51 CommonMasks get commonMasks; |
56 | 52 |
57 ConstantSystem get constantSystem; | 53 ConstantSystem get constantSystem; |
58 | 54 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 /// The class and all subclasses (transitively) are included. | 378 /// The class and all subclasses (transitively) are included. |
383 SUBCLASS, | 379 SUBCLASS, |
384 | 380 |
385 /// The class and all classes that implement or subclass it (transitively) | 381 /// The class and all classes that implement or subclass it (transitively) |
386 /// are included. | 382 /// are included. |
387 SUBTYPE, | 383 SUBTYPE, |
388 } | 384 } |
389 | 385 |
390 abstract class ClosedWorldBase implements ClosedWorld, ClosedWorldRefiner { | 386 abstract class ClosedWorldBase implements ClosedWorld, ClosedWorldRefiner { |
391 final JavaScriptBackend _backend; | 387 final JavaScriptBackend _backend; |
392 BackendClasses get backendClasses => _backend.backendClasses; | |
393 InterceptorData get interceptorData => _backend.interceptorData; | 388 InterceptorData get interceptorData => _backend.interceptorData; |
394 FunctionSet _allFunctions; | 389 FunctionSet _allFunctions; |
395 | 390 |
396 final Iterable<TypedefElement> _allTypedefs; | 391 final Iterable<TypedefElement> _allTypedefs; |
397 | 392 |
398 final Map<ClassEntity, Set<ClassEntity>> _mixinUses; | 393 final Map<ClassEntity, Set<ClassEntity>> _mixinUses; |
399 Map<ClassEntity, List<ClassEntity>> _liveMixinUses; | 394 Map<ClassEntity, List<ClassEntity>> _liveMixinUses; |
400 | 395 |
401 final Map<ClassEntity, Set<ClassEntity>> _typesImplementedBySubclasses; | 396 final Map<ClassEntity, Set<ClassEntity>> _typesImplementedBySubclasses; |
402 | 397 |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 return getMightBePassedToApply(element.expression); | 1207 return getMightBePassedToApply(element.expression); |
1213 } | 1208 } |
1214 return functionsThatMightBePassedToApply.contains(element); | 1209 return functionsThatMightBePassedToApply.contains(element); |
1215 } | 1210 } |
1216 | 1211 |
1217 @override | 1212 @override |
1218 bool getCurrentlyKnownMightBePassedToApply(Element element) { | 1213 bool getCurrentlyKnownMightBePassedToApply(Element element) { |
1219 return getMightBePassedToApply(element); | 1214 return getMightBePassedToApply(element); |
1220 } | 1215 } |
1221 } | 1216 } |
OLD | NEW |