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

Side by Side Diff: pkg/compiler/lib/src/universe/element_world_builder.dart

Issue 2826673002: Remove JavaScriptBackend from ClosedWorldBase (Closed)
Patch Set: Fix Created 3 years, 8 months 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 part of world_builder; 5 part of world_builder;
6 6
7 /// [ResolutionEnqueuerWorldBuilder] based on the [Element] model. 7 /// [ResolutionEnqueuerWorldBuilder] based on the [Element] model.
8 class ElementResolutionWorldBuilder extends ResolutionWorldBuilderBase { 8 class ElementResolutionWorldBuilder extends ResolutionWorldBuilderBase {
9 /// Used for testing the new more precise computation of instantiated types 9 /// Used for testing the new more precise computation of instantiated types
10 /// and classes. 10 /// and classes.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 ClassHierarchyNode node = _ensureClassHierarchyNode(cls); 177 ClassHierarchyNode node = _ensureClassHierarchyNode(cls);
178 _updateSuperClassHierarchyNodeForClass(node); 178 _updateSuperClassHierarchyNodeForClass(node);
179 if (directlyInstantiated) { 179 if (directlyInstantiated) {
180 node.isDirectlyInstantiated = true; 180 node.isDirectlyInstantiated = true;
181 } 181 }
182 if (abstractlyInstantiated) { 182 if (abstractlyInstantiated) {
183 node.isAbstractlyInstantiated = true; 183 node.isAbstractlyInstantiated = true;
184 } 184 }
185 } 185 }
186 186
187 ClosedWorld closeWorld(DiagnosticReporter reporter) { 187 ClosedWorld closeWorld() {
188 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses = 188 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses =
189 new Map<ClassEntity, Set<ClassEntity>>(); 189 new Map<ClassEntity, Set<ClassEntity>>();
190 190
191 /// Updates the `isDirectlyInstantiated` and `isIndirectlyInstantiated` 191 /// Updates the `isDirectlyInstantiated` and `isIndirectlyInstantiated`
192 /// properties of the [ClassHierarchyNode] for [cls]. 192 /// properties of the [ClassHierarchyNode] for [cls].
193 193
194 void addSubtypes(ClassElement cls, InstantiationInfo info) { 194 void addSubtypes(ClassElement cls, InstantiationInfo info) {
195 if (!info.hasInstantiation) { 195 if (!info.hasInstantiation) {
196 return; 196 return;
197 } 197 }
198 assert(cls.isDeclaration); 198 assert(cls.isDeclaration);
199 if (!cls.isResolved) { 199 if (!cls.isResolved) {
200 reporter.internalError(cls, 'Class "${cls.name}" is not resolved.'); 200 throw new SpannableAssertionFailure(
201 cls, 'Class "${cls.name}" is not resolved.');
201 } 202 }
202 203
203 _updateClassHierarchyNodeForClass(cls, 204 _updateClassHierarchyNodeForClass(cls,
204 directlyInstantiated: info.isDirectlyInstantiated, 205 directlyInstantiated: info.isDirectlyInstantiated,
205 abstractlyInstantiated: info.isAbstractlyInstantiated); 206 abstractlyInstantiated: info.isAbstractlyInstantiated);
206 207
207 // Walk through the superclasses, and record the types 208 // Walk through the superclasses, and record the types
208 // implemented by that type on the superclasses. 209 // implemented by that type on the superclasses.
209 ClassElement superclass = cls.superclass; 210 ClassElement superclass = cls.superclass;
210 while (superclass != null) { 211 while (superclass != null) {
211 Set<ClassEntity> typesImplementedBySubclassesOfCls = 212 Set<ClassEntity> typesImplementedBySubclassesOfCls =
212 typesImplementedBySubclasses.putIfAbsent( 213 typesImplementedBySubclasses.putIfAbsent(
213 superclass, () => new Set<ClassEntity>()); 214 superclass, () => new Set<ClassEntity>());
214 for (ResolutionInterfaceType current in cls.allSupertypes) { 215 for (ResolutionInterfaceType current in cls.allSupertypes) {
215 typesImplementedBySubclassesOfCls.add(current.element); 216 typesImplementedBySubclassesOfCls.add(current.element);
216 } 217 }
217 superclass = superclass.superclass; 218 superclass = superclass.superclass;
218 } 219 }
219 } 220 }
220 221
221 // Use the [:seenClasses:] set to include non-instantiated 222 // Use the [:seenClasses:] set to include non-instantiated
222 // classes: if the superclass of these classes require RTI, then 223 // classes: if the superclass of these classes require RTI, then
223 // they also need RTI, so that a constructor passes the type 224 // they also need RTI, so that a constructor passes the type
224 // variables to the super constructor. 225 // variables to the super constructor.
225 forEachInstantiatedClass(addSubtypes); 226 forEachInstantiatedClass(addSubtypes);
226 227
227 _closed = true; 228 _closed = true;
228 return _closedWorldCache = new ClosedWorldImpl( 229 return _closedWorldCache = new ClosedWorldImpl(
229 backend: _backend,
230 commonElements: _commonElements, 230 commonElements: _commonElements,
231 constantSystem: _backend.constantSystem,
232 nativeData: _backend.nativeData,
233 interceptorData: _backend.interceptorData,
234 backendUsage: _backend.backendUsage,
231 resolutionWorldBuilder: this, 235 resolutionWorldBuilder: this,
232 functionSetBuilder: _allFunctions, 236 functionSetBuilder: _allFunctions,
233 allTypedefs: _allTypedefs, 237 allTypedefs: _allTypedefs,
234 mixinUses: _mixinUses, 238 mixinUses: _mixinUses,
235 typesImplementedBySubclasses: typesImplementedBySubclasses, 239 typesImplementedBySubclasses: typesImplementedBySubclasses,
236 classHierarchyNodes: _classHierarchyNodes, 240 classHierarchyNodes: _classHierarchyNodes,
237 classSets: _classSets); 241 classSets: _classSets);
238 } 242 }
239 243
240 @override 244 @override
241 void registerMixinUse( 245 void registerMixinUse(
242 MixinApplicationElement mixinApplication, ClassElement mixin) { 246 MixinApplicationElement mixinApplication, ClassElement mixin) {
243 assert(mixin.isDeclaration); 247 assert(mixin.isDeclaration);
244 super.registerMixinUse(mixinApplication, mixin); 248 super.registerMixinUse(mixinApplication, mixin);
245 } 249 }
246 } 250 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/interceptor_simplifier.dart ('k') | pkg/compiler/lib/src/universe/resolution_world_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698