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

Side by Side Diff: pkg/compiler/lib/src/js_backend/enqueuer.dart

Issue 2729613004: Cleanup registration of closures (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.js.enqueue; 5 library dart2js.js.enqueue;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import '../common/codegen.dart' show CodegenWorkItem; 9 import '../common/codegen.dart' show CodegenWorkItem;
10 import '../common/tasks.dart' show CompilerTask; 10 import '../common/tasks.dart' show CompilerTask;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // any additional dependencies must be treated as global 136 // any additional dependencies must be treated as global
137 // dependencies. 137 // dependencies.
138 applyImpact(listener.registerInstantiatedClass(cls)); 138 applyImpact(listener.registerInstantiatedClass(cls));
139 } 139 }
140 if (useSet.contains(ClassUse.IMPLEMENTED)) { 140 if (useSet.contains(ClassUse.IMPLEMENTED)) {
141 applyImpact(listener.registerImplementedClass(cls)); 141 applyImpact(listener.registerImplementedClass(cls));
142 } 142 }
143 } 143 }
144 144
145 /// Callback for applying the use of a [member]. 145 /// Callback for applying the use of a [member].
146 void _applyMemberUse(Entity member, EnumSet<MemberUse> useSet) { 146 void _applyMemberUse(MemberEntity member, EnumSet<MemberUse> useSet) {
147 if (useSet.contains(MemberUse.NORMAL)) { 147 if (useSet.contains(MemberUse.NORMAL)) {
148 _addToWorkList(member); 148 _addToWorkList(member);
149 } 149 }
150 if (useSet.contains(MemberUse.CLOSURIZE_INSTANCE)) { 150 if (useSet.contains(MemberUse.CLOSURIZE_INSTANCE)) {
151 _registerClosurizedMember(member); 151 _registerClosurizedMember(member);
152 } 152 }
153 if (useSet.contains(MemberUse.CLOSURIZE_STATIC)) { 153 if (useSet.contains(MemberUse.CLOSURIZE_STATIC)) {
154 applyImpact(listener.registerGetOfStaticFunction()); 154 applyImpact(listener.registerGetOfStaticFunction());
155 } 155 }
156 } 156 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 202 }
203 203
204 void _registerIsCheck(ResolutionDartType type) { 204 void _registerIsCheck(ResolutionDartType type) {
205 type = _universe.registerIsCheck(type); 205 type = _universe.registerIsCheck(type);
206 // Even in checked mode, type annotations for return type and argument 206 // Even in checked mode, type annotations for return type and argument
207 // types do not imply type checks, so there should never be a check 207 // types do not imply type checks, so there should never be a check
208 // against the type variable of a typedef. 208 // against the type variable of a typedef.
209 assert(!type.isTypeVariable || !type.element.enclosingElement.isTypedef); 209 assert(!type.isTypeVariable || !type.element.enclosingElement.isTypedef);
210 } 210 }
211 211
212 void _registerClosurizedMember(TypedElement element) { 212 void _registerClosurizedMember(MemberElement element) {
213 assert(element.isInstanceMember); 213 assert(element.isInstanceMember);
214 if (element.type.containsTypeVariables) { 214 applyImpact(listener.registerClosurizedMember(element));
215 MemberElement member = element;
216 applyImpact(listener.registerClosureWithFreeTypeVariables(member));
217 }
218 applyImpact(listener.registerBoundClosure());
219 } 215 }
220 216
221 void forEach(void f(WorkItem work)) { 217 void forEach(void f(WorkItem work)) {
222 do { 218 do {
223 while (_queue.isNotEmpty) { 219 while (_queue.isNotEmpty) {
224 // TODO(johnniwinther): Find an optimal process order. 220 // TODO(johnniwinther): Find an optimal process order.
225 WorkItem work = _queue.removeLast(); 221 WorkItem work = _queue.removeLast();
226 if (!_processedEntities.contains(work.element)) { 222 if (!_processedEntities.contains(work.element)) {
227 strategy.processWorkItem(f, work); 223 strategy.processWorkItem(f, work);
228 // TODO(johnniwinther): Register the processed element here. This 224 // TODO(johnniwinther): Register the processed element here. This
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // code for checked setters. 277 // code for checked setters.
282 if (element.isField && element.isInstanceMember) { 278 if (element.isField && element.isInstanceMember) {
283 if (!_options.enableTypeAssertions || 279 if (!_options.enableTypeAssertions ||
284 element.enclosingElement.isClosure) { 280 element.enclosingElement.isClosure) {
285 return null; 281 return null;
286 } 282 }
287 } 283 }
288 return new CodegenWorkItem(_backend, element); 284 return new CodegenWorkItem(_backend, element);
289 } 285 }
290 } 286 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen_listener.dart ('k') | pkg/compiler/lib/src/js_backend/impact_transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698