Chromium Code Reviews| Index: pkg/compiler/lib/src/cps_ir/type_propagation.dart |
| diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart |
| index 1ac163ee538b0732f31819e3dfb1f7c485a61acb..2a0d840284bf713eb529c522757b8a1ebc00e30e 100644 |
| --- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart |
| +++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart |
| @@ -1645,6 +1645,11 @@ class TransformingVisitor extends LeafVisitor { |
| Selector targetSelector = new Selector.fromElement(functionElement); |
| if (call.callStructure != targetSelector.callStructure) return false; |
| + // Don't inline if [target] contains try-catch or try-finally. JavaScript |
| + // engines typically do poor optimization of the entire function containing |
| + // the 'try'. |
| + if (functionElement.resolvedAst.elements.containsTryStatement) return false; |
| + |
| FunctionDefinition target = |
| functionCompiler.compileToCpsIR(functionElement); |
| @@ -1662,11 +1667,6 @@ class TransformingVisitor extends LeafVisitor { |
| return false; |
| } |
| - // Don't inline if [target] contains try-catch or try-finally. JavaScript |
| - // engines typically do poor optimization of the entire function containing |
| - // the 'try'. |
| - if (ContainsTry.analyze(target)) return false; |
| - |
| node.receiver.definition.substituteFor(target.thisParameter); |
| for (int i = 0; i < node.arguments.length; ++i) { |
| node.arguments[i].definition.substituteFor(target.parameters[i]); |
| @@ -1850,9 +1850,8 @@ class TransformingVisitor extends LeafVisitor { |
| ast.Statement body = node.target.node.body; |
| bool shouldInline() { |
| - if (backend.annotations.noInline(node.target)) { |
| - return false; |
| - } |
| + if (backend.annotations.noInline(node.target)) return false; |
| + if (node.target.resolvedAst.elementd.containsTryStatement) return false; |
|
Kevin Millikin (Google)
2015/09/07 09:11:17
Typo: elementd ==> elements.
|
| // Inline functions that are a single return statement, expression |
| // statement, or block containing a return statement or expression |
| @@ -2875,25 +2874,3 @@ class ResetAnalysisInfo extends RecursiveVisitor { |
| values.remove(node.variable); |
| } |
| } |
| - |
| - |
| -class ContainsTry extends RecursiveVisitor { |
| - bool _found = false; |
| - ContainsTry._(); |
| - |
| - /// Scans [root] for evidence of try-catch and try-finally. |
| - static bool analyze(Node root) { |
| - ContainsTry visitor = new ContainsTry._(); |
| - visitor.visit(root); |
| - return visitor._found; |
| - } |
| - |
| - visit(Node node) { |
| - if (_found) return; // Early exit if we know the answer. |
| - super.visit(node); |
| - } |
| - |
| - processLetHandler(LetHandler node) { |
| - _found = true; |
| - } |
| -} |