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

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

Issue 2563623002: Merge _applyMemberUse and _applyStaticMemberUse in ResolutionEnqueuer (Closed)
Patch Set: Created 4 years 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 | « no previous file | pkg/compiler/lib/src/universe/world_builder.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.enqueue; 5 library dart2js.enqueue;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import 'cache_strategy.dart'; 9 import 'cache_strategy.dart';
10 import 'common/backend_api.dart' show Backend; 10 import 'common/backend_api.dart' show Backend;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 'Unenqueued use of $member: ${useSet.iterable(MemberUse.values)}'); 217 'Unenqueued use of $member: ${useSet.iterable(MemberUse.values)}');
218 } 218 }
219 }); 219 });
220 } 220 }
221 221
222 /// Callback for applying the use of a [member]. 222 /// Callback for applying the use of a [member].
223 void _applyMemberUse(Entity member, EnumSet<MemberUse> useSet) { 223 void _applyMemberUse(Entity member, EnumSet<MemberUse> useSet) {
224 if (useSet.contains(MemberUse.NORMAL)) { 224 if (useSet.contains(MemberUse.NORMAL)) {
225 _addToWorkList(member); 225 _addToWorkList(member);
226 } 226 }
227 if (useSet.contains(MemberUse.CLOSURIZE)) { 227 if (useSet.contains(MemberUse.CLOSURIZE_INSTANCE)) {
228 _registerClosurizedMember(member); 228 _registerClosurizedMember(member);
229 } 229 }
230 if (useSet.contains(MemberUse.CLOSURIZE_STATIC)) {
231 applyImpact(backend.registerGetOfStaticFunction());
232 }
230 } 233 }
231 234
232 /// Callback for applying the use of a [cls]. 235 /// Callback for applying the use of a [cls].
233 void _applyClassUse(ClassEntity cls, EnumSet<ClassUse> useSet) { 236 void _applyClassUse(ClassEntity cls, EnumSet<ClassUse> useSet) {
234 if (useSet.contains(ClassUse.INSTANTIATED)) { 237 if (useSet.contains(ClassUse.INSTANTIATED)) {
235 _recentClasses.add(cls); 238 _recentClasses.add(cls);
236 _universe.processClassMembers(cls, _applyMemberUse); 239 _universe.processClassMembers(cls, _applyMemberUse);
237 // We only tell the backend once that [cls] was instantiated, so 240 // We only tell the backend once that [cls] was instantiated, so
238 // any additional dependencies must be treated as global 241 // any additional dependencies must be treated as global
239 // dependencies. 242 // dependencies.
240 applyImpact(backend.registerInstantiatedClass(cls, forResolution: true)); 243 applyImpact(backend.registerInstantiatedClass(cls, forResolution: true));
241 } 244 }
242 if (useSet.contains(ClassUse.IMPLEMENTED)) { 245 if (useSet.contains(ClassUse.IMPLEMENTED)) {
243 applyImpact(backend.registerImplementedClass(cls, forResolution: true)); 246 applyImpact(backend.registerImplementedClass(cls, forResolution: true));
244 } 247 }
245 } 248 }
246 249
247 void processDynamicUse(DynamicUse dynamicUse) { 250 void processDynamicUse(DynamicUse dynamicUse) {
248 task.measure(() { 251 task.measure(() {
249 _universe.registerDynamicUse(dynamicUse, _applyMemberUse); 252 _universe.registerDynamicUse(dynamicUse, _applyMemberUse);
250 }); 253 });
251 } 254 }
252 255
253 /// Callback for applying the use of a [member].
254 void _applyStaticMemberUse(Entity member, EnumSet<MemberUse> useSet) {
255 if (useSet.contains(MemberUse.NORMAL)) {
256 _addToWorkList(member);
257 }
258 if (useSet.contains(MemberUse.CLOSURIZE)) {
259 applyImpact(backend.registerGetOfStaticFunction());
260 }
261 }
262
263 void processStaticUse(StaticUse staticUse) { 256 void processStaticUse(StaticUse staticUse) {
264 _universe.registerStaticUse(staticUse, _applyStaticMemberUse); 257 _universe.registerStaticUse(staticUse, _applyMemberUse);
265 // TODO(johnniwinther): Add `ResolutionWorldBuilder.registerConstructorUse` 258 // TODO(johnniwinther): Add `ResolutionWorldBuilder.registerConstructorUse`
266 // for these: 259 // for these:
267 switch (staticUse.kind) { 260 switch (staticUse.kind) {
268 case StaticUseKind.CONSTRUCTOR_INVOKE: 261 case StaticUseKind.CONSTRUCTOR_INVOKE:
269 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: 262 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
270 _registerInstantiatedType(staticUse.type, 263 _registerInstantiatedType(staticUse.type,
271 constructor: staticUse.element, globalDependency: false); 264 constructor: staticUse.element, globalDependency: false);
272 break; 265 break;
273 case StaticUseKind.REDIRECTION: 266 case StaticUseKind.REDIRECTION:
274 _registerInstantiatedType(staticUse.type, 267 _registerInstantiatedType(staticUse.type,
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 } 521 }
529 522
530 typedef void _DeferredActionFunction(); 523 typedef void _DeferredActionFunction();
531 524
532 class _DeferredAction { 525 class _DeferredAction {
533 final Element element; 526 final Element element;
534 final _DeferredActionFunction action; 527 final _DeferredActionFunction action;
535 528
536 _DeferredAction(this.element, this.action); 529 _DeferredAction(this.element, this.action);
537 } 530 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/universe/world_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698