| 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 part of type_graph_inferrer; | 5 part of type_graph_inferrer; |
| 6 | 6 |
| 7 class ClosureTracerVisitor extends TracerVisitor { | 7 class ClosureTracerVisitor extends TracerVisitor { |
| 8 final FunctionElement tracedElement; | 8 final FunctionElement tracedElement; |
| 9 | 9 |
| 10 ClosureTracerVisitor(this.tracedElement, tracedType, inferrer) | 10 ClosureTracerVisitor(this.tracedElement, tracedType, inferrer) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 visitDynamicCallSiteTypeInformation(DynamicCallSiteTypeInformation info) { | 73 visitDynamicCallSiteTypeInformation(DynamicCallSiteTypeInformation info) { |
| 74 super.visitDynamicCallSiteTypeInformation(info); | 74 super.visitDynamicCallSiteTypeInformation(info); |
| 75 if (info.selector.isCall()) { | 75 if (info.selector.isCall()) { |
| 76 if (info.arguments.contains(currentUser) | 76 if (info.arguments.contains(currentUser) |
| 77 && !info.targets.every((element) => element.isFunction())) { | 77 && !info.targets.every((element) => element.isFunction())) { |
| 78 bailout('Passed to a closure'); | 78 bailout('Passed to a closure'); |
| 79 } else if (info.targets.any((element) => checkIfCurrentUser(element))) { | 79 } else if (info.targets.any((element) => checkIfCurrentUser(element))) { |
| 80 analyzeCall(info); | 80 analyzeCall(info); |
| 81 } | 81 } |
| 82 } else if (info.selector.isGetter() && |
| 83 info.selector.name == Compiler.CALL_OPERATOR_NAME) { |
| 84 // We are potentially tearing off ourself here |
| 85 addNewEscapeInformation(info); |
| 82 } | 86 } |
| 83 } | 87 } |
| 84 } | 88 } |
| 85 | 89 |
| 86 class StaticTearOffClosureTracerVisitor extends ClosureTracerVisitor { | 90 class StaticTearOffClosureTracerVisitor extends ClosureTracerVisitor { |
| 87 StaticTearOffClosureTracerVisitor(tracedElement, tracedType, inferrer) | 91 StaticTearOffClosureTracerVisitor(tracedElement, tracedType, inferrer) |
| 88 : super(tracedElement, tracedType, inferrer); | 92 : super(tracedElement, tracedType, inferrer); |
| 89 | 93 |
| 90 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { | 94 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { |
| 91 super.visitStaticCallSiteTypeInformation(info); | 95 super.visitStaticCallSiteTypeInformation(info); |
| 92 if (info.calledElement == tracedElement | 96 if (info.calledElement == tracedElement |
| 93 && info.selector != null | 97 && info.selector != null |
| 94 && info.selector.isGetter()) { | 98 && info.selector.isGetter()) { |
| 95 addNewEscapeInformation(info); | 99 addNewEscapeInformation(info); |
| 96 } | 100 } |
| 97 } | 101 } |
| 98 } | 102 } |
| OLD | NEW |