OLD | NEW |
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 | 5 |
6 /** | 6 /** |
7 * If true, print a warning for each method that was resolved, but not | 7 * If true, print a warning for each method that was resolved, but not |
8 * compiled. | 8 * compiled. |
9 */ | 9 */ |
10 const bool REPORT_EXCESS_RESOLUTION = false; | 10 const bool REPORT_EXCESS_RESOLUTION = false; |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 log('Compiled ${codegenWorld.generatedCode.length} methods.'); | 504 log('Compiled ${codegenWorld.generatedCode.length} methods.'); |
505 | 505 |
506 if (compilationFailed) return; | 506 if (compilationFailed) return; |
507 | 507 |
508 backend.assembleProgram(); | 508 backend.assembleProgram(); |
509 | 509 |
510 checkQueues(); | 510 checkQueues(); |
511 } | 511 } |
512 | 512 |
513 void processQueue(Enqueuer world, Element main) { | 513 void processQueue(Enqueuer world, Element main) { |
514 backend.processNativeClasses(world, libraries.getValues()); | 514 backend.processNativeClasses(world, libraries.values); |
515 world.addToWorkList(main); | 515 world.addToWorkList(main); |
516 progress.reset(); | 516 progress.reset(); |
517 world.forEach((WorkItem work) { | 517 world.forEach((WorkItem work) { |
518 withCurrentElement(work.element, () => work.run(this, world)); | 518 withCurrentElement(work.element, () => work.run(this, world)); |
519 }); | 519 }); |
520 world.queueIsClosed = true; | 520 world.queueIsClosed = true; |
521 if (compilationFailed) return; | 521 if (compilationFailed) return; |
522 assert(world.checkNoEnqueuedInvokedInstanceMethods()); | 522 assert(world.checkNoEnqueuedInvokedInstanceMethods()); |
523 if (DUMP_INFERRED_TYPES && phase == PHASE_COMPILING) { | 523 if (DUMP_INFERRED_TYPES && phase == PHASE_COMPILING) { |
524 backend.dumpInferredTypes(); | 524 backend.dumpInferredTypes(); |
525 } | 525 } |
526 } | 526 } |
527 | 527 |
528 /** | 528 /** |
529 * Perform various checks of the queues. This includes checking that | 529 * Perform various checks of the queues. This includes checking that |
530 * the queues are empty (nothing was added after we stopped | 530 * the queues are empty (nothing was added after we stopped |
531 * processing the queues). Also compute the number of methods that | 531 * processing the queues). Also compute the number of methods that |
532 * were resolved, but not compiled (aka excess resolution). | 532 * were resolved, but not compiled (aka excess resolution). |
533 */ | 533 */ |
534 checkQueues() { | 534 checkQueues() { |
535 for (Enqueuer world in [enqueuer.resolution, enqueuer.codegen]) { | 535 for (Enqueuer world in [enqueuer.resolution, enqueuer.codegen]) { |
536 world.forEach((WorkItem work) { | 536 world.forEach((WorkItem work) { |
537 internalErrorOnElement(work.element, "Work list is not empty."); | 537 internalErrorOnElement(work.element, "Work list is not empty."); |
538 }); | 538 }); |
539 } | 539 } |
540 var resolved = new Set.from(enqueuer.resolution.resolvedElements.getKeys()); | 540 var resolved = new Set.from(enqueuer.resolution.resolvedElements.keys); |
541 for (Element e in codegenWorld.generatedCode.getKeys()) { | 541 for (Element e in codegenWorld.generatedCode.keys) { |
542 resolved.remove(e); | 542 resolved.remove(e); |
543 } | 543 } |
544 for (Element e in new Set.from(resolved)) { | 544 for (Element e in new Set.from(resolved)) { |
545 if (e.isClass() || | 545 if (e.isClass() || |
546 e.isField() || | 546 e.isField() || |
547 e.isTypeVariable() || | 547 e.isTypeVariable() || |
548 e.isTypedef() || | 548 e.isTypedef() || |
549 identical(e.kind, ElementKind.ABSTRACT_FIELD)) { | 549 identical(e.kind, ElementKind.ABSTRACT_FIELD)) { |
550 resolved.remove(e); | 550 resolved.remove(e); |
551 } | 551 } |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 861 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
862 // information on assertion errors. | 862 // information on assertion errors. |
863 if (condition is Function){ | 863 if (condition is Function){ |
864 condition = condition(); | 864 condition = condition(); |
865 } | 865 } |
866 if (!condition && message != null) { | 866 if (!condition && message != null) { |
867 print('assertion failed: $message'); | 867 print('assertion failed: $message'); |
868 } | 868 } |
869 return spannable != null && condition; | 869 return spannable != null && condition; |
870 } | 870 } |
OLD | NEW |