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

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

Issue 2935063002: Add ClosedWorld.elementEnvironment and remove Compiler.elementEnvironment (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « pkg/compiler/lib/src/universe/element_world_builder.dart ('k') | pkg/compiler/tool/perf.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX; 7 import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX;
8 import 'common.dart'; 8 import 'common.dart';
9 import 'constants/constant_system.dart'; 9 import 'constants/constant_system.dart';
10 import 'common_elements.dart' show CommonElements; 10 import 'common_elements.dart' show CommonElements, ElementEnvironment;
11 import 'elements/entities.dart'; 11 import 'elements/entities.dart';
12 import 'elements/elements.dart' 12 import 'elements/elements.dart'
13 show 13 show
14 ClassElement, 14 ClassElement,
15 Element, 15 Element,
16 MemberElement, 16 MemberElement,
17 MixinApplicationElement, 17 MixinApplicationElement,
18 TypedefElement; 18 TypedefElement;
19 import 'elements/resolution_types.dart'; 19 import 'elements/resolution_types.dart';
20 import 'elements/types.dart'; 20 import 'elements/types.dart';
(...skipping 20 matching lines...) Expand all
41 /// 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.
42 /// 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
43 /// optimizations and other compiler decisions during code generation. 43 /// optimizations and other compiler decisions during code generation.
44 abstract class ClosedWorld implements World { 44 abstract class ClosedWorld implements World {
45 BackendUsage get backendUsage; 45 BackendUsage get backendUsage;
46 46
47 NativeData get nativeData; 47 NativeData get nativeData;
48 48
49 InterceptorData get interceptorData; 49 InterceptorData get interceptorData;
50 50
51 ElementEnvironment get elementEnvironment;
52
51 CommonElements get commonElements; 53 CommonElements get commonElements;
52 54
53 CommonMasks get commonMasks; 55 CommonMasks get commonMasks;
54 56
55 ConstantSystem get constantSystem; 57 ConstantSystem get constantSystem;
56 58
57 /// Returns `true` if [cls] is either directly or indirectly instantiated. 59 /// Returns `true` if [cls] is either directly or indirectly instantiated.
58 bool isInstantiated(ClassEntity cls); 60 bool isInstantiated(ClassEntity cls);
59 61
60 /// Returns `true` if [cls] is directly instantiated. This means that at 62 /// Returns `true` if [cls] is directly instantiated. This means that at
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 final Map<Entity, SideEffects> _sideEffects = new Map<Entity, SideEffects>(); 424 final Map<Entity, SideEffects> _sideEffects = new Map<Entity, SideEffects>();
423 425
424 final Set<Entity> _sideEffectsFreeElements = new Set<Entity>(); 426 final Set<Entity> _sideEffectsFreeElements = new Set<Entity>();
425 427
426 final Set<Entity> _elementsThatCannotThrow = new Set<Entity>(); 428 final Set<Entity> _elementsThatCannotThrow = new Set<Entity>();
427 429
428 final Set<Entity> _functionsThatMightBePassedToApply = new Set<Entity>(); 430 final Set<Entity> _functionsThatMightBePassedToApply = new Set<Entity>();
429 431
430 CommonMasks _commonMasks; 432 CommonMasks _commonMasks;
431 433
434 final ElementEnvironment elementEnvironment;
432 final CommonElements commonElements; 435 final CommonElements commonElements;
433 436
434 // TODO(johnniwinther): Avoid this. 437 // TODO(johnniwinther): Avoid this.
435 final ResolutionWorldBuilder _resolverWorld; 438 final ResolutionWorldBuilder _resolverWorld;
436 439
437 // TODO(johnniwinther): Can this be derived from [ClassSet]s? 440 // TODO(johnniwinther): Can this be derived from [ClassSet]s?
438 final Set<ClassEntity> _implementedClasses; 441 final Set<ClassEntity> _implementedClasses;
439 442
440 ClosedWorldBase( 443 ClosedWorldBase(
441 {this.commonElements, 444 {this.elementEnvironment,
445 this.commonElements,
442 this.constantSystem, 446 this.constantSystem,
443 this.nativeData, 447 this.nativeData,
444 this.interceptorData, 448 this.interceptorData,
445 this.backendUsage, 449 this.backendUsage,
446 ResolutionWorldBuilder resolutionWorldBuilder, 450 ResolutionWorldBuilder resolutionWorldBuilder,
447 Set<ClassEntity> implementedClasses, 451 Set<ClassEntity> implementedClasses,
448 FunctionSet functionSet, 452 FunctionSet functionSet,
449 Set<TypedefElement> allTypedefs, 453 Set<TypedefElement> allTypedefs,
450 Map<ClassEntity, Set<ClassEntity>> mixinUses, 454 Map<ClassEntity, Set<ClassEntity>> mixinUses,
451 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses, 455 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses,
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 sb.write("Instantiated classes in the closed world:\n"); 1153 sb.write("Instantiated classes in the closed world:\n");
1150 } 1154 }
1151 getClassHierarchyNode(commonElements.objectClass) 1155 getClassHierarchyNode(commonElements.objectClass)
1152 .printOn(sb, ' ', instantiatedOnly: cls == null, withRespectTo: cls); 1156 .printOn(sb, ' ', instantiatedOnly: cls == null, withRespectTo: cls);
1153 return sb.toString(); 1157 return sb.toString();
1154 } 1158 }
1155 } 1159 }
1156 1160
1157 class ClosedWorldImpl extends ClosedWorldBase { 1161 class ClosedWorldImpl extends ClosedWorldBase {
1158 ClosedWorldImpl( 1162 ClosedWorldImpl(
1159 {CommonElements commonElements, 1163 {ElementEnvironment elementEnvironment,
1164 CommonElements commonElements,
1160 ConstantSystem constantSystem, 1165 ConstantSystem constantSystem,
1161 NativeData nativeData, 1166 NativeData nativeData,
1162 InterceptorData interceptorData, 1167 InterceptorData interceptorData,
1163 BackendUsage backendUsage, 1168 BackendUsage backendUsage,
1164 ResolutionWorldBuilder resolutionWorldBuilder, 1169 ResolutionWorldBuilder resolutionWorldBuilder,
1165 Set<ClassEntity> implementedClasses, 1170 Set<ClassEntity> implementedClasses,
1166 FunctionSet functionSet, 1171 FunctionSet functionSet,
1167 Set<TypedefElement> allTypedefs, 1172 Set<TypedefElement> allTypedefs,
1168 Map<ClassEntity, Set<ClassEntity>> mixinUses, 1173 Map<ClassEntity, Set<ClassEntity>> mixinUses,
1169 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses, 1174 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses,
1170 Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes, 1175 Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes,
1171 Map<ClassEntity, ClassSet> classSets}) 1176 Map<ClassEntity, ClassSet> classSets})
1172 : super( 1177 : super(
1178 elementEnvironment: elementEnvironment,
1173 commonElements: commonElements, 1179 commonElements: commonElements,
1174 constantSystem: constantSystem, 1180 constantSystem: constantSystem,
1175 nativeData: nativeData, 1181 nativeData: nativeData,
1176 interceptorData: interceptorData, 1182 interceptorData: interceptorData,
1177 backendUsage: backendUsage, 1183 backendUsage: backendUsage,
1178 resolutionWorldBuilder: resolutionWorldBuilder, 1184 resolutionWorldBuilder: resolutionWorldBuilder,
1179 implementedClasses: implementedClasses, 1185 implementedClasses: implementedClasses,
1180 functionSet: functionSet, 1186 functionSet: functionSet,
1181 allTypedefs: allTypedefs, 1187 allTypedefs: allTypedefs,
1182 mixinUses: mixinUses, 1188 mixinUses: mixinUses,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 // does not see generative constructor bodies because they are 1297 // does not see generative constructor bodies because they are
1292 // created by the backend. Also, it does not make any distinction 1298 // created by the backend. Also, it does not make any distinction
1293 // between a constructor and its body for side effects. This 1299 // between a constructor and its body for side effects. This
1294 // implies that currently, the side effects of a constructor body 1300 // implies that currently, the side effects of a constructor body
1295 // contain the side effects of the initializers. 1301 // contain the side effects of the initializers.
1296 assert(!element.isGenerativeConstructorBody); 1302 assert(!element.isGenerativeConstructorBody);
1297 assert(!element.isField); 1303 assert(!element.isField);
1298 return super.getSideEffectsOfElement(element); 1304 return super.getSideEffectsOfElement(element);
1299 } 1305 }
1300 } 1306 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/universe/element_world_builder.dart ('k') | pkg/compiler/tool/perf.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698