| Index: lib/compiler/implementation/compiler.dart
|
| diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
|
| index 077728977bfaf55e1091c1fb3140c7e4f0d21939..63100c9a549f3a501caad2eae838d8d8506fe74c 100644
|
| --- a/lib/compiler/implementation/compiler.dart
|
| +++ b/lib/compiler/implementation/compiler.dart
|
| @@ -111,6 +111,8 @@ class Compiler implements DiagnosticListener {
|
| return f();
|
| } catch (CompilerCancelledException ex) {
|
| throw;
|
| + } catch (Pass2BailoutException ex) {
|
| + throw;
|
| } catch (var ex) {
|
| unhandledExceptionOnElement(element);
|
| throw;
|
| @@ -130,6 +132,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');
|
| @@ -381,6 +384,25 @@ class Compiler implements DiagnosticListener {
|
| withCurrentElement(work.element, () => work.run(this, world));
|
| }
|
| world.queueIsClosed = true;
|
| + log("Recompilation candidates queue length: "
|
| + "${world.recompilationCandidates.length}");
|
| + pass = 2;
|
| + while (!world.recompilationCandidates.isEmpty()) {
|
| + WorkItem work = world.recompilationCandidates.next();
|
| + var oldCode = world.universe.generatedCode[work.element];
|
| + world.universe.generatedCode.remove(work.element);
|
| + try {
|
| + withCurrentElement(work.element, () => work.run(this, world));
|
| + } catch (Pass2BailoutException ex) {
|
| + world.universe.generatedCode[work.element] = oldCode;
|
| + }
|
| + var newCode = world.universe.generatedCode[work.element];
|
| + if (newCode != oldCode) {
|
| + log("PASS 2 OPTIMIZATION:");
|
| + log("Before: $oldCode");
|
| + log("After: $newCode");
|
| + }
|
| + }
|
| assert(world.checkNoEnqueuedInvokedInstanceMethods());
|
| world.registerFieldClosureInvocations();
|
| }
|
| @@ -463,6 +485,7 @@ class Compiler implements DiagnosticListener {
|
| if (message.message.kind === MessageKind.METHOD_NOT_FOUND) return;
|
| }
|
| SourceSpan span = spanFromNode(node);
|
| +
|
| reportDiagnostic(span, "${magenta('warning:')} $message", false);
|
| }
|
|
|
| @@ -560,6 +583,15 @@ class CompilerCancelledException implements Exception {
|
| }
|
| }
|
|
|
| +class Pass2BailoutException implements Exception {
|
| + final String reason;
|
| + Pass2BailoutException(this.reason);
|
| +
|
| + String toString() {
|
| + return 'Pass 2 not supported: $reason';
|
| + }
|
| +}
|
| +
|
| class Tracer {
|
| final bool enabled = false;
|
|
|
|
|