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

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

Issue 2721403006: Split NativeData (Closed)
Patch Set: Updated cf. comments. Created 3 years, 9 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) 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/backend_api.dart' show BackendClasses; 8 import 'common/backend_api.dart' show BackendClasses;
9 import 'common.dart'; 9 import 'common.dart';
10 import 'constants/constant_system.dart'; 10 import 'constants/constant_system.dart';
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 if (classSet == null) { 704 if (classSet == null) {
705 // Vacuously true. 705 // Vacuously true.
706 return true; 706 return true;
707 } 707 }
708 return classSet.hasOnlyInstantiatedSubclasses; 708 return classSet.hasOnlyInstantiatedSubclasses;
709 } 709 }
710 710
711 @override 711 @override
712 ClassElement getLubOfInstantiatedSubclasses(ClassElement cls) { 712 ClassElement getLubOfInstantiatedSubclasses(ClassElement cls) {
713 assert(isClosed); 713 assert(isClosed);
714 if (_backend.isJsInterop(cls)) { 714 if (_backend.nativeData.isJsInterop(cls)) {
715 return _backend.helpers.jsJavaScriptObjectClass; 715 return _backend.helpers.jsJavaScriptObjectClass;
716 } 716 }
717 ClassHierarchyNode hierarchy = _classHierarchyNodes[cls.declaration]; 717 ClassHierarchyNode hierarchy = _classHierarchyNodes[cls.declaration];
718 return hierarchy != null 718 return hierarchy != null
719 ? hierarchy.getLubOfInstantiatedSubclasses() 719 ? hierarchy.getLubOfInstantiatedSubclasses()
720 : null; 720 : null;
721 } 721 }
722 722
723 @override 723 @override
724 ClassElement getLubOfInstantiatedSubtypes(ClassElement cls) { 724 ClassElement getLubOfInstantiatedSubtypes(ClassElement cls) {
725 assert(isClosed); 725 assert(isClosed);
726 if (_backend.isJsInterop(cls)) { 726 if (_backend.nativeData.isJsInterop(cls)) {
727 return _backend.helpers.jsJavaScriptObjectClass; 727 return _backend.helpers.jsJavaScriptObjectClass;
728 } 728 }
729 ClassSet classSet = _classSets[cls.declaration]; 729 ClassSet classSet = _classSets[cls.declaration];
730 return classSet != null ? classSet.getLubOfInstantiatedSubtypes() : null; 730 return classSet != null ? classSet.getLubOfInstantiatedSubtypes() : null;
731 } 731 }
732 732
733 /// Returns an iterable over the common supertypes of the [classes]. 733 /// Returns an iterable over the common supertypes of the [classes].
734 Iterable<ClassElement> commonSupertypesOf(Iterable<ClassElement> classes) { 734 Iterable<ClassElement> commonSupertypesOf(Iterable<ClassElement> classes) {
735 assert(isClosed); 735 assert(isClosed);
736 Iterator<ClassElement> iterator = classes.iterator; 736 Iterator<ClassElement> iterator = classes.iterator;
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 void addFunctionCalledInLoop(Element element) { 1086 void addFunctionCalledInLoop(Element element) {
1087 functionsCalledInLoop.add(element.declaration); 1087 functionsCalledInLoop.add(element.declaration);
1088 } 1088 }
1089 1089
1090 bool isCalledInLoop(Element element) { 1090 bool isCalledInLoop(Element element) {
1091 return functionsCalledInLoop.contains(element.declaration); 1091 return functionsCalledInLoop.contains(element.declaration);
1092 } 1092 }
1093 1093
1094 bool fieldNeverChanges(MemberElement element) { 1094 bool fieldNeverChanges(MemberElement element) {
1095 if (!element.isField) return false; 1095 if (!element.isField) return false;
1096 if (_backend.isNative(element)) { 1096 if (_backend.nativeData.isNativeMember(element)) {
1097 // Some native fields are views of data that may be changed by operations. 1097 // Some native fields are views of data that may be changed by operations.
1098 // E.g. node.firstChild depends on parentNode.removeBefore(n1, n2). 1098 // E.g. node.firstChild depends on parentNode.removeBefore(n1, n2).
1099 // TODO(sra): Refine the effect classification so that native effects are 1099 // TODO(sra): Refine the effect classification so that native effects are
1100 // distinct from ordinary Dart effects. 1100 // distinct from ordinary Dart effects.
1101 return false; 1101 return false;
1102 } 1102 }
1103 1103
1104 if (element.isFinal || element.isConst) { 1104 if (element.isFinal || element.isConst) {
1105 return true; 1105 return true;
1106 } 1106 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 return getMightBePassedToApply(element.expression); 1187 return getMightBePassedToApply(element.expression);
1188 } 1188 }
1189 return functionsThatMightBePassedToApply.contains(element); 1189 return functionsThatMightBePassedToApply.contains(element);
1190 } 1190 }
1191 1191
1192 @override 1192 @override
1193 bool getCurrentlyKnownMightBePassedToApply(Element element) { 1193 bool getCurrentlyKnownMightBePassedToApply(Element element) {
1194 return getMightBePassedToApply(element); 1194 return getMightBePassedToApply(element);
1195 } 1195 }
1196 } 1196 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/universe/world_builder.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698