| 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 #include "vm/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/object.h" | 7 #include "vm/object.h" |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 #include "vm/scopes.h" | 9 #include "vm/scopes.h" |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 return successor_; | 56 return successor_; |
| 57 } | 57 } |
| 58 | 58 |
| 59 | 59 |
| 60 Instruction* ReturnInstr::Accept(FlowGraphVisitor* visitor) { | 60 Instruction* ReturnInstr::Accept(FlowGraphVisitor* visitor) { |
| 61 visitor->VisitReturn(this); | 61 visitor->VisitReturn(this); |
| 62 return NULL; | 62 return NULL; |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| 66 Instruction* ThrowInstr::Accept(FlowGraphVisitor* visitor) { |
| 67 visitor->VisitThrow(this); |
| 68 return NULL; |
| 69 } |
| 70 |
| 71 |
| 72 Instruction* ReThrowInstr::Accept(FlowGraphVisitor* visitor) { |
| 73 visitor->VisitReThrow(this); |
| 74 return NULL; |
| 75 } |
| 76 |
| 77 |
| 66 Instruction* BranchInstr::Accept(FlowGraphVisitor* visitor) { | 78 Instruction* BranchInstr::Accept(FlowGraphVisitor* visitor) { |
| 67 visitor->VisitBranch(this); | 79 visitor->VisitBranch(this); |
| 68 return NULL; | 80 return NULL; |
| 69 } | 81 } |
| 70 | 82 |
| 71 | 83 |
| 72 // Default implementation of visiting basic blocks. Can be overridden. | 84 // Default implementation of visiting basic blocks. Can be overridden. |
| 73 void FlowGraphVisitor::VisitBlocks( | 85 void FlowGraphVisitor::VisitBlocks( |
| 74 const GrowableArray<BlockEntryInstr*>& block_order) { | 86 const GrowableArray<BlockEntryInstr*>& block_order) { |
| 75 for (intptr_t i = block_order.length() - 1; i >= 0; --i) { | 87 for (intptr_t i = block_order.length() - 1; i >= 0; --i) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 ASSERT(successor_ != NULL); | 137 ASSERT(successor_ != NULL); |
| 126 if (successor_->mark() != mark()) successor_->Postorder(block_entries); | 138 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 127 } | 139 } |
| 128 | 140 |
| 129 | 141 |
| 130 void ReturnInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { | 142 void ReturnInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 131 flip_mark(); | 143 flip_mark(); |
| 132 } | 144 } |
| 133 | 145 |
| 134 | 146 |
| 147 void ThrowInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 148 flip_mark(); |
| 149 } |
| 150 |
| 151 |
| 152 void ReThrowInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 153 flip_mark(); |
| 154 } |
| 155 |
| 156 |
| 135 void BranchInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { | 157 void BranchInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 136 flip_mark(); | 158 flip_mark(); |
| 137 // Visit the false successor before the true successor so they appear in | 159 // Visit the false successor before the true successor so they appear in |
| 138 // true/false order in reverse postorder. | 160 // true/false order in reverse postorder. |
| 139 ASSERT(false_successor_ != NULL); | 161 ASSERT(false_successor_ != NULL); |
| 140 ASSERT(true_successor_ != NULL); | 162 ASSERT(true_successor_ != NULL); |
| 141 if (false_successor_->mark() != mark()) { | 163 if (false_successor_->mark() != mark()) { |
| 142 false_successor_->Postorder(block_entries); | 164 false_successor_->Postorder(block_entries); |
| 143 } | 165 } |
| 144 if (true_successor_->mark() != mark()) { | 166 if (true_successor_->mark() != mark()) { |
| 145 true_successor_->Postorder(block_entries); | 167 true_successor_->Postorder(block_entries); |
| 146 } | 168 } |
| 147 } | 169 } |
| 148 | 170 |
| 149 | 171 |
| 150 } // namespace dart | 172 } // namespace dart |
| OLD | NEW |