Split compileLoadedLibraries

- into computeClosedWorld, performGlobalTypeInference and generateJavaScriptCode
+ pass closed world and inference results directly
+ this prepares for (de)serialization after global inference

Change-Id: I1180de35eea78a107c9e95fc6e904084b63ba0f2
Reviewed-on: https://dart-review.googlesource.com/63943
Reviewed-by: Sigmund Cherem <sigmund@google.com>
diff --git a/pkg/compiler/lib/src/backend_strategy.dart b/pkg/compiler/lib/src/backend_strategy.dart
index be1764c..cced759 100644
--- a/pkg/compiler/lib/src/backend_strategy.dart
+++ b/pkg/compiler/lib/src/backend_strategy.dart
@@ -43,7 +43,8 @@
       SelectorConstraintsStrategy selectorConstraintsStrategy);
 
   /// Creates the [WorkItemBuilder] used by the codegen enqueuer.
-  WorkItemBuilder createCodegenWorkItemBuilder(JClosedWorld closedWorld);
+  WorkItemBuilder createCodegenWorkItemBuilder(JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults);
 
   /// Creates the [SsaBuilder] used for the element model.
   SsaBuilder createSsaBuilder(CompilerTask task, JavaScriptBackend backend,
diff --git a/pkg/compiler/lib/src/common/tasks.dart b/pkg/compiler/lib/src/common/tasks.dart
index 5c75e93..1da17a1 100644
--- a/pkg/compiler/lib/src/common/tasks.dart
+++ b/pkg/compiler/lib/src/common/tasks.dart
@@ -60,7 +60,7 @@
   /// Perform [action] and measure its runtime (including any asynchronous
   /// callbacks, such as, [Future.then], but excluding code measured by other
   /// tasks).
-  measure(action()) => _isDisabled ? action() : _measureZoned(action);
+  T measure<T>(T action()) => _isDisabled ? action() : _measureZoned(action);
 
   /// Helper method that starts measuring with this [CompilerTask], that is,
   /// make this task the currently measured task.
@@ -91,7 +91,7 @@
     measurer.currentTask = previous;
   }
 
