| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // TODO(kmillikin): Fix the bug and eliminate this restriction if it makes | 204 // TODO(kmillikin): Fix the bug and eliminate this restriction if it makes |
| 205 // sense. | 205 // sense. |
| 206 if (function is FunctionElement && | 206 if (function is FunctionElement && |
| 207 function.asyncMarker != AsyncMarker.SYNC) { | 207 function.asyncMarker != AsyncMarker.SYNC) { |
| 208 return; | 208 return; |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Do not inline in functions containing try statements. V8 does not | 211 // Do not inline in functions containing try statements. V8 does not |
| 212 // optimize code in such functions, so inlining will move optimizable code | 212 // optimize code in such functions, so inlining will move optimizable code |
| 213 // into a context where it cannot be optimized. | 213 // into a context where it cannot be optimized. |
| 214 if (function.resolvedAst.elements.containsTryStatement) { | 214 if (function.resolvedAst.kind == ResolvedAstKind.PARSED && |
| 215 function.resolvedAst.elements.containsTryStatement) { |
| 215 return; | 216 return; |
| 216 } | 217 } |
| 217 | 218 |
| 218 stack.add(new StackEntry(function, callStructure)); | 219 stack.add(new StackEntry(function, callStructure)); |
| 219 new InliningVisitor(this).visit(node); | 220 new InliningVisitor(this).visit(node); |
| 220 assert(stack.last.match(function, callStructure)); | 221 assert(stack.last.match(function, callStructure)); |
| 221 stack.removeLast(); | 222 stack.removeLast(); |
| 222 new ShrinkingReducer().rewrite(node); | 223 new ShrinkingReducer().rewrite(node); |
| 223 } | 224 } |
| 224 } | 225 } |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 (enclosingClass == backend.helpers.jsNumberClass || | 604 (enclosingClass == backend.helpers.jsNumberClass || |
| 604 enclosingClass == backend.helpers.jsDoubleClass || | 605 enclosingClass == backend.helpers.jsDoubleClass || |
| 605 enclosingClass == backend.helpers.jsIntClass)) { | 606 enclosingClass == backend.helpers.jsIntClass)) { |
| 606 // These should be handled by operator specialization. | 607 // These should be handled by operator specialization. |
| 607 return true; | 608 return true; |
| 608 } | 609 } |
| 609 if (target == backend.helpers.stringInterpolationHelper) return true; | 610 if (target == backend.helpers.stringInterpolationHelper) return true; |
| 610 return false; | 611 return false; |
| 611 } | 612 } |
| 612 } | 613 } |
| OLD | NEW |