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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/enqueue.dart

Issue 12299008: Stop resolving all of js_helper unconditionally. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
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 part of dart2js; 5 part of dart2js;
6 6
7 class EnqueueTask extends CompilerTask { 7 class EnqueueTask extends CompilerTask {
8 final ResolutionEnqueuer resolution; 8 final ResolutionEnqueuer resolution;
9 final CodegenEnqueuer codegen; 9 final CodegenEnqueuer codegen;
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 if (element.isForeign(compiler)) return; 60 if (element.isForeign(compiler)) return;
61 61
62 if (!addElementToWorkList(element, elements)) return; 62 if (!addElementToWorkList(element, elements)) return;
63 63
64 // Enable runtime type support if we discover a getter called runtimeType. 64 // Enable runtime type support if we discover a getter called runtimeType.
65 // We have to enable runtime type before hitting the codegen, so 65 // We have to enable runtime type before hitting the codegen, so
66 // that constructors know whether they need to generate code for 66 // that constructors know whether they need to generate code for
67 // runtime type. 67 // runtime type.
68 if (element.isGetter() && element.name == Compiler.RUNTIME_TYPE) { 68 if (element.isGetter() && element.name == Compiler.RUNTIME_TYPE) {
69 compiler.enabledRuntimeType = true; 69 compiler.enabledRuntimeType = true;
70 compiler.backend.registerRuntimeType();
70 } else if (element == compiler.functionApplyMethod) { 71 } else if (element == compiler.functionApplyMethod) {
71 compiler.enabledFunctionApply = true; 72 compiler.enabledFunctionApply = true;
72 } else if (element == compiler.invokeOnMethod) { 73 } else if (element == compiler.invokeOnMethod) {
73 compiler.enabledInvokeOn = true; 74 compiler.enabledInvokeOn = true;
74 } 75 }
75 76
76 nativeEnqueuer.registerElement(element); 77 nativeEnqueuer.registerElement(element);
77 } 78 }
78 79
79 /** 80 /**
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 199
199 void processClass(ClassElement cls) { 200 void processClass(ClassElement cls) {
200 if (seenClasses.contains(cls)) return; 201 if (seenClasses.contains(cls)) return;
201 202
202 seenClasses.add(cls); 203 seenClasses.add(cls);
203 cls.ensureResolved(compiler); 204 cls.ensureResolved(compiler);
204 cls.implementation.forEachMember(processInstantiatedClassMember); 205 cls.implementation.forEachMember(processInstantiatedClassMember);
205 if (isResolutionQueue) { 206 if (isResolutionQueue) {
206 compiler.resolver.checkClass(cls); 207 compiler.resolver.checkClass(cls);
207 } 208 }
208
209 if (compiler.enableTypeAssertions) {
210 // We need to register is checks and helpers for checking
211 // assignments to fields.
212 // TODO(ngeoffray): This should really move to the backend.
213 cls.forEachLocalMember((Element member) {
214 if (!member.isInstanceMember() || !member.isField()) return;
215 DartType type = member.computeType(compiler);
216 registerIsCheck(type);
217 SourceString helper = compiler.backend.getCheckedModeHelper(type);
218 if (helper != null) {
219 Element helperElement = compiler.findHelper(helper);
220 registerStaticUse(helperElement);
221 }
222 });
223 }
224 } 209 }
225 processClass(cls); 210 processClass(cls);
226 for (Link<DartType> supertypes = cls.allSupertypes; 211 for (Link<DartType> supertypes = cls.allSupertypes;
227 !supertypes.isEmpty; supertypes = supertypes.tail) { 212 !supertypes.isEmpty; supertypes = supertypes.tail) {
228 processClass(supertypes.head.element); 213 processClass(supertypes.head.element);
229 } 214 }
230 }); 215 });
231 } 216 }
232 217
233 void registerNewSelector(SourceString name, 218 void registerNewSelector(SourceString name,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 void registerFieldGetter(Element element) { 342 void registerFieldGetter(Element element) {
358 universe.fieldGetters.add(element); 343 universe.fieldGetters.add(element);
359 } 344 }
360 345
361 void registerFieldSetter(Element element) { 346 void registerFieldSetter(Element element) {
362 universe.fieldSetters.add(element); 347 universe.fieldSetters.add(element);
363 } 348 }
364 349
365 void registerIsCheck(DartType type) { 350 void registerIsCheck(DartType type) {
366 universe.isChecks.add(type); 351 universe.isChecks.add(type);
352 compiler.backend.registerIsCheck(type, this);
367 } 353 }
368 354
369 void forEach(f(WorkItem work)); 355 void forEach(f(WorkItem work));
370 356
371 void logSummary(log(message)) { 357 void logSummary(log(message)) {
372 _logSpecificSummary(log); 358 _logSpecificSummary(log);
373 nativeEnqueuer.logSummary(log); 359 nativeEnqueuer.logSummary(log);
374 } 360 }
375 361
376 /// Log summary specific to the concrete enqueuer. 362 /// Log summary specific to the concrete enqueuer.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 while(!queue.isEmpty) { 520 while(!queue.isEmpty) {
535 // TODO(johnniwinther): Find an optimal process order for codegen. 521 // TODO(johnniwinther): Find an optimal process order for codegen.
536 f(queue.removeLast()); 522 f(queue.removeLast());
537 } 523 }
538 } 524 }
539 525
540 void _logSpecificSummary(log(message)) { 526 void _logSpecificSummary(log(message)) {
541 log('Compiled ${generatedCode.length} methods.'); 527 log('Compiled ${generatedCode.length} methods.');
542 } 528 }
543 } 529 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698