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

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

Issue 2869753002: Pass NativeDataBuilder through ResolutionWorldBuilder (Closed)
Patch Set: Created 3 years, 7 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 abstract class ResolutionWorldBuilder implements WorldBuilder, OpenWorld { 7 abstract class ResolutionWorldBuilder implements WorldBuilder, OpenWorld {
8 /// Set of all local functions in the program. Used by the mirror tracking 8 /// Set of all local functions in the program. Used by the mirror tracking
9 /// system to find all live closure instances. 9 /// system to find all live closure instances.
10 Iterable<Local> get localFunctions; 10 Iterable<Local> get localFunctions;
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 /// A closurized method is considered live if the enclosing class has been 326 /// A closurized method is considered live if the enclosing class has been
327 /// instantiated. 327 /// instantiated.
328 final Set<FunctionEntity> closurizedMembersWithFreeTypeVariables = 328 final Set<FunctionEntity> closurizedMembersWithFreeTypeVariables =
329 new Set<FunctionEntity>(); 329 new Set<FunctionEntity>();
330 330
331 final ElementEnvironment _elementEnvironment; 331 final ElementEnvironment _elementEnvironment;
332 332
333 final CommonElements _commonElements; 333 final CommonElements _commonElements;
334 334
335 final NativeBasicData _nativeBasicData; 335 final NativeBasicData _nativeBasicData;
336 final NativeDataBuilder _nativeDataBuilder;
336 337
337 final SelectorConstraintsStrategy selectorConstraintsStrategy; 338 final SelectorConstraintsStrategy selectorConstraintsStrategy;
338 339
339 bool hasRuntimeTypeSupport = false; 340 bool hasRuntimeTypeSupport = false;
340 bool hasIsolateSupport = false; 341 bool hasIsolateSupport = false;
341 bool hasFunctionApplySupport = false; 342 bool hasFunctionApplySupport = false;
342 343
343 bool _closed = false; 344 bool _closed = false;
344 ClosedWorld _closedWorldCache; 345 ClosedWorld _closedWorldCache;
345 FunctionSetBuilder _allFunctions; 346 FunctionSetBuilder _allFunctions;
346 347
347 final Set<TypedefElement> _allTypedefs = new Set<TypedefElement>(); 348 final Set<TypedefElement> _allTypedefs = new Set<TypedefElement>();
348 349
349 final Map<ClassEntity, Set<ClassEntity>> _mixinUses = 350 final Map<ClassEntity, Set<ClassEntity>> _mixinUses =
350 new Map<ClassEntity, Set<ClassEntity>>(); 351 new Map<ClassEntity, Set<ClassEntity>>();
351 352
352 // We keep track of subtype and subclass relationships in four 353 // We keep track of subtype and subclass relationships in four
353 // distinct sets to make class hierarchy analysis faster. 354 // distinct sets to make class hierarchy analysis faster.
354 final Map<ClassEntity, ClassHierarchyNode> _classHierarchyNodes = 355 final Map<ClassEntity, ClassHierarchyNode> _classHierarchyNodes =
355 <ClassEntity, ClassHierarchyNode>{}; 356 <ClassEntity, ClassHierarchyNode>{};
356 final Map<ClassEntity, ClassSet> _classSets = <ClassEntity, ClassSet>{}; 357 final Map<ClassEntity, ClassSet> _classSets = <ClassEntity, ClassSet>{};
357 358
358 final Set<ConstantValue> _constantValues = new Set<ConstantValue>(); 359 final Set<ConstantValue> _constantValues = new Set<ConstantValue>();
359 360
360 bool get isClosed => _closed; 361 bool get isClosed => _closed;
361 362
362 ResolutionWorldBuilderBase(this._elementEnvironment, this._commonElements, 363 ResolutionWorldBuilderBase(
363 this._nativeBasicData, this.selectorConstraintsStrategy) { 364 this._elementEnvironment,
365 this._commonElements,
366 this._nativeBasicData,
367 this._nativeDataBuilder,
368 this.selectorConstraintsStrategy) {
364 _allFunctions = new FunctionSetBuilder(); 369 _allFunctions = new FunctionSetBuilder();
365 } 370 }
366 371
367 Iterable<ClassEntity> get processedClasses => _processedClasses.keys 372 Iterable<ClassEntity> get processedClasses => _processedClasses.keys
368 .where((cls) => _processedClasses[cls].isInstantiated); 373 .where((cls) => _processedClasses[cls].isInstantiated);
369 374
370 ClosedWorld get closedWorldForTesting { 375 ClosedWorld get closedWorldForTesting {
371 if (!_closed) { 376 if (!_closed) {
372 throw new SpannableAssertionFailure( 377 throw new SpannableAssertionFailure(
373 NO_LOCATION_SPANNABLE, "The world builder has not yet been closed."); 378 NO_LOCATION_SPANNABLE, "The world builder has not yet been closed.");
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 return typesImplementedBySubclasses; 913 return typesImplementedBySubclasses;
909 } 914 }
910 } 915 }
911 916
912 abstract class KernelResolutionWorldBuilderBase 917 abstract class KernelResolutionWorldBuilderBase
913 extends ResolutionWorldBuilderBase { 918 extends ResolutionWorldBuilderBase {
914 KernelResolutionWorldBuilderBase( 919 KernelResolutionWorldBuilderBase(
915 ElementEnvironment elementEnvironment, 920 ElementEnvironment elementEnvironment,
916 CommonElements commonElements, 921 CommonElements commonElements,
917 NativeBasicData nativeBasicData, 922 NativeBasicData nativeBasicData,
923 NativeDataBuilder nativeDataBuilder,
918 SelectorConstraintsStrategy selectorConstraintsStrategy) 924 SelectorConstraintsStrategy selectorConstraintsStrategy)
919 : super(elementEnvironment, commonElements, nativeBasicData, 925 : super(elementEnvironment, commonElements, nativeBasicData,
920 selectorConstraintsStrategy); 926 nativeDataBuilder, selectorConstraintsStrategy);
921 927
922 @override 928 @override
923 ClosedWorld closeWorld() { 929 ClosedWorld closeWorld() {
924 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses = 930 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses =
925 populateHierarchyNodes(); 931 populateHierarchyNodes();
926 _closed = true; 932 _closed = true;
927 // TODO(johnniwinther): Implement this. 933 // TODO(johnniwinther): Implement this.
928 return _closedWorldCache = new KernelClosedWorld( 934 return _closedWorldCache = new KernelClosedWorld(
929 commonElements: _commonElements, 935 commonElements: _commonElements,
930 // TODO(johnniwinther): Compute these. 936 // TODO(johnniwinther): Compute these.
931 constantSystem: null, 937 constantSystem: null,
932 nativeData: null, 938 nativeData: _nativeDataBuilder.close(),
933 interceptorData: null, 939 interceptorData: null,
934 backendUsage: null, 940 backendUsage: null,
935 resolutionWorldBuilder: this, 941 resolutionWorldBuilder: this,
936 functionSet: _allFunctions.close(), 942 functionSet: _allFunctions.close(),
937 allTypedefs: _allTypedefs, 943 allTypedefs: _allTypedefs,
938 mixinUses: _mixinUses, 944 mixinUses: _mixinUses,
939 typesImplementedBySubclasses: typesImplementedBySubclasses, 945 typesImplementedBySubclasses: typesImplementedBySubclasses,
940 classHierarchyNodes: _classHierarchyNodes, 946 classHierarchyNodes: _classHierarchyNodes,
941 classSets: _classSets); 947 classSets: _classSets);
942 } 948 }
943 949
944 @override 950 @override
945 void registerClass(ClassEntity cls) { 951 void registerClass(ClassEntity cls) {
946 throw new UnimplementedError('KernelResolutionWorldBuilder.registerClass'); 952 throw new UnimplementedError('KernelResolutionWorldBuilder.registerClass');
947 } 953 }
948 } 954 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/universe/element_world_builder.dart ('k') | pkg/compiler/lib/src/universe/world_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698