anchor.diff:  import 'dart:io';
   
   import 'package:compiler/compiler_new.dart';
  +import 'package:compiler/src/apiimpl.dart';
  +import 'package:compiler/src/compiler.dart';
  +import 'package:compiler/src/kernel/task.dart';
  +import 'package:compiler/src/elements/elements.dart';
   import 'package:compiler/src/common.dart';
   import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
   import 'package:compiler/src/diagnostics/messages.dart'
  
positive.code: 
    await setup(entryUri);
  
    if (bench == 'scan') {
      Set<SourceFile> files = await scanReachableFiles(entryUri);
      // TODO(sigmund): consider replacing the warmup with instrumented snapshots.
      for (int i = 0; i < 10; i++) scanFiles(files);
    } else if (bench == 'parse') {
      Set<SourceFile> files = await scanReachableFiles(entryUri);
      // TODO(sigmund): consider replacing the warmup with instrumented snapshots.
      for (int i = 0; i < 10; i++) parseFiles(files);
    } else {
      print('unsupported bench-id: $bench. Please specify "scan" or "parse"');
      // TODO(sigmund): implement the remaining benchmarks.
      exit(1);
    }
  
    totalTimer.stop();
    report("total", totalTimer.elapsedMicroseconds);
  }
  
negative.code:   const _ParserOptions();
    bool get enableGenericMethodSyntax => true;
  }
  
  generateKernel(Uri entryUri) async {
    var timer = new Stopwatch()..start();
    var options = new CompilerOptions(
        entryPoint: entryUri,
        libraryRoot: _libraryRoot,
        packagesDiscoveryProvider: findPackages,
        platformConfigUri: _platformConfigUri,
        useKernel: true,
        verbose: false); // set to true to debug internal timings
    var inputProvider = new CompilerSourceFileProvider();
    var diagnosticHandler = new FormattingDiagnosticHandler(inputProvider)
      ..verbose = options.verbose;
    var compiler = new MyCompiler(inputProvider, diagnosticHandler, options);
    await compiler.run(entryUri);
    timer.stop();
    report("kernel_gen_e2e", timer.elapsedMicroseconds);
  }
  
  // We subclass compiler to skip phases and stop after creating kernel.
  class MyCompiler extends CompilerImpl {
    MyCompiler(CompilerInput provider, CompilerDiagnostics handler,
        CompilerOptions options)
        : super(provider, null, handler, options) {}
  
    /// Performs the compilation when all libraries have been loaded.
    void compileLoadedLibraries() =>
        selfTask.measureSubtask("KernelCompiler.compileLoadedLibraries", () {
          computeMain();
          mirrorUsageAnalyzerTask.analyzeUsage(mainApp);
  
          deferredLoadTask.beforeResolution(this);
          impactStrategy = backend.createImpactStrategy(
              supportDeferredLoad: deferredLoadTask.isProgramSplit,
              supportDumpInfo: options.dumpInfo,
              supportSerialization: serialization.supportSerialization);
  
          phase = Compiler.PHASE_RESOLVING;
  
          // Note: we enqueue everything in the program so we measure generating
          // kernel for the entire code, not just what's reachable from main.
          libraryLoader.libraries.forEach((LibraryElement library) {
            fullyEnqueueLibrary(library, enqueuer.resolution);
          });
  
          backend.enqueueHelpers(enqueuer.resolution, globalDependencies);
          resolveLibraryMetadata();
          reporter.log('Resolving...');
          processQueue(enqueuer.resolution, mainFunction);
          enqueuer.resolution.logSummary(reporter.log);
  
          (reporter as CompilerDiagnosticReporter)
              .reportSuppressedMessagesSummary();
  
          if (compilationFailed) {
            // TODO(sigmund): more diagnostics?
            print("compilation failed!");
            exit(1);
          }
  
          closeResolution();
          var program = (backend as dynamic).kernelTask.program;
          print('total libraries: ${program.libraries.length}');
        });
  }
  