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.node_tracer; | 5 library compiler.src.inferrer.node_tracer; |
6 | 6 |
7 import '../common/names.dart' show Identifiers; | 7 import '../common/names.dart' show Identifiers; |
8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../elements/entities.dart'; | 10 import '../elements/entities.dart'; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 void visitStringLiteralTypeInformation(StringLiteralTypeInformation info) {} | 202 void visitStringLiteralTypeInformation(StringLiteralTypeInformation info) {} |
203 | 203 |
204 void visitBoolLiteralTypeInformation(BoolLiteralTypeInformation info) {} | 204 void visitBoolLiteralTypeInformation(BoolLiteralTypeInformation info) {} |
205 | 205 |
206 void visitClosureTypeInformation(ClosureTypeInformation info) {} | 206 void visitClosureTypeInformation(ClosureTypeInformation info) {} |
207 | 207 |
208 void visitClosureCallSiteTypeInformation( | 208 void visitClosureCallSiteTypeInformation( |
209 ClosureCallSiteTypeInformation info) {} | 209 ClosureCallSiteTypeInformation info) {} |
210 | 210 |
211 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { | 211 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { |
212 Element called = info.calledElement; | 212 MemberElement called = info.calledElement; |
213 TypeInformation inferred = called.isLocal | 213 TypeInformation inferred = inferrer.types.getInferredTypeOfMember(called); |
214 ? inferrer.types.getInferredTypeOfLocalFunction(called) | |
215 : inferrer.types.getInferredTypeOfMember(called); | |
216 if (inferred == currentUser) { | 214 if (inferred == currentUser) { |
217 addNewEscapeInformation(info); | 215 addNewEscapeInformation(info); |
218 } | 216 } |
219 } | 217 } |
220 | 218 |
221 void analyzeStoredIntoList(ListTypeInformation list) { | 219 void analyzeStoredIntoList(ListTypeInformation list) { |
222 inferrer.analyzeListAndEnqueue(list); | 220 inferrer.analyzeListAndEnqueue(list); |
223 if (list.bailedOut) { | 221 if (list.bailedOut) { |
224 bailout('Stored in a list that bailed out'); | 222 bailout('Stored in a list that bailed out'); |
225 } else { | 223 } else { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 } | 455 } |
458 if (info.member.isField && | 456 if (info.member.isField && |
459 !inferrer.compiler.backend.canFieldBeUsedForGlobalOptimizations( | 457 !inferrer.compiler.backend.canFieldBeUsedForGlobalOptimizations( |
460 info.member, inferrer.closedWorld)) { | 458 info.member, inferrer.closedWorld)) { |
461 bailout('Escape to code that has special backend treatment'); | 459 bailout('Escape to code that has special backend treatment'); |
462 } | 460 } |
463 addNewEscapeInformation(info); | 461 addNewEscapeInformation(info); |
464 } | 462 } |
465 | 463 |
466 void visitParameterTypeInformation(ParameterTypeInformation info) { | 464 void visitParameterTypeInformation(ParameterTypeInformation info) { |
467 if (inferrer.isNativeMember(info.method)) { | 465 if (inferrer.closedWorld.nativeData.isNativeMember(info.method)) { |
468 bailout('Passed to a native method'); | 466 bailout('Passed to a native method'); |
469 } | 467 } |
470 if (!inferrer.compiler.backend | 468 if (!inferrer.compiler.backend |
471 .canFunctionParametersBeUsedForGlobalOptimizations( | 469 .canFunctionParametersBeUsedForGlobalOptimizations( |
472 info.method, inferrer.closedWorld)) { | 470 info.method, inferrer.closedWorld)) { |
473 bailout('Escape to code that has special backend treatment'); | 471 bailout('Escape to code that has special backend treatment'); |
474 } | 472 } |
475 if (isParameterOfListAddingMethod(info.parameter) || | 473 if (isParameterOfListAddingMethod(info.parameter) || |
476 isParameterOfMapAddingMethod(info.parameter)) { | 474 isParameterOfMapAddingMethod(info.parameter)) { |
477 // These elements are being handled in | 475 // These elements are being handled in |
478 // [visitDynamicCallSiteTypeInformation]. | 476 // [visitDynamicCallSiteTypeInformation]. |
479 return; | 477 return; |
480 } | 478 } |
481 addNewEscapeInformation(info); | 479 addNewEscapeInformation(info); |
482 } | 480 } |
483 } | 481 } |
OLD | NEW |