| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
| 6 | 6 |
| 7 import '../closure.dart'; | 7 import '../closure.dart'; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/codegen.dart' show CodegenRegistry; | 9 import '../common/codegen.dart' show CodegenRegistry; |
| 10 import '../common/names.dart'; | 10 import '../common/names.dart'; |
| (...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1862 | 1862 |
| 1863 if (isDefaultCase(switchCase)) { | 1863 if (isDefaultCase(switchCase)) { |
| 1864 // An HSwitch has n inputs and n+1 successors, the last being the | 1864 // An HSwitch has n inputs and n+1 successors, the last being the |
| 1865 // default case. | 1865 // default case. |
| 1866 expressionEnd.addSuccessor(block); | 1866 expressionEnd.addSuccessor(block); |
| 1867 hasDefault = true; | 1867 hasDefault = true; |
| 1868 } | 1868 } |
| 1869 open(block); | 1869 open(block); |
| 1870 localsHandler = new LocalsHandler.from(savedLocals); | 1870 localsHandler = new LocalsHandler.from(savedLocals); |
| 1871 buildSwitchCase(switchCase); | 1871 buildSwitchCase(switchCase); |
| 1872 if (!isAborted() && |
| 1873 switchCase == switchCases.last && |
| 1874 !isDefaultCase(switchCase)) { |
| 1875 // If there is no default, we will add one later to avoid |
| 1876 // the critical edge. So we generate a break statement to make |
| 1877 // sure the last case does not fall through to the default case. |
| 1878 jumpHandler.generateBreak(); |
| 1879 } |
| 1872 statements.add( | 1880 statements.add( |
| 1873 new HSubGraphBlockInformation(new SubGraph(block, lastOpenedBlock))); | 1881 new HSubGraphBlockInformation(new SubGraph(block, lastOpenedBlock))); |
| 1874 } | 1882 } |
| 1875 | 1883 |
| 1876 // Add a join-block if necessary. | 1884 // Add a join-block if necessary. |
| 1877 // We create [joinBlock] early, and then go through the cases that might | 1885 // We create [joinBlock] early, and then go through the cases that might |
| 1878 // want to jump to it. In each case, if we add [joinBlock] as a successor | 1886 // want to jump to it. In each case, if we add [joinBlock] as a successor |
| 1879 // of another block, we also add an element to [caseHandlers] that is used | 1887 // of another block, we also add an element to [caseHandlers] that is used |
| 1880 // to create the phis in [joinBlock]. | 1888 // to create the phis in [joinBlock]. |
| 1881 // If we never jump to the join block, [caseHandlers] will stay empty, and | 1889 // If we never jump to the join block, [caseHandlers] will stay empty, and |
| (...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3680 enterBlock.setBlockFlow( | 3688 enterBlock.setBlockFlow( |
| 3681 new HTryBlockInformation( | 3689 new HTryBlockInformation( |
| 3682 kernelBuilder.wrapStatementGraph(bodyGraph), | 3690 kernelBuilder.wrapStatementGraph(bodyGraph), |
| 3683 exception, | 3691 exception, |
| 3684 kernelBuilder.wrapStatementGraph(catchGraph), | 3692 kernelBuilder.wrapStatementGraph(catchGraph), |
| 3685 kernelBuilder.wrapStatementGraph(finallyGraph)), | 3693 kernelBuilder.wrapStatementGraph(finallyGraph)), |
| 3686 exitBlock); | 3694 exitBlock); |
| 3687 kernelBuilder.inTryStatement = previouslyInTryStatement; | 3695 kernelBuilder.inTryStatement = previouslyInTryStatement; |
| 3688 } | 3696 } |
| 3689 } | 3697 } |
| OLD | NEW |