Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 2581143003: implement LabeledStatement and Break in kernel (Closed)
Patch Set: fix some tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 'dart:collection'; 5 import 'dart:collection';
6 6
7 import 'package:js_runtime/shared/embedded_names.dart'; 7 import 'package:js_runtime/shared/embedded_names.dart';
8 8
9 import '../closure.dart'; 9 import '../closure.dart';
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 1762
1763 if (!isAbortingBody) { 1763 if (!isAbortingBody) {
1764 bodyExitBlock.addSuccessor(conditionBlock); 1764 bodyExitBlock.addSuccessor(conditionBlock);
1765 } 1765 }
1766 1766
1767 if (!continueHandlers.isEmpty) { 1767 if (!continueHandlers.isEmpty) {
1768 if (!isAbortingBody) continueHandlers.add(localsHandler); 1768 if (!isAbortingBody) continueHandlers.add(localsHandler);
1769 localsHandler = 1769 localsHandler =
1770 savedLocals.mergeMultiple(continueHandlers, conditionBlock); 1770 savedLocals.mergeMultiple(continueHandlers, conditionBlock);
1771 SubGraph bodyGraph = new SubGraph(bodyEntryBlock, bodyExitBlock); 1771 SubGraph bodyGraph = new SubGraph(bodyEntryBlock, bodyExitBlock);
1772 List<LabelDefinition> labels = jumpHandler.labels(); 1772 List<LabelDefinition> labels = jumpHandler.labels;
1773 HSubGraphBlockInformation bodyInfo = 1773 HSubGraphBlockInformation bodyInfo =
1774 new HSubGraphBlockInformation(bodyGraph); 1774 new HSubGraphBlockInformation(bodyGraph);
1775 HLabeledBlockInformation info; 1775 HLabeledBlockInformation info;
1776 if (!labels.isEmpty) { 1776 if (!labels.isEmpty) {
1777 info = 1777 info =
1778 new HLabeledBlockInformation(bodyInfo, labels, isContinue: true); 1778 new HLabeledBlockInformation(bodyInfo, labels, isContinue: true);
1779 } else { 1779 } else {
1780 info = new HLabeledBlockInformation.implicit(bodyInfo, target, 1780 info = new HLabeledBlockInformation.implicit(bodyInfo, target,
1781 isContinue: true); 1781 isContinue: true);
1782 } 1782 }
(...skipping 3843 matching lines...) Expand 10 before | Expand all | Expand 10 after
5626 goto(current, joinBlock); 5626 goto(current, joinBlock);
5627 breakHandlers.add(localsHandler); 5627 breakHandlers.add(localsHandler);
5628 } 5628 }
5629 open(joinBlock); 5629 open(joinBlock);
5630 localsHandler = beforeLocals.mergeMultiple(breakHandlers, joinBlock); 5630 localsHandler = beforeLocals.mergeMultiple(breakHandlers, joinBlock);
5631 5631
5632 if (hasBreak) { 5632 if (hasBreak) {
5633 // There was at least one reachable break, so the label is needed. 5633 // There was at least one reachable break, so the label is needed.
5634 entryBlock.setBlockFlow( 5634 entryBlock.setBlockFlow(
5635 new HLabeledBlockInformation( 5635 new HLabeledBlockInformation(
5636 new HSubGraphBlockInformation(bodyGraph), handler.labels()), 5636 new HSubGraphBlockInformation(bodyGraph), handler.labels),
5637 joinBlock); 5637 joinBlock);
5638 } 5638 }
5639 handler.close(); 5639 handler.close();
5640 } 5640 }
5641 5641
5642 visitLiteralMap(ast.LiteralMap node) { 5642 visitLiteralMap(ast.LiteralMap node) {
5643 if (node.isConst) { 5643 if (node.isConst) {
5644 stack.add(addConstant(node)); 5644 stack.add(addConstant(node));
5645 return; 5645 return;
5646 } 5646 }
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
6072 } 6072 }
6073 } else { 6073 } else {
6074 // The joinblock is not used. 6074 // The joinblock is not used.
6075 joinBlock = null; 6075 joinBlock = null;
6076 } 6076 }
6077 6077
6078 HSubExpressionBlockInformation expressionInfo = 6078 HSubExpressionBlockInformation expressionInfo =
6079 new HSubExpressionBlockInformation( 6079 new HSubExpressionBlockInformation(
6080 new SubExpression(expressionStart, expressionEnd)); 6080 new SubExpression(expressionStart, expressionEnd));
6081 expressionStart.setBlockFlow( 6081 expressionStart.setBlockFlow(
6082 new HSwitchBlockInformation(expressionInfo, statements, 6082 new HSwitchBlockInformation(
6083 jumpHandler.target, jumpHandler.labels()), 6083 expressionInfo, statements, jumpHandler.target, jumpHandler.labels),
6084 joinBlock); 6084 joinBlock);
6085 6085
6086 jumpHandler.close(); 6086 jumpHandler.close();
6087 } 6087 }
6088 6088
6089 visitSwitchCase(ast.SwitchCase node) { 6089 visitSwitchCase(ast.SwitchCase node) {
6090 reporter.internalError(node, 'SsaFromAstMixin.visitSwitchCase.'); 6090 reporter.internalError(node, 'SsaFromAstMixin.visitSwitchCase.');
6091 } 6091 }
6092 6092
6093 visitCaseMatch(ast.CaseMatch node) { 6093 visitCaseMatch(ast.CaseMatch node) {
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
6751 this.oldReturnLocal, 6751 this.oldReturnLocal,
6752 this.oldReturnType, 6752 this.oldReturnType,
6753 this.oldResolvedAst, 6753 this.oldResolvedAst,
6754 this.oldStack, 6754 this.oldStack,
6755 this.oldLocalsHandler, 6755 this.oldLocalsHandler,
6756 this.inTryStatement, 6756 this.inTryStatement,
6757 this.allFunctionsCalledOnce, 6757 this.allFunctionsCalledOnce,
6758 this.oldElementInferenceResults) 6758 this.oldElementInferenceResults)
6759 : super(function); 6759 : super(function);
6760 } 6760 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698