| Index: lib/compiler/implementation/compiler.dart
|
| diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
|
| index b3f16992d4ebd9665157b472f113375c047ec38c..582d15d6b61e6372c04134fc1e7a6055371d5f74 100644
|
| --- a/lib/compiler/implementation/compiler.dart
|
| +++ b/lib/compiler/implementation/compiler.dart
|
| @@ -9,6 +9,11 @@
|
| */
|
| final bool REPORT_EXCESS_RESOLUTION = false;
|
|
|
| +/**
|
| + * If true, trace information on pass2 optimizations.
|
| + */
|
| +final bool REPORT_PASS2_OPTIMIZATIONS = false;
|
| +
|
| class WorkItem {
|
| final Element element;
|
| TreeElements resolutionTree;
|
| @@ -157,6 +162,7 @@ class Compiler implements DiagnosticListener {
|
| Backend backend;
|
| ConstantHandler constantHandler;
|
| EnqueueTask enqueuer;
|
| + int pass = 1;
|
|
|
| static final SourceString MAIN = const SourceString('main');
|
| static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod');
|
| @@ -410,6 +416,9 @@ class Compiler implements DiagnosticListener {
|
|
|
| log('Compiling...');
|
| processQueue(enqueuer.codegen, main);
|
| + log("Recompiling ${enqueuer.codegen.recompilationCandidates.length} "
|
| + "methods...");
|
| + processRecompilationQueue(enqueuer.codegen);
|
| log('Compiled ${codegenWorld.generatedCode.length} methods.');
|
|
|
| backend.assembleProgram();
|
| @@ -429,6 +438,22 @@ class Compiler implements DiagnosticListener {
|
| world.registerFieldClosureInvocations();
|
| }
|
|
|
| + processRecompilationQueue(Enqueuer world) {
|
| + pass = 2;
|
| + while (!world.recompilationCandidates.isEmpty()) {
|
| + WorkItem work = world.recompilationCandidates.next();
|
| + var oldCode = world.universe.generatedCode[work.element];
|
| + world.universe.generatedCode.remove(work.element);
|
| + withCurrentElement(work.element, () => work.run(this, world));
|
| + var newCode = world.universe.generatedCode[work.element];
|
| + if (REPORT_PASS2_OPTIMIZATIONS && newCode != oldCode) {
|
| + log("Pass 2 optimization:");
|
| + log("Before:\n$oldCode");
|
| + log("After:\n$newCode");
|
| + }
|
| + }
|
| + }
|
| +
|
| /**
|
| * Perform various checks of the queues. This includes checking that
|
| * the queues are empty (nothing was added after we stopped
|
| @@ -573,6 +598,7 @@ class Compiler implements DiagnosticListener {
|
| if (message.message.kind === MessageKind.METHOD_NOT_FOUND) return;
|
| }
|
| SourceSpan span = spanFromNode(node);
|
| +
|
| reportDiagnostic(span, "${magenta('warning:')} $message", false);
|
| }
|
|
|
|
|