| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 interface HVisitor<R> { | 5 interface 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 blocks.add(block); | 135 blocks.add(block); |
| 136 assert(blocks[id] === block); | 136 assert(blocks[id] === block); |
| 137 } | 137 } |
| 138 | 138 |
| 139 HBasicBlock addNewBlock() { | 139 HBasicBlock addNewBlock() { |
| 140 HBasicBlock result = new HBasicBlock(); | 140 HBasicBlock result = new HBasicBlock(); |
| 141 addBlock(result); | 141 addBlock(result); |
| 142 return result; | 142 return result; |
| 143 } | 143 } |
| 144 | 144 |
| 145 HBasicBlock addNewLoopHeaderBlock(List<SourceString> labels) { | 145 HBasicBlock addNewLoopHeaderBlock(List<LabelElement> labels) { |
| 146 HBasicBlock result = addNewBlock(); | 146 HBasicBlock result = addNewBlock(); |
| 147 result.loopInformation = new HLoopInformation(result, labels); | 147 result.loopInformation = new HLoopInformation(result, labels); |
| 148 return result; | 148 return result; |
| 149 } | 149 } |
| 150 | 150 |
| 151 static HType mapConstantTypeToSsaType(Constant constant) { | 151 static HType mapConstantTypeToSsaType(Constant constant) { |
| 152 if (constant.isNull()) return HType.UNKNOWN; | 152 if (constant.isNull()) return HType.UNKNOWN; |
| 153 if (constant.isBool()) return HType.BOOLEAN; | 153 if (constant.isBool()) return HType.BOOLEAN; |
| 154 if (constant.isInt()) return HType.INTEGER; | 154 if (constant.isInt()) return HType.INTEGER; |
| 155 if (constant.isDouble()) return HType.DOUBLE; | 155 if (constant.isDouble()) return HType.DOUBLE; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 HLabeledBlockInformation labeledBlockInformation = null; | 426 HLabeledBlockInformation labeledBlockInformation = null; |
| 427 HBasicBlock parentLoopHeader = null; | 427 HBasicBlock parentLoopHeader = null; |
| 428 List<HBailoutTarget> bailouts; | 428 List<HBailoutTarget> bailouts; |
| 429 | 429 |
| 430 final List<HBasicBlock> predecessors; | 430 final List<HBasicBlock> predecessors; |
| 431 List<HBasicBlock> successors; | 431 List<HBasicBlock> successors; |
| 432 | 432 |
| 433 HBasicBlock dominator = null; | 433 HBasicBlock dominator = null; |
| 434 final List<HBasicBlock> dominatedBlocks; | 434 final List<HBasicBlock> dominatedBlocks; |
| 435 | 435 |
| 436 // For recognizing labeled statements. | |
| 437 List<SourceString> labels; | |
| 438 | |
| 439 HBasicBlock() : this.withId(null); | 436 HBasicBlock() : this.withId(null); |
| 440 HBasicBlock.withId(this.id) | 437 HBasicBlock.withId(this.id) |
| 441 : phis = new HInstructionList(), | 438 : phis = new HInstructionList(), |
| 442 predecessors = <HBasicBlock>[], | 439 predecessors = <HBasicBlock>[], |
| 443 successors = const <HBasicBlock>[], | 440 successors = const <HBasicBlock>[], |
| 444 dominatedBlocks = <HBasicBlock>[], | 441 dominatedBlocks = <HBasicBlock>[], |
| 445 bailouts = <HBailoutTarget>[]; | 442 bailouts = <HBailoutTarget>[]; |
| 446 | 443 |
| 447 bool isNew() => status == STATUS_NEW; | 444 bool isNew() => status == STATUS_NEW; |
| 448 bool isOpen() => status == STATUS_OPEN; | 445 bool isOpen() => status == STATUS_OPEN; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 } | 659 } |
| 663 } | 660 } |
| 664 | 661 |
| 665 class HBlockInformation { | 662 class HBlockInformation { |
| 666 // Just a marker class. | 663 // Just a marker class. |
| 667 } | 664 } |
| 668 | 665 |
| 669 class HLabeledBlockInformation extends HBlockInformation { | 666 class HLabeledBlockInformation extends HBlockInformation { |
| 670 final SubGraph body; | 667 final SubGraph body; |
| 671 final HBasicBlock joinBlock; | 668 final HBasicBlock joinBlock; |
| 672 final List<SourceString> labels; | 669 final List<LabelElement> labels; |
| 673 HLabeledBlockInformation(this.body, this.joinBlock, this.labels); | 670 HLabeledBlockInformation(this.body, this.joinBlock, this.labels); |
| 674 } | 671 } |
| 675 | 672 |
| 676 class HLoopInformation extends HBlockInformation { | 673 class HLoopInformation extends HBlockInformation { |
| 677 final HBasicBlock header; | 674 final HBasicBlock header; |
| 678 final List<HBasicBlock> blocks; | 675 final List<HBasicBlock> blocks; |
| 679 final List<HBasicBlock> backEdges; | 676 final List<HBasicBlock> backEdges; |
| 680 final List<SourceString> labels; | 677 final List<LabelElement> labels; |
| 681 | 678 |
| 682 HLoopInformation(this.header, this.labels) | 679 HLoopInformation(this.header, this.labels) |
| 683 : blocks = new List<HBasicBlock>(), | 680 : blocks = new List<HBasicBlock>(), |
| 684 backEdges = new List<HBasicBlock>(); | 681 backEdges = new List<HBasicBlock>(); |
| 685 | 682 |
| 686 void addBackEdge(HBasicBlock predecessor) { | 683 void addBackEdge(HBasicBlock predecessor) { |
| 687 backEdges.add(predecessor); | 684 backEdges.add(predecessor); |
| 688 addBlock(predecessor); | 685 addBlock(predecessor); |
| 689 } | 686 } |
| 690 | 687 |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 accept(HVisitor visitor) => visitor.visitExit(this); | 1655 accept(HVisitor visitor) => visitor.visitExit(this); |
| 1659 } | 1656 } |
| 1660 | 1657 |
| 1661 class HGoto extends HControlFlow { | 1658 class HGoto extends HControlFlow { |
| 1662 HGoto() : super(const <HInstruction>[]); | 1659 HGoto() : super(const <HInstruction>[]); |
| 1663 toString() => 'goto'; | 1660 toString() => 'goto'; |
| 1664 accept(HVisitor visitor) => visitor.visitGoto(this); | 1661 accept(HVisitor visitor) => visitor.visitGoto(this); |
| 1665 } | 1662 } |
| 1666 | 1663 |
| 1667 class HBreak extends HGoto { | 1664 class HBreak extends HGoto { |
| 1668 final SourceString label; | 1665 final LabelElement label; |
| 1669 HBreak([this.label]); | 1666 HBreak([this.label]); |
| 1670 toString() => 'break'; | 1667 toString() => label === null ? 'break' : 'break ${label.labelName}'; |
| 1671 accept(HVisitor visitor) => visitor.visitBreak(this); | 1668 accept(HVisitor visitor) => visitor.visitBreak(this); |
| 1672 } | 1669 } |
| 1673 | 1670 |
| 1674 class HTry extends HControlFlow { | 1671 class HTry extends HControlFlow { |
| 1675 HParameterValue exception; | 1672 HParameterValue exception; |
| 1676 HBasicBlock finallyBlock; | 1673 HBasicBlock finallyBlock; |
| 1677 HTry() : super(const <HInstruction>[]); | 1674 HTry() : super(const <HInstruction>[]); |
| 1678 toString() => 'try'; | 1675 toString() => 'try'; |
| 1679 accept(HVisitor visitor) => visitor.visitTry(this); | 1676 accept(HVisitor visitor) => visitor.visitTry(this); |
| 1680 HBasicBlock get joinBlock() => this.block.successors.last(); | 1677 HBasicBlock get joinBlock() => this.block.successors.last(); |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2177 class HIfBlockInformation { | 2174 class HIfBlockInformation { |
| 2178 final HIf branch; | 2175 final HIf branch; |
| 2179 final SubGraph thenGraph; | 2176 final SubGraph thenGraph; |
| 2180 final SubGraph elseGraph; | 2177 final SubGraph elseGraph; |
| 2181 final HBasicBlock joinBlock; | 2178 final HBasicBlock joinBlock; |
| 2182 HIfBlockInformation(this.branch, | 2179 HIfBlockInformation(this.branch, |
| 2183 this.thenGraph, | 2180 this.thenGraph, |
| 2184 this.elseGraph, | 2181 this.elseGraph, |
| 2185 this.joinBlock); | 2182 this.joinBlock); |
| 2186 } | 2183 } |
| OLD | NEW |