| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 cps_ir.optimization.inline; | 5 library cps_ir.optimization.inline; |
| 6 | 6 |
| 7 import 'cps_fragment.dart'; | 7 import 'cps_fragment.dart'; |
| 8 import 'cps_ir_builder.dart' show ThisParameterLocal; | 8 import 'cps_ir_builder.dart' show ThisParameterLocal; |
| 9 import 'cps_ir_nodes.dart'; | 9 import 'cps_ir_nodes.dart'; |
| 10 import 'optimizers.dart'; | 10 import 'optimizers.dart'; |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 invoke.sourceInformation)); | 463 invoke.sourceInformation)); |
| 464 condition.type = typeSystem.boolType; | 464 condition.type = typeSystem.boolType; |
| 465 Primitive check = _fragment.letPrim( | 465 Primitive check = _fragment.letPrim( |
| 466 new NullCheck.guarded( | 466 new NullCheck.guarded( |
| 467 condition, dartReceiver, selector, invoke.sourceInformation)); | 467 condition, dartReceiver, selector, invoke.sourceInformation)); |
| 468 check.type = abstractReceiver.nonNullable(); | 468 check.type = abstractReceiver.nonNullable(); |
| 469 return check; | 469 return check; |
| 470 } | 470 } |
| 471 | 471 |
| 472 Primitive check = _fragment.letPrim( | 472 Primitive check = _fragment.letPrim( |
| 473 new NullCheck(dartReceiver, invoke.sourceInformation)); | 473 new NullCheck(dartReceiver, invoke.sourceInformation, |
| 474 selector: selector)); |
| 474 check.type = abstractReceiver.nonNullable(); | 475 check.type = abstractReceiver.nonNullable(); |
| 475 return check; | 476 return check; |
| 476 } | 477 } |
| 477 | 478 |
| 478 | 479 |
| 479 @override | 480 @override |
| 480 Primitive visitInvokeStatic(InvokeStatic node) { | 481 Primitive visitInvokeStatic(InvokeStatic node) { |
| 481 return tryInlining(node, node.target, null); | 482 return tryInlining(node, node.target, null); |
| 482 } | 483 } |
| 483 | 484 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 507 // We cannot inline a constructor invocation containing type arguments | 508 // We cannot inline a constructor invocation containing type arguments |
| 508 // because CreateInstance in the body does not know the type arguments. | 509 // because CreateInstance in the body does not know the type arguments. |
| 509 // We would incorrectly instantiate a class like A instead of A<B>. | 510 // We would incorrectly instantiate a class like A instead of A<B>. |
| 510 // TODO(kmillikin): try to fix this. | 511 // TODO(kmillikin): try to fix this. |
| 511 GenericType generic = node.dartType; | 512 GenericType generic = node.dartType; |
| 512 if (generic.typeArguments.any((DartType t) => !t.isDynamic)) return null; | 513 if (generic.typeArguments.any((DartType t) => !t.isDynamic)) return null; |
| 513 } | 514 } |
| 514 return tryInlining(node, node.target, null); | 515 return tryInlining(node, node.target, null); |
| 515 } | 516 } |
| 516 } | 517 } |
| OLD | NEW |