| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library compiler.src.inferrer.closure_tracer; | 5 library compiler.src.inferrer.closure_tracer; |
| 6 | 6 |
| 7 import '../common/names.dart' show Names; | 7 import '../common/names.dart' show Names; |
| 8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../js_backend/backend_helpers.dart'; | 9 import '../js_backend/backend_helpers.dart'; |
| 10 import '../types/types.dart' show TypeMask; | 10 import '../types/types.dart' show TypeMask; |
| 11 import '../universe/selector.dart' show Selector; | 11 import '../universe/selector.dart' show Selector; |
| 12 import 'debug.dart' as debug; | 12 import 'debug.dart' as debug; |
| 13 import 'inferrer_engine.dart'; |
| 13 import 'node_tracer.dart'; | 14 import 'node_tracer.dart'; |
| 14 import 'type_graph_nodes.dart'; | 15 import 'type_graph_nodes.dart'; |
| 15 | 16 |
| 16 class ClosureTracerVisitor extends TracerVisitor<ApplyableTypeInformation> { | 17 class ClosureTracerVisitor extends TracerVisitor { |
| 17 final Iterable<FunctionElement> tracedElements; | 18 final Iterable<FunctionElement> tracedElements; |
| 18 final List<CallSiteTypeInformation> _callsToAnalyze = | 19 final List<CallSiteTypeInformation> _callsToAnalyze = |
| 19 new List<CallSiteTypeInformation>(); | 20 new List<CallSiteTypeInformation>(); |
| 20 | 21 |
| 21 ClosureTracerVisitor(this.tracedElements, tracedType, inferrer) | 22 ClosureTracerVisitor(this.tracedElements, ApplyableTypeInformation tracedType, |
| 23 InferrerEngine inferrer) |
| 22 : super(tracedType, inferrer); | 24 : super(tracedType, inferrer); |
| 23 | 25 |
| 26 ApplyableTypeInformation get tracedType => super.tracedType; |
| 27 |
| 24 void run() { | 28 void run() { |
| 25 analyze(); | 29 analyze(); |
| 26 if (!continueAnalyzing) return; | 30 if (!continueAnalyzing) return; |
| 27 _callsToAnalyze.forEach(_analyzeCall); | 31 _callsToAnalyze.forEach(_analyzeCall); |
| 28 for (FunctionElement e in tracedElements) { | 32 for (FunctionElement e in tracedElements) { |
| 29 e.functionSignature.forEachParameter((Element parameter) { | 33 e.functionSignature.forEachParameter((Element parameter) { |
| 30 ElementTypeInformation info = | 34 ElementTypeInformation info = |
| 31 inferrer.types.getInferredTypeOf(parameter); | 35 inferrer.types.getInferredTypeOf(parameter); |
| 32 info.disableInferenceForClosures = false; | 36 info.disableInferenceForClosures = false; |
| 33 }); | 37 }); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 @override | 130 @override |
| 127 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { | 131 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { |
| 128 super.visitStaticCallSiteTypeInformation(info); | 132 super.visitStaticCallSiteTypeInformation(info); |
| 129 if (info.calledElement == tracedElements.first && | 133 if (info.calledElement == tracedElements.first && |
| 130 info.selector != null && | 134 info.selector != null && |
| 131 info.selector.isGetter) { | 135 info.selector.isGetter) { |
| 132 addNewEscapeInformation(info); | 136 addNewEscapeInformation(info); |
| 133 } | 137 } |
| 134 } | 138 } |
| 135 } | 139 } |
| OLD | NEW |