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

Side by Side Diff: pkg/compiler/lib/src/world.dart

Issue 2559373004: Remove Compiler.inferenceWorld (Closed)
Patch Set: Created 4 years 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
OLDNEW
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 'cache_strategy.dart'; 7 import 'cache_strategy.dart';
8 import 'closure.dart' show SynthesizedCallMethodElementX; 8 import 'closure.dart' show SynthesizedCallMethodElementX;
9 import 'common/backend_api.dart' show BackendClasses; 9 import 'common/backend_api.dart' show BackendClasses;
10 import 'common.dart'; 10 import 'common.dart';
11 import 'core_types.dart' show CoreClasses; 11 import 'core_types.dart' show CoreClasses, CommonElements;
12 import 'dart_types.dart'; 12 import 'dart_types.dart';
13 import 'elements/elements.dart' 13 import 'elements/elements.dart'
14 show 14 show
15 ClassElement, 15 ClassElement,
16 Element, 16 Element,
17 FunctionElement, 17 FunctionElement,
18 MixinApplicationElement, 18 MixinApplicationElement,
19 TypedefElement, 19 TypedefElement,
20 FieldElement; 20 FieldElement;
21 import 'js_backend/backend.dart' show JavaScriptBackend; 21 import 'js_backend/backend.dart' show JavaScriptBackend;
(...skipping 18 matching lines...) Expand all
40 /// JavaScript types are touched, what language features are used, and so on. 40 /// JavaScript types are touched, what language features are used, and so on.
41 /// This precise knowledge about what's live in the program is later used in 41 /// This precise knowledge about what's live in the program is later used in
42 /// optimizations and other compiler decisions during code generation. 42 /// optimizations and other compiler decisions during code generation.
43 abstract class ClosedWorld implements World { 43 abstract class ClosedWorld implements World {
44 /// Access to core classes used by the backend. 44 /// Access to core classes used by the backend.
45 BackendClasses get backendClasses; 45 BackendClasses get backendClasses;
46 46
47 /// Access to core classes used in the Dart language. 47 /// Access to core classes used in the Dart language.
48 CoreClasses get coreClasses; 48 CoreClasses get coreClasses;
49 49
50 CommonElements get commonElements;
51
50 CommonMasks get commonMasks; 52 CommonMasks get commonMasks;
51 53
52 /// Returns `true` if [cls] is either directly or indirectly instantiated. 54 /// Returns `true` if [cls] is either directly or indirectly instantiated.
53 bool isInstantiated(ClassElement cls); 55 bool isInstantiated(ClassElement cls);
54 56
55 /// Returns `true` if [cls] is directly instantiated. This means that at 57 /// Returns `true` if [cls] is directly instantiated. This means that at
56 /// runtime instances of exactly [cls] are assumed to exist. 58 /// runtime instances of exactly [cls] are assumed to exist.
57 bool isDirectlyInstantiated(ClassElement cls); 59 bool isDirectlyInstantiated(ClassElement cls);
58 60
59 /// Returns `true` if [cls] is abstractly instantiated. This means that at 61 /// Returns `true` if [cls] is abstractly instantiated. This means that at
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 869
868 final Set<Element> elementsThatCannotThrow = new Set<Element>(); 870 final Set<Element> elementsThatCannotThrow = new Set<Element>();
869 871
870 final Set<Element> functionsThatMightBePassedToApply = 872 final Set<Element> functionsThatMightBePassedToApply =
871 new Set<FunctionElement>(); 873 new Set<FunctionElement>();
872 874
873 final Set<Element> alreadyPopulated; 875 final Set<Element> alreadyPopulated;
874 876
875 CommonMasks _commonMasks; 877 CommonMasks _commonMasks;
876 878
877 final CoreClasses coreClasses; 879 final CommonElements commonElements;
878 880
879 final CacheStrategy cacheStrategy; 881 final CacheStrategy cacheStrategy;
880 882
881 final ResolutionWorldBuilder resolverWorld; 883 final ResolutionWorldBuilder resolverWorld;
882 884
883 bool get isClosed => _closed; 885 bool get isClosed => _closed;
884 886
885 Set<ClassElement> typesImplementedBySubclassesOf(ClassElement cls) { 887 Set<ClassElement> typesImplementedBySubclassesOf(ClassElement cls) {
886 return _typesImplementedBySubclasses[cls.declaration]; 888 return _typesImplementedBySubclasses[cls.declaration];
887 } 889 }
888 890
889 WorldImpl(this.resolverWorld, this._backend, this.coreClasses, 891 WorldImpl(this.resolverWorld, this._backend, this.commonElements,
890 CacheStrategy cacheStrategy) 892 CacheStrategy cacheStrategy)
891 : this.cacheStrategy = cacheStrategy, 893 : this.cacheStrategy = cacheStrategy,
892 alreadyPopulated = cacheStrategy.newSet() { 894 alreadyPopulated = cacheStrategy.newSet() {
893 _allFunctions = new FunctionSet(this); 895 _allFunctions = new FunctionSet(this);
894 } 896 }
895 897
896 FunctionSet get allFunctions => _allFunctions; 898 FunctionSet get allFunctions => _allFunctions;
897 899
898 CommonMasks get commonMasks { 900 CommonMasks get commonMasks {
899 assert(isClosed); 901 assert(isClosed);
900 return _commonMasks; 902 return _commonMasks;
901 } 903 }
902 904
905 CoreClasses get coreClasses => commonElements;
906
903 /// Called to add [cls] to the set of known classes. 907 /// Called to add [cls] to the set of known classes.
904 /// 908 ///
905 /// This ensures that class hierarchy queries can be performed on [cls] and 909 /// This ensures that class hierarchy queries can be performed on [cls] and
906 /// classes that extend or implement it. 910 /// classes that extend or implement it.
907 void registerClass(ClassElement cls) => _registerClass(cls); 911 void registerClass(ClassElement cls) => _registerClass(cls);
908 912
909 void registerClosureClass(ClassElement cls) { 913 void registerClosureClass(ClassElement cls) {
910 _registerClass(cls, isDirectlyInstantiated: true); 914 _registerClass(cls, isDirectlyInstantiated: true);
911 } 915 }
912 916
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 /// Only the class itself is included. 1223 /// Only the class itself is included.
1220 EXACT, 1224 EXACT,
1221 1225
1222 /// The class and all subclasses (transitively) are included. 1226 /// The class and all subclasses (transitively) are included.
1223 SUBCLASS, 1227 SUBCLASS,
1224 1228
1225 /// The class and all classes that implement or subclass it (transitively) 1229 /// The class and all classes that implement or subclass it (transitively)
1226 /// are included. 1230 /// are included.
1227 SUBTYPE, 1231 SUBTYPE,
1228 } 1232 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/types/types.dart ('k') | tests/compiler/dart2js/simple_inferrer_callers_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698