Chromium Code Reviews| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 abstract class HVisitor<R> { | 7 abstract class HVisitor<R> { |
| 8 R visitAdd(HAdd node); | 8 R visitAdd(HAdd node); |
| 9 R visitBailoutTarget(HBailoutTarget node); | 9 R visitBailoutTarget(HBailoutTarget node); |
| 10 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
| (...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1661 int typeCode() => HInstruction.NEGATE_TYPECODE; | 1661 int typeCode() => HInstruction.NEGATE_TYPECODE; |
| 1662 bool typeEquals(other) => other is HNegate; | 1662 bool typeEquals(other) => other is HNegate; |
| 1663 bool dataEquals(HInstruction other) => true; | 1663 bool dataEquals(HInstruction other) => true; |
| 1664 } | 1664 } |
| 1665 | 1665 |
| 1666 class HBitNot extends HInvokeUnary { | 1666 class HBitNot extends HInvokeUnary { |
| 1667 HBitNot(input, selector) : super(input, selector) { | 1667 HBitNot(input, selector) : super(input, selector) { |
| 1668 instructionType = HType.INTEGER; | 1668 instructionType = HType.INTEGER; |
| 1669 } | 1669 } |
| 1670 accept(HVisitor visitor) => visitor.visitBitNot(this); | 1670 accept(HVisitor visitor) => visitor.visitBitNot(this); |
| 1671 | 1671 |
| 1672 UnaryOperation operation(ConstantSystem constantSystem) | 1672 UnaryOperation operation(ConstantSystem constantSystem) |
| 1673 => constantSystem.bitNot; | 1673 => constantSystem.bitNot; |
| 1674 int typeCode() => HInstruction.BIT_NOT_TYPECODE; | 1674 int typeCode() => HInstruction.BIT_NOT_TYPECODE; |
| 1675 bool typeEquals(other) => other is HBitNot; | 1675 bool typeEquals(other) => other is HBitNot; |
| 1676 bool dataEquals(HInstruction other) => true; | 1676 bool dataEquals(HInstruction other) => true; |
| 1677 } | 1677 } |
| 1678 | 1678 |
| 1679 class HExit extends HControlFlow { | 1679 class HExit extends HControlFlow { |
| 1680 HExit() : super(const <HInstruction>[]); | 1680 HExit() : super(const <HInstruction>[]); |
| 1681 toString() => 'exit'; | 1681 toString() => 'exit'; |
| 1682 accept(HVisitor visitor) => visitor.visitExit(this); | 1682 accept(HVisitor visitor) => visitor.visitExit(this); |
| 1683 } | 1683 } |
| 1684 | 1684 |
| 1685 class HGoto extends HControlFlow { | 1685 class HGoto extends HControlFlow { |
| 1686 HGoto() : super(const <HInstruction>[]); | 1686 HGoto() : super(const <HInstruction>[]); |
| 1687 toString() => 'goto'; | 1687 toString() => 'goto'; |
| 1688 accept(HVisitor visitor) => visitor.visitGoto(this); | 1688 accept(HVisitor visitor) => visitor.visitGoto(this); |
| 1689 } | 1689 } |
| 1690 | 1690 |
| 1691 abstract class HJump extends HControlFlow { | 1691 abstract class HJump extends HControlFlow { |
| 1692 final TargetElement target; | 1692 final TargetElement target; |
| 1693 final LabelElement label; | 1693 final LabelElement label; |
| 1694 HJump(this.target) : label = null, super(const <HInstruction>[]); | 1694 HJump(this.target) : label = null, super(const <HInstruction>[]); |
| 1695 HJump.toLabel(LabelElement label) | 1695 HJump.toLabel(LabelElement label) |
| 1696 : label = label, target = label.target, super(const <HInstruction>[]); | 1696 : label = label, target = label.target, super(const <HInstruction>[]); |
| 1697 } | 1697 } |
| 1698 | 1698 |
| 1699 class HBreak extends HJump { | 1699 class HBreak extends HJump { |
| 1700 HBreak(TargetElement target) : super(target); | 1700 final bool breakSwitchContinueLoop; |
|
ngeoffray
2013/05/14 07:08:51
Please add a comment on this field.
Johnni Winther
2013/05/17 07:03:04
Done.
| |
| 1701 HBreak.toLabel(LabelElement label) : super.toLabel(label); | 1701 HBreak(TargetElement target, {bool this.breakSwitchContinueLoop: false}) |
| 1702 : super(target); | |
| 1703 HBreak.toLabel(LabelElement label) | |
| 1704 : breakSwitchContinueLoop = false, super.toLabel(label); | |
| 1702 toString() => (label != null) ? 'break ${label.labelName}' : 'break'; | 1705 toString() => (label != null) ? 'break ${label.labelName}' : 'break'; |
| 1703 accept(HVisitor visitor) => visitor.visitBreak(this); | 1706 accept(HVisitor visitor) => visitor.visitBreak(this); |
| 1704 } | 1707 } |
| 1705 | 1708 |
| 1706 class HContinue extends HJump { | 1709 class HContinue extends HJump { |
| 1707 HContinue(TargetElement target) : super(target); | 1710 HContinue(TargetElement target) : super(target); |
| 1708 HContinue.toLabel(LabelElement label) : super.toLabel(label); | 1711 HContinue.toLabel(LabelElement label) : super.toLabel(label); |
| 1709 toString() => (label != null) ? 'continue ${label.labelName}' : 'continue'; | 1712 toString() => (label != null) ? 'continue ${label.labelName}' : 'continue'; |
| 1710 accept(HVisitor visitor) => visitor.visitContinue(this); | 1713 accept(HVisitor visitor) => visitor.visitContinue(this); |
| 1711 } | 1714 } |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2456 visitor.visitLabeledBlockInfo(this); | 2459 visitor.visitLabeledBlockInfo(this); |
| 2457 } | 2460 } |
| 2458 | 2461 |
| 2459 class LoopTypeVisitor extends Visitor { | 2462 class LoopTypeVisitor extends Visitor { |
| 2460 const LoopTypeVisitor(); | 2463 const LoopTypeVisitor(); |
| 2461 int visitNode(Node node) => HLoopBlockInformation.NOT_A_LOOP; | 2464 int visitNode(Node node) => HLoopBlockInformation.NOT_A_LOOP; |
| 2462 int visitWhile(While node) => HLoopBlockInformation.WHILE_LOOP; | 2465 int visitWhile(While node) => HLoopBlockInformation.WHILE_LOOP; |
| 2463 int visitFor(For node) => HLoopBlockInformation.FOR_LOOP; | 2466 int visitFor(For node) => HLoopBlockInformation.FOR_LOOP; |
| 2464 int visitDoWhile(DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; | 2467 int visitDoWhile(DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; |
| 2465 int visitForIn(ForIn node) => HLoopBlockInformation.FOR_IN_LOOP; | 2468 int visitForIn(ForIn node) => HLoopBlockInformation.FOR_IN_LOOP; |
| 2469 int visitSwitchStatement(SwitchStatement node) => | |
| 2470 HLoopBlockInformation.SWITCH_CONTINUE_LOOP; | |
| 2466 } | 2471 } |
| 2467 | 2472 |
| 2468 class HLoopBlockInformation implements HStatementInformation { | 2473 class HLoopBlockInformation implements HStatementInformation { |
| 2469 static const int WHILE_LOOP = 0; | 2474 static const int WHILE_LOOP = 0; |
| 2470 static const int FOR_LOOP = 1; | 2475 static const int FOR_LOOP = 1; |
| 2471 static const int DO_WHILE_LOOP = 2; | 2476 static const int DO_WHILE_LOOP = 2; |
| 2472 static const int FOR_IN_LOOP = 3; | 2477 static const int FOR_IN_LOOP = 3; |
| 2478 static const int SWITCH_CONTINUE_LOOP = 4; | |
| 2473 static const int NOT_A_LOOP = -1; | 2479 static const int NOT_A_LOOP = -1; |
| 2474 | 2480 |
| 2475 final int kind; | 2481 final int kind; |
| 2476 final HExpressionInformation initializer; | 2482 final HExpressionInformation initializer; |
| 2477 final HExpressionInformation condition; | 2483 final HExpressionInformation condition; |
| 2478 final HStatementInformation body; | 2484 final HStatementInformation body; |
| 2479 final HExpressionInformation updates; | 2485 final HExpressionInformation updates; |
| 2480 final TargetElement target; | 2486 final TargetElement target; |
| 2481 final List<LabelElement> labels; | 2487 final List<LabelElement> labels; |
| 2482 final SourceFileLocation sourcePosition; | 2488 final SourceFileLocation sourcePosition; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2599 HBasicBlock get start => expression.start; | 2605 HBasicBlock get start => expression.start; |
| 2600 HBasicBlock get end { | 2606 HBasicBlock get end { |
| 2601 // We don't create a switch block if there are no cases. | 2607 // We don't create a switch block if there are no cases. |
| 2602 assert(!statements.isEmpty); | 2608 assert(!statements.isEmpty); |
| 2603 return statements.last.end; | 2609 return statements.last.end; |
| 2604 } | 2610 } |
| 2605 | 2611 |
| 2606 bool accept(HStatementInformationVisitor visitor) => | 2612 bool accept(HStatementInformationVisitor visitor) => |
| 2607 visitor.visitSwitchInfo(this); | 2613 visitor.visitSwitchInfo(this); |
| 2608 } | 2614 } |
| OLD | NEW |