Share inlining cache between members

Change-Id: I7dde30abcd585016efad664d65911101a213288f
Reviewed-on: https://dart-review.googlesource.com/75060
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/compiler/lib/src/js_model/js_strategy.dart b/pkg/compiler/lib/src/js_model/js_strategy.dart
index d32e931..3bcbcd7 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -1040,6 +1040,7 @@
   final Compiler _compiler;
   final JsToElementMap _elementMap;
   final GlobalLocalsMap _globalLocalsMap;
+  FunctionInlineCache _inlineCache;
 
   KernelSsaBuilder(
       this.task, this._compiler, this._elementMap, this._globalLocalsMap);
@@ -1047,6 +1048,7 @@
   @override
   HGraph build(CodegenWorkItem work, JClosedWorld closedWorld,
       GlobalTypeInferenceResults results) {
+    _inlineCache ??= new FunctionInlineCache(closedWorld.annotationsData);
     return task.measure(() {
       KernelSsaGraphBuilder builder = new KernelSsaGraphBuilder(
           work.element,
@@ -1060,7 +1062,8 @@
           work.registry,
           _compiler.backendStrategy.closureDataLookup,
           _compiler.backend.emitter.nativeEmitter,
-          _compiler.backend.sourceInformationStrategy);
+          _compiler.backend.sourceInformationStrategy,
+          _inlineCache);
       return builder.build();
     });
   }
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 089411d..7305936 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -126,22 +126,22 @@
   final FunctionInlineCache inlineCache;
 
   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.inlineCache)
+      : this.targetElement = _effectiveTargetElementFor(initialTargetElement),
         _infoReporter = compiler.dumpInfoTask,
-        _allocatorAnalysis = closedWorld.allocatorAnalysis,
-        inlineCache = new FunctionInlineCache(closedWorld.annotationsData) {
+        _allocatorAnalysis = closedWorld.allocatorAnalysis {
     _enterFrame(targetElement, null);
     this.loopHandler = new KernelLoopHandler(this);
     typeBuilder = new KernelTypeBuilder(this, _elementMap, _globalLocalsMap);