| 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; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 if (_checkIfFunctionApply(called) && | 93 if (_checkIfFunctionApply(called) && |
| 94 info.arguments != null && | 94 info.arguments != null && |
| 95 info.arguments.contains(currentUser)) { | 95 info.arguments.contains(currentUser)) { |
| 96 _tagAsFunctionApplyTarget("static call"); | 96 _tagAsFunctionApplyTarget("static call"); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool _checkIfCurrentUser(element) => | 100 bool _checkIfCurrentUser(element) => |
| 101 inferrer.types.getInferredTypeOf(element) == currentUser; | 101 inferrer.types.getInferredTypeOf(element) == currentUser; |
| 102 | 102 |
| 103 bool _checkIfFunctionApply(element) => | 103 bool _checkIfFunctionApply(Element element) { |
| 104 compiler.commonElements.isFunctionApplyMethod(element); | 104 return element is MemberElement && |
| 105 compiler.commonElements.isFunctionApplyMethod(element); |
| 106 } |
| 105 | 107 |
| 106 @override | 108 @override |
| 107 visitDynamicCallSiteTypeInformation(DynamicCallSiteTypeInformation info) { | 109 visitDynamicCallSiteTypeInformation(DynamicCallSiteTypeInformation info) { |
| 108 super.visitDynamicCallSiteTypeInformation(info); | 110 super.visitDynamicCallSiteTypeInformation(info); |
| 109 if (info.selector.isCall) { | 111 if (info.selector.isCall) { |
| 110 if (info.arguments.contains(currentUser)) { | 112 if (info.arguments.contains(currentUser)) { |
| 111 if (!info.targets.every((element) => element.isFunction)) { | 113 if (!info.targets.every((element) => element.isFunction)) { |
| 112 bailout('Passed to a closure'); | 114 bailout('Passed to a closure'); |
| 113 } | 115 } |
| 114 if (info.targets.any(_checkIfFunctionApply)) { | 116 if (info.targets.any(_checkIfFunctionApply)) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 132 @override | 134 @override |
| 133 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { | 135 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { |
| 134 super.visitStaticCallSiteTypeInformation(info); | 136 super.visitStaticCallSiteTypeInformation(info); |
| 135 if (info.calledElement == tracedElements.first && | 137 if (info.calledElement == tracedElements.first && |
| 136 info.selector != null && | 138 info.selector != null && |
| 137 info.selector.isGetter) { | 139 info.selector.isGetter) { |
| 138 addNewEscapeInformation(info); | 140 addNewEscapeInformation(info); |
| 139 } | 141 } |
| 140 } | 142 } |
| 141 } | 143 } |
| OLD | NEW |