| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 R visitSubtract(HSubtract node); | 61 R visitSubtract(HSubtract node); |
| 62 R visitSwitch(HSwitch node); | 62 R visitSwitch(HSwitch node); |
| 63 R visitThis(HThis node); | 63 R visitThis(HThis node); |
| 64 R visitThrow(HThrow node); | 64 R visitThrow(HThrow node); |
| 65 R visitTruncatingDivide(HTruncatingDivide node); | 65 R visitTruncatingDivide(HTruncatingDivide node); |
| 66 R visitTry(HTry node); | 66 R visitTry(HTry node); |
| 67 R visitTypeGuard(HTypeGuard node); | 67 R visitTypeGuard(HTypeGuard node); |
| 68 R visitTypeConversion(HTypeConversion node); | 68 R visitTypeConversion(HTypeConversion node); |
| 69 } | 69 } |
| 70 | 70 |
| 71 class HGraphVisitor { | 71 abstract class HGraphVisitor { |
| 72 visitDominatorTree(HGraph graph) { | 72 visitDominatorTree(HGraph graph) { |
| 73 void visitBasicBlockAndSuccessors(HBasicBlock block) { | 73 void visitBasicBlockAndSuccessors(HBasicBlock block) { |
| 74 visitBasicBlock(block); | 74 visitBasicBlock(block); |
| 75 List dominated = block.dominatedBlocks; | 75 List dominated = block.dominatedBlocks; |
| 76 for (int i = 0; i < dominated.length; i++) { | 76 for (int i = 0; i < dominated.length; i++) { |
| 77 visitBasicBlockAndSuccessors(dominated[i]); | 77 visitBasicBlockAndSuccessors(dominated[i]); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 visitBasicBlockAndSuccessors(graph.entry); | 81 visitBasicBlockAndSuccessors(graph.entry); |
| 82 } | 82 } |
| 83 | 83 |
| 84 visitPostDominatorTree(HGraph graph) { | 84 visitPostDominatorTree(HGraph graph) { |
| 85 void visitBasicBlockAndSuccessors(HBasicBlock block) { | 85 void visitBasicBlockAndSuccessors(HBasicBlock block) { |
| 86 List dominated = block.dominatedBlocks; | 86 List dominated = block.dominatedBlocks; |
| 87 for (int i = dominated.length - 1; i >= 0; i--) { | 87 for (int i = dominated.length - 1; i >= 0; i--) { |
| 88 visitBasicBlockAndSuccessors(dominated[i]); | 88 visitBasicBlockAndSuccessors(dominated[i]); |
| 89 } | 89 } |
| 90 visitBasicBlock(block); | 90 visitBasicBlock(block); |
| 91 } | 91 } |
| 92 | 92 |
| 93 visitBasicBlockAndSuccessors(graph.entry); | 93 visitBasicBlockAndSuccessors(graph.entry); |
| 94 } | 94 } |
| 95 | 95 |
| 96 abstract visitBasicBlock(HBasicBlock block); | 96 abstract visitBasicBlock(HBasicBlock block); |
| 97 } | 97 } |
| 98 | 98 |
| 99 class HInstructionVisitor extends HGraphVisitor { | 99 abstract class HInstructionVisitor extends HGraphVisitor { |
| 100 HBasicBlock currentBlock; | 100 HBasicBlock currentBlock; |
| 101 | 101 |
| 102 abstract visitInstruction(HInstruction node); | 102 abstract visitInstruction(HInstruction node); |
| 103 | 103 |
| 104 visitBasicBlock(HBasicBlock node) { | 104 visitBasicBlock(HBasicBlock node) { |
| 105 void visitInstructionList(HInstructionList list) { | 105 void visitInstructionList(HInstructionList list) { |
| 106 HInstruction instruction = list.first; | 106 HInstruction instruction = list.first; |
| 107 while (instruction !== null) { | 107 while (instruction !== null) { |
| 108 visitInstruction(instruction); | 108 visitInstruction(instruction); |
| 109 instruction = instruction.next; | 109 instruction = instruction.next; |
| (...skipping 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2917 HBasicBlock get start => expression.start; | 2917 HBasicBlock get start => expression.start; |
| 2918 HBasicBlock get end { | 2918 HBasicBlock get end { |
| 2919 // We don't create a switch block if there are no cases. | 2919 // We don't create a switch block if there are no cases. |
| 2920 assert(!statements.isEmpty()); | 2920 assert(!statements.isEmpty()); |
| 2921 return statements.last().end; | 2921 return statements.last().end; |
| 2922 } | 2922 } |
| 2923 | 2923 |
| 2924 bool accept(HStatementInformationVisitor visitor) => | 2924 bool accept(HStatementInformationVisitor visitor) => |
| 2925 visitor.visitSwitchInfo(this); | 2925 visitor.visitSwitchInfo(this); |
| 2926 } | 2926 } |
| OLD | NEW |