-  _measureZoned(action()) {
+  T _measureZoned<T>(T action()) {
     // Using zones, we're able to track asynchronous operations correctly, as
     // our zone will be asked to invoke `then` blocks. Then blocks (the closure
     // passed to runZoned, and other closures) are run via the `run` functions
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 8f31433..4a5d8de 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -37,7 +37,8 @@
 import 'options.dart' show CompilerOptions, DiagnosticOptions;
 import 'ssa/nodes.dart' show HInstruction;
 import 'types/abstract_value_domain.dart' show AbstractValueStrategy;
-import 'types/types.dart' show GlobalTypeInferenceTask;
+import 'types/types.dart'
+    show GlobalTypeInferenceResults, GlobalTypeInferenceTask;
 import 'universe/selector.dart' show Selector;
 import 'universe/world_builder.dart'
     show ResolutionWorldBuilder, CodegenWorldBuilder;
@@ -312,106 +313,125 @@
     return resolutionEnqueuer;
   }
 
+  JClosedWorld computeClosedWorld(LibraryEntity rootLibrary) {
+    ResolutionEnqueuer resolutionEnqueuer = startResolution();
+    WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl();
+    FunctionEntity mainFunction =
+        frontendStrategy.computeMain(rootLibrary, mainImpact);
+
+    // In order to see if a library is deferred, we must compute the
+    // compile-time constants that are metadata.  This means adding
+    // something to the resolution queue.  So we cannot wait with
+    // this until after the resolution queue is processed.
+    deferredLoadTask.beforeResolution(rootLibrary);
+    impactStrategy = backend.createImpactStrategy(
+        supportDeferredLoad: deferredLoadTask.isProgramSplit,
+        supportDumpInfo: options.dumpInfo);
+
+    phase = PHASE_RESOLVING;
+    resolutionEnqueuer.applyImpact(mainImpact);
+    if (analyzeAll) {
+      libraryLoader.libraries.forEach((LibraryEntity library) {
+        reporter.log('Enqueuing ${library.canonicalUri}');
+        resolutionEnqueuer.applyImpact(computeImpactForLibrary(library));
+      });
+    } else if (options.analyzeMain) {
+      if (rootLibrary != null) {
+        resolutionEnqueuer.applyImpact(computeImpactForLibrary(rootLibrary));
+      }
+      if (librariesToAnalyzeWhenRun != null) {
+        for (Uri libraryUri in librariesToAnalyzeWhenRun) {
+          resolutionEnqueuer.applyImpact(
+              computeImpactForLibrary(libraryLoader.lookupLibrary(libraryUri)));
+        }
+      }
+    }
+    reporter.log('Resolving...');
+
+    processQueue(frontendStrategy.elementEnvironment, resolutionEnqueuer,
+        mainFunction, libraryLoader.libraries,
+        onProgress: showResolutionProgress);
+    backend.onResolutionEnd();
+    resolutionEnqueuer.logSummary(reporter.log);
+
+    _reporter.reportSuppressedMessagesSummary();
+
+    if (compilationFailed) {
+      if (!options.generateCodeWithCompileTimeErrors) {
+        return null;
+      }
+      if (mainFunction == null) return null;
+      if (!backend.enableCodegenWithErrorsIfSupported(NO_LOCATION_SPANNABLE)) {
+        return null;
+      }
+    }
+
+    if (options.analyzeOnly) return null;
+    assert(mainFunction != null);
+
+    JClosedWorld closedWorld = closeResolution(mainFunction);
+    backendClosedWorldForTesting = closedWorld;
+    return closedWorld;
+  }
+
+  GlobalTypeInferenceResults performGlobalTypeInference(
+      JClosedWorld closedWorld) {
+    FunctionEntity mainFunction = closedWorld.elementEnvironment.mainFunction;
+    reporter.log('Inferring types...');
+    InferredDataBuilder inferredDataBuilder = new InferredDataBuilderImpl();
+    backend.processAnnotations(closedWorld, inferredDataBuilder);
+    return globalInference.runGlobalTypeInference(
+        mainFunction, closedWorld, inferredDataBuilder);
+  }
+
+  Enqueuer generateJavaScriptCode(JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults) {
+    FunctionEntity mainFunction = closedWorld.elementEnvironment.mainFunction;
+    reporter.log('Compiling...');
+    phase = PHASE_COMPILING;
+
+    Enqueuer codegenEnqueuer =
+        startCodegen(closedWorld, globalInferenceResults);
+    if (compileAll) {
+      libraryLoader.libraries.forEach((LibraryEntity library) {
+        codegenEnqueuer.applyImpact(computeImpactForLibrary(library));
+      });
+    }
+    processQueue(closedWorld.elementEnvironment, codegenEnqueuer, mainFunction,
+        libraryLoader.libraries,
+        onProgress: showCodegenProgress);
+    codegenEnqueuer.logSummary(reporter.log);
+
+    int programSize = backend.assembleProgram(closedWorld);
+
+    if (options.dumpInfo) {
+      dumpInfoTask.reportSize(programSize);
+      dumpInfoTask.dumpInfo(closedWorld, globalInferenceResults);
+    }
+
+    backend.onCodegenEnd();
+
+    return codegenEnqueuer;
+  }
+
   /// Performs the compilation when all libraries have been loaded.
   void compileLoadedLibraries(LibraryEntity rootLibrary) =>
       selfTask.measureSubtask("Compiler.compileLoadedLibraries", () {
-        ResolutionEnqueuer resolutionEnqueuer = startResolution();
-        WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl();
-        FunctionEntity mainFunction =
-            frontendStrategy.computeMain(rootLibrary, mainImpact);
-
-        // In order to see if a library is deferred, we must compute the
-        // compile-time constants that are metadata.  This means adding
-        // something to the resolution queue.  So we cannot wait with
-        // this until after the resolution queue is processed.
-        deferredLoadTask.beforeResolution(rootLibrary);
-        impactStrategy = backend.createImpactStrategy(
-            supportDeferredLoad: deferredLoadTask.isProgramSplit,
-            supportDumpInfo: options.dumpInfo);
-
-        phase = PHASE_RESOLVING;
-        resolutionEnqueuer.applyImpact(mainImpact);
-        if (analyzeAll) {
-          libraryLoader.libraries.forEach((LibraryEntity library) {
-            reporter.log('Enqueuing ${library.canonicalUri}');
-            resolutionEnqueuer.applyImpact(computeImpactForLibrary(library));
-          });
-        } else if (options.analyzeMain) {
-          if (rootLibrary != null) {
-            resolutionEnqueuer
-                .applyImpact(computeImpactForLibrary(rootLibrary));
-          }
-          if (librariesToAnalyzeWhenRun != null) {
-            for (Uri libraryUri in librariesToAnalyzeWhenRun) {
-              resolutionEnqueuer.applyImpact(computeImpactForLibrary(
-                  libraryLoader.lookupLibrary(libraryUri)));
-            }
-          }
+        JClosedWorld closedWorld = computeClosedWorld(rootLibrary);
+        if (closedWorld != null) {
+          GlobalTypeInferenceResults globalInferenceResults =
+              performGlobalTypeInference(closedWorld);
+          if (stopAfterTypeInference) return;
+          Enqueuer codegenEnqueuer =
+              generateJavaScriptCode(closedWorld, globalInferenceResults);
+          checkQueues(enqueuer.resolution, codegenEnqueuer);
         }
-        reporter.log('Resolving...');
-
-        processQueue(frontendStrategy.elementEnvironment, resolutionEnqueuer,
-            mainFunction, libraryLoader.libraries,
-            onProgress: showResolutionProgress);
-        backend.onResolutionEnd();
-        resolutionEnqueuer.logSummary(reporter.log);
-
-        _reporter.reportSuppressedMessagesSummary();
-
-        if (compilationFailed) {
-          if (!options.generateCodeWithCompileTimeErrors) {
-            return;
-          }
-          if (mainFunction == null) return;
-          if (!backend
-              .enableCodegenWithErrorsIfSupported(NO_LOCATION_SPANNABLE)) {
-            return;
-          }
-        }
-
-        if (options.analyzeOnly) return;
-        assert(mainFunction != null);
-
-        JClosedWorld closedWorld = closeResolution(mainFunction);
-        backendClosedWorldForTesting = closedWorld;
-        mainFunction = closedWorld.elementEnvironment.mainFunction;
-
-        reporter.log('Inferring types...');
-        InferredDataBuilder inferredDataBuilder = new InferredDataBuilderImpl();
-        backend.processAnnotations(closedWorld, inferredDataBuilder);
-        globalInference.runGlobalTypeInference(
-            mainFunction, closedWorld, inferredDataBuilder);
-
-        if (stopAfterTypeInference) return;
-
-        reporter.log('Compiling...');
-        phase = PHASE_COMPILING;
-
-        Enqueuer codegenEnqueuer = startCodegen(closedWorld);
-        if (compileAll) {
-          libraryLoader.libraries.forEach((LibraryEntity library) {
-            codegenEnqueuer.applyImpact(computeImpactForLibrary(library));
-          });
-        }
-        processQueue(closedWorld.elementEnvironment, codegenEnqueuer,
-            mainFunction, libraryLoader.libraries,
-            onProgress: showCodegenProgress);
-        codegenEnqueuer.logSummary(reporter.log);
-
-        int programSize = backend.assembleProgram(closedWorld);
-
-        if (options.dumpInfo) {
-          dumpInfoTask.reportSize(programSize);
-          dumpInfoTask.dumpInfo(closedWorld);
-        }
-
-        backend.onCodegenEnd();
-
-        checkQueues(resolutionEnqueuer, codegenEnqueuer);
       });
 
-  Enqueuer startCodegen(JClosedWorld closedWorld) {
-    Enqueuer codegenEnqueuer = enqueuer.createCodegenEnqueuer(closedWorld);
+  Enqueuer startCodegen(JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults) {
+    Enqueuer codegenEnqueuer =
+        enqueuer.createCodegenEnqueuer(closedWorld, globalInferenceResults);
     _codegenWorldBuilder = codegenEnqueuer.worldBuilder;
     codegenEnqueuer.applyImpact(backend.onCodegenStart(
         closedWorld, _codegenWorldBuilder, backendStrategy.sorter));
diff --git a/pkg/compiler/lib/src/constants/constructors.dart b/pkg/compiler/lib/src/constants/constructors.dart
index 7924b20..e575b5a 100644
--- a/pkg/compiler/lib/src/constants/constructors.dart
+++ b/pkg/compiler/lib/src/constants/constructors.dart
@@ -195,8 +195,9 @@
       List<ConstantExpression> arguments, CallStructure callStructure) {
     NormalizedArguments args =
         new NormalizedArguments(defaultValues, callStructure, arguments);
-    InstanceData appliedInstanceData = GenerativeConstantConstructor
-        .applyInstanceData(environment, args, thisConstructorInvocation);
+    InstanceData appliedInstanceData =
+        GenerativeConstantConstructor.applyInstanceData(
+            environment, args, thisConstructorInvocation);
     return appliedInstanceData;
   }
 
diff --git a/pkg/compiler/lib/src/dump_info.dart b/pkg/compiler/lib/src/dump_info.dart
index 8a440d5..c118ad5 100644
--- a/pkg/compiler/lib/src/dump_info.dart
+++ b/pkg/compiler/lib/src/dump_info.dart
@@ -22,7 +22,10 @@
 import 'js_backend/js_backend.dart' show JavaScriptBackend;
 import 'types/abstract_value_domain.dart';
 import 'types/types.dart'
-    show GlobalTypeInferenceElementResult, GlobalTypeInferenceMemberResult;
+    show
+        GlobalTypeInferenceElementResult,
+        GlobalTypeInferenceMemberResult,
+        GlobalTypeInferenceResults;
 import 'universe/world_builder.dart' show CodegenWorldBuilder;
 import 'universe/world_impact.dart'
     show ImpactUseCase, WorldImpact, WorldImpactVisitorImpl;
@@ -31,6 +34,7 @@
 class ElementInfoCollector {
   final Compiler compiler;
   final JClosedWorld closedWorld;
+  final GlobalTypeInferenceResults _globalInferenceResults;
 
   ElementEnvironment get environment => closedWorld.elementEnvironment;
   CodegenWorldBuilder get codegenWorldBuilder => compiler.codegenWorldBuilder;
@@ -40,7 +44,8 @@
   final Map<ConstantValue, Info> _constantToInfo = <ConstantValue, Info>{};
   final Map<OutputUnit, OutputUnitInfo> _outputToInfo = {};
 
-  ElementInfoCollector(this.compiler, this.closedWorld);
+  ElementInfoCollector(
+      this.compiler, this.closedWorld, this._globalInferenceResults);
 
   void run() {
     compiler.dumpInfoTask._constantToNode.forEach((constant, node) {
@@ -105,10 +110,10 @@
   }
 
   GlobalTypeInferenceMemberResult _resultOfMember(MemberEntity e) =>
-      compiler.globalInference.results.resultOfMember(e);
+      _globalInferenceResults.resultOfMember(e);
 
   GlobalTypeInferenceElementResult _resultOfParameter(Local e) =>
-      compiler.globalInference.results.resultOfParameter(e);
+      _globalInferenceResults.resultOfParameter(e);
 
   FieldInfo visitField(FieldEntity field, {ClassEntity containingClass}) {
     var isInInstantiatedClass = false;
@@ -287,8 +292,8 @@
     String returnType = '${functionType.returnType}';
 
     String inferredReturnType = '${_resultOfMember(function).returnType}';
-    String sideEffects =
-        '${compiler.globalInference.inferredData.getSideEffectsOfElement(function)}';
+    String sideEffects = '${compiler.globalInference.inferredData
+        .getSideEffectsOfElement(function)}';
 
     int inlinedCount = compiler.dumpInfoTask.inlineCount[function];
     if (inlinedCount == null) inlinedCount = 0;
@@ -542,9 +547,12 @@
     return sb.toString();
   }
 
-  void dumpInfo(JClosedWorld closedWorld) {
+  void dumpInfo(JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults) {
     measure(() {
-      infoCollector = new ElementInfoCollector(compiler, closedWorld)..run();
+      infoCollector = new ElementInfoCollector(
+          compiler, closedWorld, globalInferenceResults)
+        ..run();
       StringBuffer jsonBuffer = new StringBuffer();
       dumpInfoJson(jsonBuffer, closedWorld);
       compiler.outputProvider.createOutputSink(
diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart
index c4b5b90c..c89e967 100644
--- a/pkg/compiler/lib/src/enqueue.dart
+++ b/pkg/compiler/lib/src/enqueue.dart
@@ -16,6 +16,7 @@
 import 'elements/entities.dart';
 import 'elements/types.dart';
 import 'js_backend/enqueuer.dart';
+import 'types/types.dart';
 import 'universe/world_builder.dart';
 import 'universe/use.dart'
     show
@@ -60,10 +61,11 @@
           ..onEmptyForTesting = compiler.onResolutionQueueEmptyForTesting;
   }
 
-  Enqueuer createCodegenEnqueuer(JClosedWorld closedWorld) {
-    return codegenEnqueuerForTesting = compiler.backend
-        .createCodegenEnqueuer(this, compiler, closedWorld)
-          ..onEmptyForTesting = compiler.onCodegenQueueEmptyForTesting;
+  Enqueuer createCodegenEnqueuer(JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults) {
+    return codegenEnqueuerForTesting = compiler.backend.createCodegenEnqueuer(
+        this, compiler, closedWorld, globalInferenceResults)
+      ..onEmptyForTesting = compiler.onCodegenQueueEmptyForTesting;
   }
 }
 
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 3b6fc65..5129e61 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -37,6 +37,7 @@
 import '../native/native.dart' as native;
 import '../ssa/ssa.dart' show SsaFunctionCompiler;
 import '../tracer.dart';
+import '../types/types.dart';
 import '../universe/call_structure.dart' show CallStructure;
 import '../universe/class_hierarchy.dart'
     show ClassHierarchyBuilder, ClassQueries;
@@ -72,7 +73,8 @@
   void onCodegenStart();
 
   /// Generates JavaScript code for `work.element`.
-  jsAst.Fun compile(CodegenWorkItem work, JClosedWorld closedWorld);
+  jsAst.Fun compile(CodegenWorkItem work, JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults);
 
   Iterable get tasks;
 }
@@ -635,7 +637,10 @@
 
   /// Creates an [Enqueuer] for code generation specific to this backend.
   CodegenEnqueuer createCodegenEnqueuer(
-      CompilerTask task, Compiler compiler, JClosedWorld closedWorld) {
+      CompilerTask task,
+      Compiler compiler,
+      JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults) {
     ElementEnvironment elementEnvironment = closedWorld.elementEnvironment;
     CommonElements commonElements = closedWorld.commonElements;
     BackendImpacts impacts =
@@ -661,7 +666,8 @@
             closedWorld.nativeData,
             closedWorld,
             compiler.abstractValueStrategy.createSelectorStrategy()),
-        compiler.backendStrategy.createCodegenWorkItemBuilder(closedWorld),
+        compiler.backendStrategy
+            .createCodegenWorkItemBuilder(closedWorld, globalInferenceResults),
         new CodegenEnqueuerListener(
             elementEnvironment,
             commonElements,
@@ -675,7 +681,8 @@
   static bool cacheCodegenImpactForTesting = false;
   Map<MemberEntity, WorldImpact> codegenImpactsForTesting;
 
-  WorldImpact codegen(CodegenWorkItem work, JClosedWorld closedWorld) {
+  WorldImpact codegen(CodegenWorkItem work, JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults) {
     MemberEntity element = work.element;
     if (compiler.elementHasCompileTimeError(element)) {
       DiagnosticMessage message =
@@ -696,7 +703,8 @@
       return const WorldImpact();
     }
 
-    jsAst.Fun function = functionCompiler.compile(work, closedWorld);
+    jsAst.Fun function =
+        functionCompiler.compile(work, closedWorld, globalInferenceResults);
     if (function != null) {
       if (function.sourceInformation == null) {
         function = function.withSourceInformation(
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
index 19692ba..b8f4d31 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
@@ -656,8 +656,8 @@
   buildMain(jsAst.Statement invokeMain) {
     List<jsAst.Statement> parts = <jsAst.Statement>[];
 
-    if (NativeGenerator
-        .needsIsolateAffinityTagInitialization(_closedWorld.backendUsage)) {
+    if (NativeGenerator.needsIsolateAffinityTagInitialization(
+        _closedWorld.backendUsage)) {
       parts.add(NativeGenerator.generateIsolateAffinityTagInitialization(
           _closedWorld.backendUsage, generateEmbeddedGlobalAccess, js("""
         // On V8, the 'intern' function converts a string to a symbol, which
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
index 2fc04b0..26ac418 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
@@ -1564,8 +1564,8 @@
 
     // The isolate-affinity tag must only be initialized once per program.
     if (fragment.isMainFragment &&
-        NativeGenerator
-            .needsIsolateAffinityTagInitialization(_closedWorld.backendUsage)) {
+        NativeGenerator.needsIsolateAffinityTagInitialization(
+            _closedWorld.backendUsage)) {
       statements.add(NativeGenerator.generateIsolateAffinityTagInitialization(
           _closedWorld.backendUsage, generateEmbeddedGlobalAccess, js.js("""
         // On V8, the 'intern' function converts a string to a symbol, which
diff --git a/pkg/compiler/lib/src/js_model/js_strategy.dart b/pkg/compiler/lib/src/js_model/js_strategy.dart
index 1ede50a..b0387d4 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -194,8 +194,10 @@
   }
 
   @override
-  WorkItemBuilder createCodegenWorkItemBuilder(JClosedWorld closedWorld) {
-    return new KernelCodegenWorkItemBuilder(_compiler.backend, closedWorld);
+  WorkItemBuilder createCodegenWorkItemBuilder(JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults) {
+    return new KernelCodegenWorkItemBuilder(
+        _compiler.backend, closedWorld, globalInferenceResults);
   }
 
   @override
diff --git a/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart b/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
index b77533f..09ecdca 100644
--- a/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
@@ -44,8 +44,10 @@
 class KernelCodegenWorkItemBuilder implements WorkItemBuilder {
   final JavaScriptBackend _backend;
   final JClosedWorld _closedWorld;
+  final GlobalTypeInferenceResults _globalInferenceResults;
 
-  KernelCodegenWorkItemBuilder(this._backend, this._closedWorld);
+  KernelCodegenWorkItemBuilder(
+      this._backend, this._closedWorld, this._globalInferenceResults);
 
   CompilerOptions get _options => _backend.compiler.options;
 
@@ -61,7 +63,8 @@
       }
     }
 
-    return new KernelCodegenWorkItem(_backend, _closedWorld, entity);
+    return new KernelCodegenWorkItem(
+        _backend, _closedWorld, _globalInferenceResults, entity);
   }
 }
 
@@ -70,14 +73,16 @@
   final JClosedWorld _closedWorld;
   final MemberEntity element;
   final CodegenRegistry registry;
+  final GlobalTypeInferenceResults _globalInferenceResults;
 
-  KernelCodegenWorkItem(this._backend, this._closedWorld, this.element)
+  KernelCodegenWorkItem(this._backend, this._closedWorld,
+      this._globalInferenceResults, this.element)
       : registry =
             new CodegenRegistry(_closedWorld.elementEnvironment, element);
 
   @override
   WorldImpact run() {
-    return _backend.codegen(this, _closedWorld);
+    return _backend.codegen(this, _closedWorld, _globalInferenceResults);
   }
 }
 
@@ -92,14 +97,15 @@
       this.task, this._compiler, this._elementMap, this._globalLocalsMap);
 
   @override
-  HGraph build(CodegenWorkItem work, JClosedWorld closedWorld) {
+  HGraph build(CodegenWorkItem work, JClosedWorld closedWorld,
+      GlobalTypeInferenceResults results) {
     return task.measure(() {
       KernelSsaGraphBuilder builder = new KernelSsaGraphBuilder(
           work.element,
           _elementMap.getMemberThisType(work.element),
           _compiler,
           _elementMap,
-          _compiler.globalInference.results,
+          results,
           _globalLocalsMap,
           closedWorld,
           _compiler.codegenWorldBuilder,
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 4254b73..a91f8ec 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -100,7 +100,7 @@
 
   final SourceInformationStrategy<ir.Node> _sourceInformationStrategy;
   final KernelToElementMapForBuilding _elementMap;
-  final GlobalTypeInferenceResults _globalInferenceResults;
+  final GlobalTypeInferenceResults globalInferenceResults;
   final GlobalLocalsMap _globalLocalsMap;
   LoopHandler<ir.Node> loopHandler;
   TypeBuilder typeBuilder;
@@ -123,19 +123,19 @@
   StackFrame _currentFrame;
 
   KernelSsaGraphBuilder(
-      this.initialTargetElement,
-      InterfaceType instanceType,
-      this.compiler,
-      this._elementMap,
-      this._globalInferenceResults,
-      this._globalLocalsMap,
-      this.closedWorld,
-      this._worldBuilder,
-      this.registry,
-      this.closureDataLookup,
-      this.nativeEmitter,
-      this._sourceInformationStrategy)
-      : this.targetElement = _effectiveTargetElementFor(initialTargetElement),
+    this.initialTargetElement,
+    InterfaceType instanceType,
+    this.compiler,
+    this._elementMap,
+    this.globalInferenceResults,
+    this._globalLocalsMap,
+    this.closedWorld,
+    this._worldBuilder,
+    this.registry,
+    this.closureDataLookup,
+    this.nativeEmitter,
+    this._sourceInformationStrategy,
+  )   : this.targetElement = _effectiveTargetElementFor(initialTargetElement),
         _infoReporter = compiler.dumpInfoTask,
         _allocatorAnalysis = closedWorld.allocatorAnalysis {
     _enterFrame(targetElement);
@@ -174,7 +174,7 @@
         member,
         asyncMarker,
         _globalLocalsMap.getLocalsMap(member),
-        new KernelToTypeInferenceMapImpl(member, _globalInferenceResults),
+        new KernelToTypeInferenceMapImpl(member, globalInferenceResults),
         _currentFrame != null
             ? _currentFrame.sourceInformationBuilder.forContext(member)
             : _sourceInformationStrategy.createBuilderForContext(member));
diff --git a/pkg/compiler/lib/src/ssa/graph_builder.dart b/pkg/compiler/lib/src/ssa/graph_builder.dart
index 78d0ccd..63525f5 100644
--- a/pkg/compiler/lib/src/ssa/graph_builder.dart
+++ b/pkg/compiler/lib/src/ssa/graph_builder.dart
@@ -67,8 +67,7 @@
 
   CodeEmitterTask get emitter => backend.emitter;
 
-  GlobalTypeInferenceResults get globalInferenceResults =>
-      compiler.globalInference.results;
+  GlobalTypeInferenceResults get globalInferenceResults;
 
   ClosureDataLookup get closureDataLookup =>
       compiler.backendStrategy.closureDataLookup;
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 0837246..17d701f 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -48,13 +48,12 @@
 
   Compiler get _compiler => _backend.compiler;
 
-  GlobalTypeInferenceResults get _results => _compiler.globalInference.results;
-
   CompilerOptions get _options => _compiler.options;
 
   RuntimeTypesSubstitutions get _rtiSubstitutions => _backend.rtiSubstitutions;
 
-  void optimize(CodegenWorkItem work, HGraph graph, JClosedWorld closedWorld) {
+  void optimize(CodegenWorkItem work, HGraph graph, JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults) {
     void runPhase(OptimizationPhase phase) {
       measureSubtask(phase.name, () => phase.visitGraph(graph));
       _backend.tracer.traceGraph(phase.name, graph);
@@ -70,31 +69,31 @@
       List<OptimizationPhase> phases = <OptimizationPhase>[
         // Run trivial instruction simplification first to optimize
         // some patterns useful for type conversion.
-        new SsaInstructionSimplifier(
-            _results, _options, _rtiSubstitutions, closedWorld, registry),
+        new SsaInstructionSimplifier(globalInferenceResults, _options,
+            _rtiSubstitutions, closedWorld, registry),
         new SsaTypeConversionInserter(closedWorld),
         new SsaRedundantPhiEliminator(),
         new SsaDeadPhiEliminator(),
-        new SsaTypePropagator(
-            _results, _options, closedWorld.commonElements, closedWorld),
+        new SsaTypePropagator(globalInferenceResults, _options,
+            closedWorld.commonElements, closedWorld),
         // After type propagation, more instructions can be
         // simplified.
-        new SsaInstructionSimplifier(
-            _results, _options, _rtiSubstitutions, closedWorld, registry),
+        new SsaInstructionSimplifier(globalInferenceResults, _options,
+            _rtiSubstitutions, closedWorld, registry),
         new SsaCheckInserter(trustPrimitives, closedWorld, boundsChecked),
-        new SsaInstructionSimplifier(
-            _results, _options, _rtiSubstitutions, closedWorld, registry),
+        new SsaInstructionSimplifier(globalInferenceResults, _options,
+            _rtiSubstitutions, closedWorld, registry),
         new SsaCheckInserter(trustPrimitives, closedWorld, boundsChecked),
-        new SsaTypePropagator(
-            _results, _options, closedWorld.commonElements, closedWorld),
+        new SsaTypePropagator(globalInferenceResults, _options,
+            closedWorld.commonElements, closedWorld),
         // Run a dead code eliminator before LICM because dead
         // interceptors are often in the way of LICM'able instructions.
         new SsaDeadCodeEliminator(closedWorld, this),
         new SsaGlobalValueNumberer(closedWorld.abstractValueDomain),
         // After GVN, some instructions might need their type to be
         // updated because they now have different inputs.
-        new SsaTypePropagator(
-            _results, _options, closedWorld.commonElements, closedWorld),
+        new SsaTypePropagator(globalInferenceResults, _options,
+            closedWorld.commonElements, closedWorld),
         codeMotion = new SsaCodeMotion(closedWorld.abstractValueDomain),
         loadElimination = new SsaLoadElimination(_compiler, closedWorld),
         new SsaRedundantPhiEliminator(),
@@ -103,13 +102,13 @@
         // controlled by a test on the value, so redo 'conversion insertion' to
         // learn from the refined type.
         new SsaTypeConversionInserter(closedWorld),
-        new SsaTypePropagator(
-            _results, _options, closedWorld.commonElements, closedWorld),
+        new SsaTypePropagator(globalInferenceResults, _options,
+            closedWorld.commonElements, closedWorld),
         new SsaValueRangeAnalyzer(closedWorld, this),
         // Previous optimizations may have generated new
         // opportunities for instruction simplification.
-        new SsaInstructionSimplifier(
-            _results, _options, _rtiSubstitutions, closedWorld, registry),
+        new SsaInstructionSimplifier(globalInferenceResults, _options,
+            _rtiSubstitutions, closedWorld, registry),
         new SsaCheckInserter(trustPrimitives, closedWorld, boundsChecked),
       ];
       phases.forEach(runPhase);
@@ -126,25 +125,25 @@
           dce.eliminatedSideEffects ||
           loadElimination.newGvnCandidates) {
         phases = <OptimizationPhase>[
-          new SsaTypePropagator(
-              _results, _options, closedWorld.commonElements, closedWorld),
+          new SsaTypePropagator(globalInferenceResults, _options,
+              closedWorld.commonElements, closedWorld),
           new SsaGlobalValueNumberer(closedWorld.abstractValueDomain),
           new SsaCodeMotion(closedWorld.abstractValueDomain),
           new SsaValueRangeAnalyzer(closedWorld, this),
-          new SsaInstructionSimplifier(
-              _results, _options, _rtiSubstitutions, closedWorld, registry),
+          new SsaInstructionSimplifier(globalInferenceResults, _options,
+              _rtiSubstitutions, closedWorld, registry),
           new SsaCheckInserter(trustPrimitives, closedWorld, boundsChecked),
           new SsaSimplifyInterceptors(closedWorld, work.element.enclosingClass),
           new SsaDeadCodeEliminator(closedWorld, this),
         ];
       } else {
         phases = <OptimizationPhase>[
-          new SsaTypePropagator(
-              _results, _options, closedWorld.commonElements, closedWorld),
+          new SsaTypePropagator(globalInferenceResults, _options,
+              closedWorld.commonElements, closedWorld),
           // Run the simplifier to remove unneeded type checks inserted by
           // type propagation.
-          new SsaInstructionSimplifier(
-              _results, _options, _rtiSubstitutions, closedWorld, registry),
+          new SsaInstructionSimplifier(globalInferenceResults, _options,
+              _rtiSubstitutions, closedWorld, registry),
         ];
       }
       phases.forEach(runPhase);
diff --git a/pkg/compiler/lib/src/ssa/ssa.dart b/pkg/compiler/lib/src/ssa/ssa.dart
index c006997..7ed9f68 100644
--- a/pkg/compiler/lib/src/ssa/ssa.dart
+++ b/pkg/compiler/lib/src/ssa/ssa.dart
@@ -11,6 +11,7 @@
 import '../io/source_information.dart';
 import '../js/js.dart' as js;
 import '../js_backend/backend.dart' show JavaScriptBackend, FunctionCompiler;
+import '../types/types.dart';
 import '../universe/call_structure.dart';
 import '../universe/use.dart';
 import '../world.dart' show JClosedWorld;
@@ -38,10 +39,11 @@
 
   /// Generates JavaScript code for `work.element`.
   /// Using the ssa builder, optimizer and codegenerator.
-  js.Fun compile(CodegenWorkItem work, JClosedWorld closedWorld) {
-    HGraph graph = _builder.build(work, closedWorld);
+  js.Fun compile(CodegenWorkItem work, JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults) {
+    HGraph graph = _builder.build(work, closedWorld, globalInferenceResults);
     if (graph == null) return null;
-    optimizer.optimize(work, graph, closedWorld);
+    optimizer.optimize(work, graph, closedWorld, globalInferenceResults);
     MemberEntity element = work.element;
     js.Expression result = generator.generateCode(work, graph, closedWorld);
     if (graph.needsAsyncRewrite) {
@@ -68,7 +70,8 @@
 abstract class SsaBuilder {
   /// Creates the [HGraph] for [work] or returns `null` if no code is needed
   /// for [work].
-  HGraph build(CodegenWorkItem work, JClosedWorld closedWorld);
+  HGraph build(CodegenWorkItem work, JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults);
 }
 
 class SsaBuilderTask extends CompilerTask {
@@ -88,8 +91,9 @@
 
   /// Creates the [HGraph] for [work] or returns `null` if no code is needed
   /// for [work].
-  HGraph build(CodegenWorkItem work, JClosedWorld closedWorld) {
-    return _builder.build(work, closedWorld);
+  HGraph build(CodegenWorkItem work, JClosedWorld closedWorld,
+      GlobalTypeInferenceResults globalInferenceResults) {
+    return _builder.build(work, closedWorld, globalInferenceResults);
   }
 }
 
diff --git a/pkg/compiler/lib/src/types/types.dart b/pkg/compiler/lib/src/types/types.dart
index b078b9a..98ad9a2 100644
--- a/pkg/compiler/lib/src/types/types.dart
+++ b/pkg/compiler/lib/src/types/types.dart
@@ -252,7 +252,7 @@
   /// accessed from outside this class for testing only.
   TypeGraphInferrer typesInferrerInternal;
 
-  GlobalTypeInferenceResults results;
+  GlobalTypeInferenceResults resultsForTesting;
 
   InferredData inferredData;
 
@@ -261,17 +261,20 @@
         super(compiler.measurer);
 
   /// Runs the global type-inference algorithm once.
-  void runGlobalTypeInference(FunctionEntity mainElement,
+  GlobalTypeInferenceResults runGlobalTypeInference(FunctionEntity mainElement,
       JClosedWorld closedWorld, InferredDataBuilder inferredDataBuilder) {
-    measure(() {
+    return measure(() {
       typesInferrerInternal ??= compiler.backendStrategy.createTypesInferrer(
           closedWorld, inferredDataBuilder,
           disableTypeInference: compiler.disableTypeInference);
       typesInferrerInternal.analyzeMain(mainElement);
       typesInferrerInternal.clear();
-      results = typesInferrerInternal.createResults();
+      GlobalTypeInferenceResults results =
+          typesInferrerInternal.createResults();
       closedWorld.noSuchMethodData.categorizeComplexImplementations(results);
       inferredData = inferredDataBuilder.close(closedWorld);
+      resultsForTesting = results;
+      return results;
     });
   }
 }
diff --git a/tests/compiler/dart2js/codegen/interceptor_test.dart b/tests/compiler/dart2js/codegen/interceptor_test.dart
index 3776d52..5b3be69 100644
--- a/tests/compiler/dart2js/codegen/interceptor_test.dart
+++ b/tests/compiler/dart2js/codegen/interceptor_test.dart
@@ -38,8 +38,8 @@
     // access.
     await compile(TEST_TWO, entry: 'foo', check: (String generated) {
       Expect.isFalse(generated.contains(r'a.get$length()'));
-      Expect
-          .isTrue(generated.contains(new RegExp(r'[$A-Z]+\.A\$\(\)\.length')));
+      Expect.isTrue(
+          generated.contains(new RegExp(r'[$A-Z]+\.A\$\(\)\.length')));
       Expect.isTrue(
           generated.contains(new RegExp(r'[$A-Z]+\.get\$length\$as\(a\)')));
     });
diff --git a/tests/compiler/dart2js/end_to_end/exit_code_test.dart b/tests/compiler/dart2js/end_to_end/exit_code_test.dart
index 7d543c7..49f7676 100644
--- a/tests/compiler/dart2js/end_to_end/exit_code_test.dart
+++ b/tests/compiler/dart2js/end_to_end/exit_code_test.dart
@@ -24,6 +24,7 @@
 import 'package:compiler/src/library_loader.dart';
 import 'package:compiler/src/null_compiler_output.dart';
 import 'package:compiler/src/options.dart' show CompilerOptions;
+import 'package:compiler/src/types/types.dart';
 import 'package:compiler/src/universe/world_impact.dart';
 import 'package:compiler/src/world.dart';
 import 'diagnostic_reporter_helper.dart';
@@ -113,9 +114,10 @@
             useNewSourceInfo: compiler.options.useNewSourceInfo);
 
   @override
-  WorldImpact codegen(CodegenWorkItem work, JClosedWorld closedWorld) {
+  WorldImpact codegen(CodegenWorkItem work, JClosedWorld closedWorld,
+      GlobalTypeInferenceResults results) {
     compiler.test('Compiler.codegen');
-    return super.codegen(work, closedWorld);
+    return super.codegen(work, closedWorld, results);
   }
 }
 
diff --git a/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart b/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart
index aaef4ea..20bf4c6 100644
--- a/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart
+++ b/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart
@@ -24,8 +24,8 @@
 
 main() {
   asyncTest(() async {
-    var env = await TypeEnvironment
-        .create(createTypedefs(existentialTypeData, additionalData: """
+    var env = await TypeEnvironment.create(
+        createTypedefs(existentialTypeData, additionalData: """
     class C1 {}
     class C2 {}
     class C3<T> {
@@ -39,7 +39,8 @@
     }
     void F11<Q extends C3<Q>>(Q q) {}
     void F12<P extends C3<P>>(P p) {}
-  """), options: [Flags.strongMode]);
+  """),
+        options: [Flags.strongMode]);
 
     testToString(FunctionType type, String expectedToString) {
       Expect.equals(expectedToString, type.toString());
diff --git a/tests/compiler/dart2js/inference/inference_test_helper.dart b/tests/compiler/dart2js/inference/inference_test_helper.dart
index 4788158..333688e 100644
--- a/tests/compiler/dart2js/inference/inference_test_helper.dart
+++ b/tests/compiler/dart2js/inference/inference_test_helper.dart
@@ -104,7 +104,7 @@
           elementMap,
           member,
           localsMap.getLocalsMap(member),
-          compiler.globalInference.results,
+          compiler.globalInference.resultsForTesting,
           backendStrategy.closureDataLookup as ClosureDataLookup<ir.Node>)
       .run(definition.node);
 }
diff --git a/tests/compiler/dart2js/inference/load_deferred_library_test.dart b/tests/compiler/dart2js/inference/load_deferred_library_test.dart
index df01c26..0bcafc9 100644
--- a/tests/compiler/dart2js/inference/load_deferred_library_test.dart
+++ b/tests/compiler/dart2js/inference/load_deferred_library_test.dart
@@ -60,7 +60,7 @@
   MemberDefinition definition =
       backendStrategy.elementMap.getMemberDefinition(loadDeferredLibrary);
   ir.Procedure procedure = definition.node;
-  typeMask = compiler.globalInference.results
+  typeMask = compiler.globalInference.resultsForTesting
       .resultOfParameter(localsMap
           .getLocalVariable(procedure.function.positionalParameters.first))
       .type;
diff --git a/tests/compiler/dart2js/model/subtype_test.dart b/tests/compiler/dart2js/model/subtype_test.dart
index 3f761876..3b99cb7 100644
--- a/tests/compiler/dart2js/model/subtype_test.dart
+++ b/tests/compiler/dart2js/model/subtype_test.dart
@@ -59,9 +59,8 @@
       // TODO(johnniwinther): Inheritance with different type arguments is
       // currently not supported by the implementation.
       class C<T1, T2> extends B<T2, T1> /*implements A<A<T1>>*/ {}
-      """,
-      options:
-          strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2]).then((env) {
+      """, options: strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2])
+      .then((env) {
     void expect(bool expectSubtype, DartType T, DartType S,
         {bool expectMoreSpecific}) {
       testTypes(env, T, S, expectSubtype, expectMoreSpecific);
@@ -313,9 +312,8 @@
         int m4(V v, U u) => null;
         void m5(V v, int i) => null;
       }
-      """,
-      options:
-          strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2]).then((env) {
+      """, options: strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2])
+      .then((env) {
     void expect(bool expectSubtype, DartType T, DartType S,
         {bool expectMoreSpecific}) {
       testTypes(env, T, S, expectSubtype, expectMoreSpecific);
@@ -363,15 +361,13 @@
 ];
 
 Future testFunctionSubtyping({bool strongMode}) async {
-  await TypeEnvironment
-      .create(createMethods(functionTypesData),
+  await TypeEnvironment.create(createMethods(functionTypesData),
           options: strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2])
       .then(functionSubtypingHelper);
 }
 
 Future testTypedefSubtyping({bool strongMode}) async {
-  await TypeEnvironment
-      .create(createTypedefs(functionTypesData),
+  await TypeEnvironment.create(createTypedefs(functionTypesData),
           options: strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2])
       .then(functionSubtypingHelper);
 }
@@ -449,15 +445,13 @@
 ];
 
 Future testFunctionSubtypingOptional({bool strongMode}) async {
-  await TypeEnvironment
-      .create(createMethods(optionalFunctionTypesData),
+  await TypeEnvironment.create(createMethods(optionalFunctionTypesData),
           options: strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2])
       .then((env) => functionSubtypingOptionalHelper(env, strongMode));
 }
 
 Future testTypedefSubtypingOptional({bool strongMode}) async {
-  await TypeEnvironment
-      .create(createTypedefs(optionalFunctionTypesData),
+  await TypeEnvironment.create(createTypedefs(optionalFunctionTypesData),
           options: strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2])
       .then((env) => functionSubtypingOptionalHelper(env, strongMode));
 }
@@ -523,15 +517,13 @@
 ];
 
 Future testFunctionSubtypingNamed({bool strongMode}) async {
-  await TypeEnvironment
-      .create(createMethods(namedFunctionTypesData),
+  await TypeEnvironment.create(createMethods(namedFunctionTypesData),
           options: strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2])
       .then((env) => functionSubtypingNamedHelper(env, strongMode));
 }
 
 Future testTypedefSubtypingNamed({bool strongMode}) async {
-  await TypeEnvironment
-      .create(createTypedefs(namedFunctionTypesData),
+  await TypeEnvironment.create(createTypedefs(namedFunctionTypesData),
           options: strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2])
       .then((env) => functionSubtypingNamedHelper(env, strongMode));
 }
@@ -584,9 +576,8 @@
       class H<T extends S, S extends T> {}
       class I<T extends S, S extends U, U extends T> {}
       class J<T extends S, S extends U, U extends S> {}
-      """,
-      options:
-          strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2]).then((env) {
+      """, options: strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2])
+      .then((env) {
     void expect(bool expectSubtype, DartType T, DartType S,
         {bool expectMoreSpecific}) {
       testTypes(env, T, S, expectSubtype, expectMoreSpecific);
@@ -810,9 +801,8 @@
       takeInt(int o) => null;
       takeVoid(void o) => null;
       takeObject(Object o) => null;
-      """,
-      options:
-          strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2]).then((env) {
+      """, options: strongMode ? [Flags.strongMode] : [Flags.noPreviewDart2])
+      .then((env) {
     void expect(bool expectSubtype, DartType T, DartType S) {
       Expect.equals(expectSubtype, env.isSubtype(T, S), '$T <: $S');
       if (expectSubtype) {
diff --git a/tests/compiler/dart2js/rti/data/subtype_named_args.dart b/tests/compiler/dart2js/rti/data/subtype_named_args.dart
index 452b820..f4fad6e3 100644
--- a/tests/compiler/dart2js/rti/data/subtype_named_args.dart
+++ b/tests/compiler/dart2js/rti/data/subtype_named_args.dart
@@ -59,8 +59,8 @@
   Expect.isTrue(({Object m, Object l, Object g}) {} is genericsFunc);
 
   Expect.isTrue(({A x, G y, mixFunc z, var v}) {} is dynamicFunc);
-  Expect
-      .isTrue(({int x, bool y, List<Map> z, classesFunc v}) {} is dynamicFunc);
+  Expect.isTrue(
+      ({int x, bool y, List<Map> z, classesFunc v}) {} is dynamicFunc);
 
   Expect.isTrue((
       {okWithClassesFunc_1 f1,
diff --git a/tests/compiler/dart2js/sourcemaps/helpers/source_map_validator_helper.dart b/tests/compiler/dart2js/sourcemaps/helpers/source_map_validator_helper.dart
index cc49c33..a0b6a5a 100644
--- a/tests/compiler/dart2js/sourcemaps/helpers/source_map_validator_helper.dart
+++ b/tests/compiler/dart2js/sourcemaps/helpers/source_map_validator_helper.dart
@@ -49,8 +49,8 @@
       //
       // Expect.isTrue(entry.column < target[line.line].length);
       Expect.isTrue(entry.column >= 0);
-      Expect
-          .isTrue(urlIndex == null || (urlIndex >= 0 && urlIndex < urlsLength));
+      Expect.isTrue(
+          urlIndex == null || (urlIndex >= 0 && urlIndex < urlsLength));
       Expect.isTrue(entry.sourceLine == null ||
           (entry.sourceLine >= 0 &&
               entry.sourceLine < sources[urlIndex].length));
diff --git a/tests/compiler/dart2js/sourcemaps/tools/diff_view.dart b/tests/compiler/dart2js/sourcemaps/tools/diff_view.dart
index ead452a..ea6456b 100644
--- a/tests/compiler/dart2js/sourcemaps/tools/diff_view.dart
+++ b/tests/compiler/dart2js/sourcemaps/tools/diff_view.dart
@@ -186,8 +186,8 @@
   }
 
   static AnnotatedOutput loadOutput(filename) {
-    AnnotatedOutput output = AnnotatedOutput
-        .fromJson(json.decode(new File(filename).readAsStringSync()));
+    AnnotatedOutput output = AnnotatedOutput.fromJson(
+        json.decode(new File(filename).readAsStringSync()));
     print('Output loaded from $filename');
     return output;
   }