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

Side by Side Diff: dart/lib/compiler/implementation/compiler.dart

Issue 10408059: Move registering to the enqueuer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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 class WorkItem { 5 class WorkItem {
6 final Element element; 6 final Element element;
7 TreeElements resolutionTree; 7 TreeElements resolutionTree;
8 bool allowSpeculativeOptimization = true; 8 bool allowSpeculativeOptimization = true;
9 List<HTypeGuard> guards = const <HTypeGuard>[]; 9 List<HTypeGuard> guards = const <HTypeGuard>[];
10 10
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 log(exception.toString()); 233 log(exception.toString());
234 log('compilation failed'); 234 log('compilation failed');
235 return false; 235 return false;
236 } 236 }
237 tracer.close(); 237 tracer.close();
238 log('compilation succeeded'); 238 log('compilation succeeded');
239 return true; 239 return true;
240 } 240 }
241 241
242 void enableNoSuchMethod(Element element) { 242 void enableNoSuchMethod(Element element) {
243 // TODO(ahe): Move this method to Enqueuer.
243 if (enabledNoSuchMethod) return; 244 if (enabledNoSuchMethod) return;
244 if (element.enclosingElement == objectClass) return; 245 if (element.enclosingElement == objectClass) return;
245 enabledNoSuchMethod = true; 246 enabledNoSuchMethod = true;
246 enqueuer.codegen.registerInvocation(NO_SUCH_METHOD, 247 enqueuer.codegen.registerInvocation(NO_SUCH_METHOD,
247 new Selector.invocation(2)); 248 new Selector.invocation(2));
248 } 249 }
249 250
250 void enableIsolateSupport(LibraryElement element) { 251 void enableIsolateSupport(LibraryElement element) {
252 // TODO(ahe): Move this method to Enqueuer.
251 isolateLibrary = element; 253 isolateLibrary = element;
252 enqueuer.codegen.addToWorkList(element.find(START_ROOT_ISOLATE)); 254 enqueuer.codegen.addToWorkList(element.find(START_ROOT_ISOLATE));
253 } 255 }
254 256
255 bool hasIsolateSupport() => isolateLibrary !== null; 257 bool hasIsolateSupport() => isolateLibrary !== null;
256 258
257 void onLibraryLoaded(LibraryElement library, Uri uri) { 259 void onLibraryLoaded(LibraryElement library, Uri uri) {
258 if (uri.toString() == 'dart:isolate') { 260 if (uri.toString() == 'dart:isolate') {
259 enableIsolateSupport(library); 261 enableIsolateSupport(library);
260 } 262 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 if (work.element.kind.category == ElementCategory.VARIABLE) { 396 if (work.element.kind.category == ElementCategory.VARIABLE) {
395 constantHandler.compileWorkItem(work); 397 constantHandler.compileWorkItem(work);
396 return null; 398 return null;
397 } else { 399 } else {
398 String code = backend.codegen(work); 400 String code = backend.codegen(work);
399 codegenWorld.addGeneratedCode(work, code); 401 codegenWorld.addGeneratedCode(work, code);
400 return code; 402 return code;
401 } 403 }
402 } 404 }
403 405
404 void registerStaticUse(Element element) {
405 enqueuer.codegen.addToWorkList(element);
406 }
407
408 void registerGetOfStaticFunction(FunctionElement element) {
409 registerStaticUse(element);
410 codegenWorld.staticFunctionsNeedingGetter.add(element);
411 }
412
413 void registerDynamicInvocation(SourceString methodName, Selector selector) {
414 assert(selector !== null);
415 enqueuer.codegen.registerInvocation(methodName, selector);
416 }
417
418 void registerDynamicInvocationOf(Element element) {
419 enqueuer.codegen.addToWorkList(element);
420 }
421
422 void registerDynamicGetter(SourceString methodName, Selector selector) {
423 enqueuer.codegen.registerGetter(methodName, selector);
424 }
425
426 void registerDynamicSetter(SourceString methodName, Selector selector) {
427 enqueuer.codegen.registerSetter(methodName, selector);
428 }
429
430 void registerInstantiatedClass(ClassElement cls) { 406 void registerInstantiatedClass(ClassElement cls) {
407 enqueuer.resolution.registerInstantiatedClass(cls);
431 enqueuer.codegen.registerInstantiatedClass(cls); 408 enqueuer.codegen.registerInstantiatedClass(cls);
432 } 409 }
433 410
434 // TODO(ngeoffray): This should get a type.
435 void registerIsCheck(Element element) {
436 codegenWorld.isChecks.add(element);
437 }
438
439 void resolveClass(ClassElement element) { 411 void resolveClass(ClassElement element) {
440 withCurrentElement(element, () => resolver.resolveClass(element)); 412 withCurrentElement(element, () => resolver.resolveClass(element));
441 } 413 }
442 414
443 Type resolveTypeAnnotation(Element element, TypeAnnotation annotation) { 415 Type resolveTypeAnnotation(Element element, TypeAnnotation annotation) {
444 return resolver.resolveTypeAnnotation(element, annotation); 416 return resolver.resolveTypeAnnotation(element, annotation);
445 } 417 }
446 418
447 FunctionSignature resolveSignature(FunctionElement element) { 419 FunctionSignature resolveSignature(FunctionElement element) {
448 return withCurrentElement(element, 420 return withCurrentElement(element,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 } 558 }
587 } 559 }
588 560
589 class SourceSpan { 561 class SourceSpan {
590 final Uri uri; 562 final Uri uri;
591 final int begin; 563 final int begin;
592 final int end; 564 final int end;
593 565
594 const SourceSpan(this.uri, this.begin, this.end); 566 const SourceSpan(this.uri, this.begin, this.end);
595 } 567 }
OLDNEW
« no previous file with comments | « no previous file | dart/lib/compiler/implementation/enqueue.dart » ('j') | dart/lib/compiler/implementation/native_handler.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698