| 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.dart'; | 8 import 'common.dart'; |
| 9 import 'constants/constant_system.dart'; | 9 import 'constants/constant_system.dart'; |
| 10 import 'common_elements.dart' show CommonElements, ElementEnvironment; | 10 import 'common_elements.dart' show CommonElements, ElementEnvironment; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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; | 51 ElementEnvironment get elementEnvironment; |
| 52 | 52 |
| 53 DartTypes get dartTypes; |
| 54 |
| 53 CommonElements get commonElements; | 55 CommonElements get commonElements; |
| 54 | 56 |
| 55 CommonMasks get commonMasks; | 57 CommonMasks get commonMasks; |
| 56 | 58 |
| 57 ConstantSystem get constantSystem; | 59 ConstantSystem get constantSystem; |
| 58 | 60 |
| 59 /// Returns `true` if [cls] is either directly or indirectly instantiated. | 61 /// Returns `true` if [cls] is either directly or indirectly instantiated. |
| 60 bool isInstantiated(ClassEntity cls); | 62 bool isInstantiated(ClassEntity cls); |
| 61 | 63 |
| 62 /// Returns `true` if [cls] is directly instantiated. This means that at | 64 /// Returns `true` if [cls] is directly instantiated. This means that at |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 | 428 |
| 427 final Set<Entity> _sideEffectsFreeElements = new Set<Entity>(); | 429 final Set<Entity> _sideEffectsFreeElements = new Set<Entity>(); |
| 428 | 430 |
| 429 final Set<Entity> _elementsThatCannotThrow = new Set<Entity>(); | 431 final Set<Entity> _elementsThatCannotThrow = new Set<Entity>(); |
| 430 | 432 |
| 431 final Set<Entity> _functionsThatMightBePassedToApply = new Set<Entity>(); | 433 final Set<Entity> _functionsThatMightBePassedToApply = new Set<Entity>(); |
| 432 | 434 |
| 433 CommonMasks _commonMasks; | 435 CommonMasks _commonMasks; |
| 434 | 436 |
| 435 final ElementEnvironment elementEnvironment; | 437 final ElementEnvironment elementEnvironment; |
| 438 final DartTypes dartTypes; |
| 436 final CommonElements commonElements; | 439 final CommonElements commonElements; |
| 437 | 440 |
| 438 // TODO(johnniwinther): Avoid this. | 441 // TODO(johnniwinther): Avoid this. |
| 439 final ResolutionWorldBuilder _resolverWorld; | 442 final ResolutionWorldBuilder _resolverWorld; |
| 440 | 443 |
| 441 // TODO(johnniwinther): Can this be derived from [ClassSet]s? | 444 // TODO(johnniwinther): Can this be derived from [ClassSet]s? |
| 442 final Set<ClassEntity> _implementedClasses; | 445 final Set<ClassEntity> _implementedClasses; |
| 443 | 446 |
| 444 ClosedWorldBase( | 447 ClosedWorldBase( |
| 445 {this.elementEnvironment, | 448 {this.elementEnvironment, |
| 449 this.dartTypes, |
| 446 this.commonElements, | 450 this.commonElements, |
| 447 this.constantSystem, | 451 this.constantSystem, |
| 448 this.nativeData, | 452 this.nativeData, |
| 449 this.interceptorData, | 453 this.interceptorData, |
| 450 this.backendUsage, | 454 this.backendUsage, |
| 451 ResolutionWorldBuilder resolutionWorldBuilder, | 455 ResolutionWorldBuilder resolutionWorldBuilder, |
| 452 Set<ClassEntity> implementedClasses, | 456 Set<ClassEntity> implementedClasses, |
| 453 FunctionSet functionSet, | 457 FunctionSet functionSet, |
| 454 Set<TypedefElement> allTypedefs, | 458 Set<TypedefElement> allTypedefs, |
| 455 Map<ClassEntity, Set<ClassEntity>> mixinUses, | 459 Map<ClassEntity, Set<ClassEntity>> mixinUses, |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 } | 1160 } |
| 1157 getClassHierarchyNode(commonElements.objectClass) | 1161 getClassHierarchyNode(commonElements.objectClass) |
| 1158 .printOn(sb, ' ', instantiatedOnly: cls == null, withRespectTo: cls); | 1162 .printOn(sb, ' ', instantiatedOnly: cls == null, withRespectTo: cls); |
| 1159 return sb.toString(); | 1163 return sb.toString(); |
| 1160 } | 1164 } |
| 1161 } | 1165 } |
| 1162 | 1166 |
| 1163 class ClosedWorldImpl extends ClosedWorldBase { | 1167 class ClosedWorldImpl extends ClosedWorldBase { |
| 1164 ClosedWorldImpl( | 1168 ClosedWorldImpl( |
| 1165 {ElementEnvironment elementEnvironment, | 1169 {ElementEnvironment elementEnvironment, |
| 1170 DartTypes dartTypes, |
| 1166 CommonElements commonElements, | 1171 CommonElements commonElements, |
| 1167 ConstantSystem constantSystem, | 1172 ConstantSystem constantSystem, |
| 1168 NativeData nativeData, | 1173 NativeData nativeData, |
| 1169 InterceptorData interceptorData, | 1174 InterceptorData interceptorData, |
| 1170 BackendUsage backendUsage, | 1175 BackendUsage backendUsage, |
| 1171 ResolutionWorldBuilder resolutionWorldBuilder, | 1176 ResolutionWorldBuilder resolutionWorldBuilder, |
| 1172 Set<ClassEntity> implementedClasses, | 1177 Set<ClassEntity> implementedClasses, |
| 1173 FunctionSet functionSet, | 1178 FunctionSet functionSet, |
| 1174 Set<TypedefElement> allTypedefs, | 1179 Set<TypedefElement> allTypedefs, |
| 1175 Map<ClassEntity, Set<ClassEntity>> mixinUses, | 1180 Map<ClassEntity, Set<ClassEntity>> mixinUses, |
| 1176 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses, | 1181 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses, |
| 1177 Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes, | 1182 Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes, |
| 1178 Map<ClassEntity, ClassSet> classSets}) | 1183 Map<ClassEntity, ClassSet> classSets}) |
| 1179 : super( | 1184 : super( |
| 1180 elementEnvironment: elementEnvironment, | 1185 elementEnvironment: elementEnvironment, |
| 1186 dartTypes: dartTypes, |
| 1181 commonElements: commonElements, | 1187 commonElements: commonElements, |
| 1182 constantSystem: constantSystem, | 1188 constantSystem: constantSystem, |
| 1183 nativeData: nativeData, | 1189 nativeData: nativeData, |
| 1184 interceptorData: interceptorData, | 1190 interceptorData: interceptorData, |
| 1185 backendUsage: backendUsage, | 1191 backendUsage: backendUsage, |
| 1186 resolutionWorldBuilder: resolutionWorldBuilder, | 1192 resolutionWorldBuilder: resolutionWorldBuilder, |
| 1187 implementedClasses: implementedClasses, | 1193 implementedClasses: implementedClasses, |
| 1188 functionSet: functionSet, | 1194 functionSet: functionSet, |
| 1189 allTypedefs: allTypedefs, | 1195 allTypedefs: allTypedefs, |
| 1190 mixinUses: mixinUses, | 1196 mixinUses: mixinUses, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 // does not see generative constructor bodies because they are | 1305 // does not see generative constructor bodies because they are |
| 1300 // created by the backend. Also, it does not make any distinction | 1306 // created by the backend. Also, it does not make any distinction |
| 1301 // between a constructor and its body for side effects. This | 1307 // between a constructor and its body for side effects. This |
| 1302 // implies that currently, the side effects of a constructor body | 1308 // implies that currently, the side effects of a constructor body |
| 1303 // contain the side effects of the initializers. | 1309 // contain the side effects of the initializers. |
| 1304 assert(!element.isGenerativeConstructorBody); | 1310 assert(!element.isGenerativeConstructorBody); |
| 1305 assert(!element.isField); | 1311 assert(!element.isField); |
| 1306 return super.getSideEffectsOfElement(element); | 1312 return super.getSideEffectsOfElement(element); |
| 1307 } | 1313 } |
| 1308 } | 1314 } |
| OLD | NEW |