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

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

Issue 2646733006: Use entities in native_emitter.dart (Closed)
Patch Set: Updated cf. comments. Created 3 years, 11 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/ssa/codegen.dart ('k') | no next file » | 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 universe; 5 library universe;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import '../cache_strategy.dart'; 9 import '../cache_strategy.dart';
10 import '../common.dart'; 10 import '../common.dart';
11 import '../common/backend_api.dart' show Backend; 11 import '../common/backend_api.dart' show Backend;
12 import '../common/names.dart' show Identifiers; 12 import '../common/names.dart' show Identifiers;
13 import '../common/resolution.dart' show Resolution; 13 import '../common/resolution.dart' show Resolution;
14 import '../compiler.dart' show Compiler; 14 import '../compiler.dart' show Compiler;
15 import '../core_types.dart'; 15 import '../core_types.dart';
16 import '../elements/resolution_types.dart';
17 import '../elements/elements.dart'; 16 import '../elements/elements.dart';
18 import '../elements/entities.dart'; 17 import '../elements/entities.dart';
18 import '../elements/resolution_types.dart';
19 import '../elements/types.dart';
19 import '../universe/class_set.dart'; 20 import '../universe/class_set.dart';
20 import '../universe/function_set.dart' show FunctionSetBuilder; 21 import '../universe/function_set.dart' show FunctionSetBuilder;
21 import '../util/enumset.dart'; 22 import '../util/enumset.dart';
22 import '../util/util.dart'; 23 import '../util/util.dart';
23 import '../world.dart' show World, ClosedWorld, ClosedWorldImpl, OpenWorld; 24 import '../world.dart' show World, ClosedWorld, ClosedWorldImpl, OpenWorld;
24 import 'call_structure.dart' show CallStructure; 25 import 'call_structure.dart' show CallStructure;
25 import 'selector.dart' show Selector; 26 import 'selector.dart' show Selector;
26 import 'use.dart' show DynamicUse, DynamicUseKind, StaticUse, StaticUseKind; 27 import 'use.dart' show DynamicUse, DynamicUseKind, StaticUse, StaticUseKind;
27 28
28 /// The known constraint on receiver for a dynamic call site. 29 /// The known constraint on receiver for a dynamic call site.
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 abstract class CodegenWorldBuilder implements WorldBuilder { 1107 abstract class CodegenWorldBuilder implements WorldBuilder {
1107 /// Opens this world builder using [closedWorld] as the known superset of 1108 /// Opens this world builder using [closedWorld] as the known superset of
1108 /// possible runtime entities. 1109 /// possible runtime entities.
1109 void open(ClosedWorld closedWorld); 1110 void open(ClosedWorld closedWorld);
1110 1111
1111 /// Calls [f] with every instance field, together with its declarer, in an 1112 /// Calls [f] with every instance field, together with its declarer, in an
1112 /// instance of [cls]. 1113 /// instance of [cls].
1113 void forEachInstanceField( 1114 void forEachInstanceField(
1114 ClassEntity cls, void f(ClassEntity declarer, FieldEntity field)); 1115 ClassEntity cls, void f(ClassEntity declarer, FieldEntity field));
1115 1116
1117 /// Calls [f] for each parameter of [function] providing the type and name of
1118 /// the parameter.
1119 void forEachParameter(
1120 FunctionEntity function, void f(DartType type, String name));
1121
1116 void forEachInvokedName( 1122 void forEachInvokedName(
1117 f(String name, Map<Selector, SelectorConstraints> selectors)); 1123 f(String name, Map<Selector, SelectorConstraints> selectors));
1118 1124
1119 void forEachInvokedGetter( 1125 void forEachInvokedGetter(
1120 f(String name, Map<Selector, SelectorConstraints> selectors)); 1126 f(String name, Map<Selector, SelectorConstraints> selectors));
1121 1127
1122 void forEachInvokedSetter( 1128 void forEachInvokedSetter(
1123 f(String name, Map<Selector, SelectorConstraints> selectors)); 1129 f(String name, Map<Selector, SelectorConstraints> selectors));
1124 1130
1125 /// Returns `true` if [member] is invoked as a setter. 1131 /// Returns `true` if [member] is invoked as a setter.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 } 1233 }
1228 1234
1229 /// Calls [f] with every instance field, together with its declarer, in an 1235 /// Calls [f] with every instance field, together with its declarer, in an
1230 /// instance of [cls]. 1236 /// instance of [cls].
1231 void forEachInstanceField( 1237 void forEachInstanceField(
1232 ClassElement cls, void f(ClassEntity declarer, FieldEntity field)) { 1238 ClassElement cls, void f(ClassEntity declarer, FieldEntity field)) {
1233 cls.implementation 1239 cls.implementation
1234 .forEachInstanceField(f, includeSuperAndInjectedMembers: true); 1240 .forEachInstanceField(f, includeSuperAndInjectedMembers: true);
1235 } 1241 }
1236 1242
1243 @override
1244 void forEachParameter(
1245 MethodElement function, void f(DartType type, String name)) {
1246 FunctionSignature parameters = function.functionSignature;
1247 parameters.forEachParameter((ParameterElement parameter) {
1248 f(parameter.type, parameter.name);
1249 });
1250 }
1251
1237 Iterable<ClassElement> get processedClasses => _processedClasses.keys 1252 Iterable<ClassElement> get processedClasses => _processedClasses.keys
1238 .where((cls) => _processedClasses[cls].isInstantiated); 1253 .where((cls) => _processedClasses[cls].isInstantiated);
1239 1254
1240 /// All directly instantiated classes, that is, classes with a generative 1255 /// All directly instantiated classes, that is, classes with a generative
1241 /// constructor that has been called directly and not only through a 1256 /// constructor that has been called directly and not only through a
1242 /// super-call. 1257 /// super-call.
1243 // TODO(johnniwinther): Improve semantic precision. 1258 // TODO(johnniwinther): Improve semantic precision.
1244 Iterable<ClassElement> get directlyInstantiatedClasses { 1259 Iterable<ClassElement> get directlyInstantiatedClasses {
1245 return _directlyInstantiatedClasses; 1260 return _directlyInstantiatedClasses;
1246 } 1261 }
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 @override 1982 @override
1968 EnumSet<MemberUse> get _originalUse => MemberUses.ALL_STATIC; 1983 EnumSet<MemberUse> get _originalUse => MemberUses.ALL_STATIC;
1969 } 1984 }
1970 1985
1971 void removeFromSet(Map<String, Set<_MemberUsage>> map, Element element) { 1986 void removeFromSet(Map<String, Set<_MemberUsage>> map, Element element) {
1972 Set<_MemberUsage> set = map[element.name]; 1987 Set<_MemberUsage> set = map[element.name];
1973 if (set == null) return; 1988 if (set == null) return;
1974 set.removeAll( 1989 set.removeAll(
1975 set.where((_MemberUsage usage) => usage.entity == element).toList()); 1990 set.where((_MemberUsage usage) => usage.entity == element).toList());
1976 } 1991 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698