| 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.dart' show JavaScriptBackend; |
| 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 'inferrer_engine.dart'; |
| 14 import 'node_tracer.dart'; | 14 import 'node_tracer.dart'; |
| 15 import 'type_graph_nodes.dart'; | 15 import 'type_graph_nodes.dart'; |
| 16 | 16 |
| 17 class ClosureTracerVisitor extends TracerVisitor { | 17 class ClosureTracerVisitor extends TracerVisitor { |
| 18 final Iterable<FunctionElement> tracedElements; | 18 final Iterable<FunctionElement> tracedElements; |
| 19 final List<CallSiteTypeInformation> _callsToAnalyze = | 19 final List<CallSiteTypeInformation> _callsToAnalyze = |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 bailout('Passed to a closure'); | 72 bailout('Passed to a closure'); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 @override | 76 @override |
| 77 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { | 77 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { |
| 78 super.visitStaticCallSiteTypeInformation(info); | 78 super.visitStaticCallSiteTypeInformation(info); |
| 79 Element called = info.calledElement; | 79 Element called = info.calledElement; |
| 80 if (compiler.backend.isForeign(called)) { | 80 if (compiler.backend.isForeign(called)) { |
| 81 String name = called.name; | 81 String name = called.name; |
| 82 if (name == BackendHelpers.JS || name == 'DART_CLOSURE_TO_JS') { | 82 if (name == JavaScriptBackend.JS || name == 'DART_CLOSURE_TO_JS') { |
| 83 bailout('Used in JS ${info.call}'); | 83 bailout('Used in JS ${info.call}'); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 if (called.isGetter && | 86 if (called.isGetter && |
| 87 info.selector != null && | 87 info.selector != null && |
| 88 info.selector.isCall && | 88 info.selector.isCall && |
| 89 inferrer.types.getInferredTypeOf(called) == currentUser) { | 89 inferrer.types.getInferredTypeOf(called) == currentUser) { |
| 90 // This node can be a closure call as well. For example, `foo()` | 90 // This node can be a closure call as well. For example, `foo()` |
| 91 // where `foo` is a getter. | 91 // where `foo` is a getter. |
| 92 _registerCallForLaterAnalysis(info); | 92 _registerCallForLaterAnalysis(info); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 @override | 135 @override |
| 136 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { | 136 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { |
| 137 super.visitStaticCallSiteTypeInformation(info); | 137 super.visitStaticCallSiteTypeInformation(info); |
| 138 if (info.calledElement == tracedElements.first && | 138 if (info.calledElement == tracedElements.first && |
| 139 info.selector != null && | 139 info.selector != null && |
| 140 info.selector.isGetter) { | 140 info.selector.isGetter) { |
| 141 addNewEscapeInformation(info); | 141 addNewEscapeInformation(info); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 } | 144 } |
| OLD | NEW |