OLD | NEW |
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 abstract class HVisitor<R> { | 5 abstract class HVisitor<R> { |
6 R visitAdd(HAdd node); | 6 R visitAdd(HAdd node); |
7 R visitBailoutTarget(HBailoutTarget node); | 7 R visitBailoutTarget(HBailoutTarget node); |
8 R visitBitAnd(HBitAnd node); | 8 R visitBitAnd(HBitAnd node); |
9 R visitBitNot(HBitNot node); | 9 R visitBitNot(HBitNot node); |
10 R visitBitOr(HBitOr node); | 10 R visitBitOr(HBitOr node); |
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 HSwitch(List<HInstruction> inputs) : super(inputs); | 1758 HSwitch(List<HInstruction> inputs) : super(inputs); |
1759 | 1759 |
1760 HConstant constant(int index) => inputs[index + 1]; | 1760 HConstant constant(int index) => inputs[index + 1]; |
1761 HInstruction get expression => inputs[0]; | 1761 HInstruction get expression => inputs[0]; |
1762 | 1762 |
1763 /** | 1763 /** |
1764 * Provides the target to jump to if none of the constants match | 1764 * Provides the target to jump to if none of the constants match |
1765 * the expression. If the switch had no default case, this is the | 1765 * the expression. If the switch had no default case, this is the |
1766 * following join-block. | 1766 * following join-block. |
1767 */ | 1767 */ |
1768 HBasicBlock get defaultTarget => block.successors.last(); | 1768 HBasicBlock get defaultTarget => block.successors.last; |
1769 | 1769 |
1770 accept(HVisitor visitor) => visitor.visitSwitch(this); | 1770 accept(HVisitor visitor) => visitor.visitSwitch(this); |
1771 | 1771 |
1772 String toString() => "HSwitch cases = $inputs"; | 1772 String toString() => "HSwitch cases = $inputs"; |
1773 } | 1773 } |
1774 | 1774 |
1775 class HTruncatingDivide extends HBinaryArithmetic { | 1775 class HTruncatingDivide extends HBinaryArithmetic { |
1776 HTruncatingDivide(HStatic target, HInstruction left, HInstruction right) | 1776 HTruncatingDivide(HStatic target, HInstruction left, HInstruction right) |
1777 : super(target, left, right); | 1777 : super(target, left, right); |
1778 accept(HVisitor visitor) => visitor.visitTruncatingDivide(this); | 1778 accept(HVisitor visitor) => visitor.visitTruncatingDivide(this); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 accept(HVisitor visitor) => visitor.visitContinue(this); | 2008 accept(HVisitor visitor) => visitor.visitContinue(this); |
2009 } | 2009 } |
2010 | 2010 |
2011 class HTry extends HControlFlow { | 2011 class HTry extends HControlFlow { |
2012 HParameterValue exception; | 2012 HParameterValue exception; |
2013 HBasicBlock catchBlock; | 2013 HBasicBlock catchBlock; |
2014 HBasicBlock finallyBlock; | 2014 HBasicBlock finallyBlock; |
2015 HTry() : super(const <HInstruction>[]); | 2015 HTry() : super(const <HInstruction>[]); |
2016 toString() => 'try'; | 2016 toString() => 'try'; |
2017 accept(HVisitor visitor) => visitor.visitTry(this); | 2017 accept(HVisitor visitor) => visitor.visitTry(this); |
2018 HBasicBlock get joinBlock => this.block.successors.last(); | 2018 HBasicBlock get joinBlock => this.block.successors.last; |
2019 } | 2019 } |
2020 | 2020 |
2021 class HIf extends HConditionalBranch { | 2021 class HIf extends HConditionalBranch { |
2022 HBlockFlow blockInformation = null; | 2022 HBlockFlow blockInformation = null; |
2023 HIf(HInstruction condition) : super(<HInstruction>[condition]); | 2023 HIf(HInstruction condition) : super(<HInstruction>[condition]); |
2024 toString() => 'if'; | 2024 toString() => 'if'; |
2025 accept(HVisitor visitor) => visitor.visitIf(this); | 2025 accept(HVisitor visitor) => visitor.visitIf(this); |
2026 | 2026 |
2027 HBasicBlock get thenBlock { | 2027 HBasicBlock get thenBlock { |
2028 assert(identical(block.dominatedBlocks[0], block.successors[0])); | 2028 assert(identical(block.dominatedBlocks[0], block.successors[0])); |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2799 visitor.visitSubExpressionInfo(this); | 2799 visitor.visitSubExpressionInfo(this); |
2800 } | 2800 } |
2801 | 2801 |
2802 | 2802 |
2803 /** A sequence of separate statements. */ | 2803 /** A sequence of separate statements. */ |
2804 class HStatementSequenceInformation implements HStatementInformation { | 2804 class HStatementSequenceInformation implements HStatementInformation { |
2805 final List<HStatementInformation> statements; | 2805 final List<HStatementInformation> statements; |
2806 HStatementSequenceInformation(this.statements); | 2806 HStatementSequenceInformation(this.statements); |
2807 | 2807 |
2808 HBasicBlock get start => statements[0].start; | 2808 HBasicBlock get start => statements[0].start; |
2809 HBasicBlock get end => statements.last().end; | 2809 HBasicBlock get end => statements.last.end; |
2810 | 2810 |
2811 bool accept(HStatementInformationVisitor visitor) => | 2811 bool accept(HStatementInformationVisitor visitor) => |
2812 visitor.visitSequenceInfo(this); | 2812 visitor.visitSequenceInfo(this); |
2813 } | 2813 } |
2814 | 2814 |
2815 | 2815 |
2816 class HLabeledBlockInformation implements HStatementInformation { | 2816 class HLabeledBlockInformation implements HStatementInformation { |
2817 final HStatementInformation body; | 2817 final HStatementInformation body; |
2818 final List<LabelElement> labels; | 2818 final List<LabelElement> labels; |
2819 final TargetElement target; | 2819 final TargetElement target; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2968 this.matchExpressions, | 2968 this.matchExpressions, |
2969 this.statements, | 2969 this.statements, |
2970 this.hasDefault, | 2970 this.hasDefault, |
2971 this.target, | 2971 this.target, |
2972 this.labels); | 2972 this.labels); |
2973 | 2973 |
2974 HBasicBlock get start => expression.start; | 2974 HBasicBlock get start => expression.start; |
2975 HBasicBlock get end { | 2975 HBasicBlock get end { |
2976 // We don't create a switch block if there are no cases. | 2976 // We don't create a switch block if there are no cases. |
2977 assert(!statements.isEmpty); | 2977 assert(!statements.isEmpty); |
2978 return statements.last().end; | 2978 return statements.last.end; |
2979 } | 2979 } |
2980 | 2980 |
2981 bool accept(HStatementInformationVisitor visitor) => | 2981 bool accept(HStatementInformationVisitor visitor) => |
2982 visitor.visitSwitchInfo(this); | 2982 visitor.visitSwitchInfo(this); |
2983 } | 2983 } |
OLD | NEW |