| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 while ((current != NULL) && !current->IsBlockEntry()) { | 77 while ((current != NULL) && !current->IsBlockEntry()) { |
| 78 current = current->Accept(this); | 78 current = current->Accept(this); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 | 83 |
| 84 // ==== Postorder graph traversal. | 84 // ==== Postorder graph traversal. |
| 85 void JoinEntryInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { | 85 void JoinEntryInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 86 flip_mark(); | 86 flip_mark(); |
| 87 ASSERT(successor_ != NULL); |
| 87 if (successor_->mark() != mark()) successor_->Postorder(block_entries); | 88 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 88 block_entries->Add(this); | 89 block_entries->Add(this); |
| 89 } | 90 } |
| 90 | 91 |
| 91 | 92 |
| 92 void TargetEntryInstr::Postorder( | 93 void TargetEntryInstr::Postorder( |
| 93 GrowableArray<BlockEntryInstr*>* block_entries) { | 94 GrowableArray<BlockEntryInstr*>* block_entries) { |
| 94 flip_mark(); | 95 flip_mark(); |
| 96 ASSERT(successor_ != NULL); |
| 95 if (successor_->mark() != mark()) successor_->Postorder(block_entries); | 97 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 96 block_entries->Add(this); | 98 block_entries->Add(this); |
| 97 } | 99 } |
| 98 | 100 |
| 99 | 101 |
| 100 void PickTempInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { | 102 void PickTempInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 101 flip_mark(); | 103 flip_mark(); |
| 104 ASSERT(successor_ != NULL); |
| 102 if (successor_->mark() != mark()) successor_->Postorder(block_entries); | 105 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 103 } | 106 } |
| 104 | 107 |
| 105 | 108 |
| 106 void TuckTempInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { | 109 void TuckTempInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 107 flip_mark(); | 110 flip_mark(); |
| 111 ASSERT(successor_ != NULL); |
| 108 if (successor_->mark() != mark()) successor_->Postorder(block_entries); | 112 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 109 } | 113 } |
| 110 | 114 |
| 111 | 115 |
| 112 void DoInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { | 116 void DoInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 113 flip_mark(); | 117 flip_mark(); |
| 118 ASSERT(successor_ != NULL); |
| 114 if (successor_->mark() != mark()) successor_->Postorder(block_entries); | 119 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 115 } | 120 } |
| 116 | 121 |
| 117 | 122 |
| 118 void BindInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { | 123 void BindInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 119 flip_mark(); | 124 flip_mark(); |
| 125 ASSERT(successor_ != NULL); |
| 120 if (successor_->mark() != mark()) successor_->Postorder(block_entries); | 126 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 121 } | 127 } |
| 122 | 128 |
| 123 | 129 |
| 124 void ReturnInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { | 130 void ReturnInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 125 flip_mark(); | 131 flip_mark(); |
| 126 } | 132 } |
| 127 | 133 |
| 128 | 134 |
| 129 void BranchInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { | 135 void BranchInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 130 flip_mark(); | 136 flip_mark(); |
| 131 // Visit the false successor before the true successor so they appear in | 137 // Visit the false successor before the true successor so they appear in |
| 132 // true/false order in reverse postorder. | 138 // true/false order in reverse postorder. |
| 133 ASSERT(false_successor_ != NULL); | 139 ASSERT(false_successor_ != NULL); |
| 134 ASSERT(true_successor_ != NULL); | 140 ASSERT(true_successor_ != NULL); |
| 135 if (false_successor_->mark() != mark()) { | 141 if (false_successor_->mark() != mark()) { |
| 136 false_successor_->Postorder(block_entries); | 142 false_successor_->Postorder(block_entries); |
| 137 } | 143 } |
| 138 if (true_successor_->mark() != mark()) { | 144 if (true_successor_->mark() != mark()) { |
| 139 true_successor_->Postorder(block_entries); | 145 true_successor_->Postorder(block_entries); |
| 140 } | 146 } |
| 141 } | 147 } |
| 142 | 148 |
| 143 | 149 |
| 144 } // namespace dart | 150 } // namespace dart |
| OLD | NEW |