| 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 15 matching lines...) Expand all Loading... |
| 26 return successor_; | 26 return successor_; |
| 27 } | 27 } |
| 28 | 28 |
| 29 | 29 |
| 30 Instruction* TargetEntryInstr::Accept(FlowGraphVisitor* visitor) { | 30 Instruction* TargetEntryInstr::Accept(FlowGraphVisitor* visitor) { |
| 31 visitor->VisitTargetEntry(this); | 31 visitor->VisitTargetEntry(this); |
| 32 return successor_; | 32 return successor_; |
| 33 } | 33 } |
| 34 | 34 |
| 35 | 35 |
| 36 Instruction* PickTempInstr::Accept(FlowGraphVisitor* visitor) { |
| 37 visitor->VisitPickTemp(this); |
| 38 return successor_; |
| 39 } |
| 40 |
| 41 |
| 42 Instruction* TuckTempInstr::Accept(FlowGraphVisitor* visitor) { |
| 43 visitor->VisitTuckTemp(this); |
| 44 return successor_; |
| 45 } |
| 46 |
| 47 |
| 36 Instruction* DoInstr::Accept(FlowGraphVisitor* visitor) { | 48 Instruction* DoInstr::Accept(FlowGraphVisitor* visitor) { |
| 37 visitor->VisitDo(this); | 49 visitor->VisitDo(this); |
| 38 return successor_; | 50 return successor_; |
| 39 } | 51 } |
| 40 | 52 |
| 41 | 53 |
| 42 Instruction* BindInstr::Accept(FlowGraphVisitor* visitor) { | 54 Instruction* BindInstr::Accept(FlowGraphVisitor* visitor) { |
| 43 visitor->VisitBind(this); | 55 visitor->VisitBind(this); |
| 44 return successor_; | 56 return successor_; |
| 45 } | 57 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 for (intptr_t i = block_order.length() - 1; i >= 0; --i) { | 75 for (intptr_t i = block_order.length() - 1; i >= 0; --i) { |
| 64 Instruction* current = block_order[i]->Accept(this); | 76 Instruction* current = block_order[i]->Accept(this); |
| 65 while ((current != NULL) && !current->IsBlockEntry()) { | 77 while ((current != NULL) && !current->IsBlockEntry()) { |
| 66 current = current->Accept(this); | 78 current = current->Accept(this); |
| 67 } | 79 } |
| 68 } | 80 } |
| 69 } | 81 } |
| 70 | 82 |
| 71 | 83 |
| 72 // ==== Postorder graph traversal. | 84 // ==== Postorder graph traversal. |
| 85 void JoinEntryInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 86 flip_mark(); |
| 87 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 88 block_entries->Add(this); |
| 89 } |
| 90 |
| 91 |
| 92 void TargetEntryInstr::Postorder( |
| 93 GrowableArray<BlockEntryInstr*>* block_entries) { |
| 94 flip_mark(); |
| 95 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 96 block_entries->Add(this); |
| 97 } |
| 98 |
| 99 |
| 100 void PickTempInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 101 flip_mark(); |
| 102 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 103 } |
| 104 |
| 105 |
| 106 void TuckTempInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 107 flip_mark(); |
| 108 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 109 } |
| 110 |
| 111 |
| 73 void DoInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { | 112 void DoInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 74 flip_mark(); | 113 flip_mark(); |
| 75 if (successor_->mark() != mark()) successor_->Postorder(block_entries); | 114 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 76 } | 115 } |
| 77 | 116 |
| 78 | 117 |
| 79 void BindInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { | 118 void BindInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { |
| 80 flip_mark(); | 119 flip_mark(); |
| 81 if (successor_->mark() != mark()) successor_->Postorder(block_entries); | 120 if (successor_->mark() != mark()) successor_->Postorder(block_entries); |
| 82 } | 121 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 93 // true/false order in reverse postorder. | 132 // true/false order in reverse postorder. |
| 94 if (false_successor_->mark() != mark()) { | 133 if (false_successor_->mark() != mark()) { |
| 95 false_successor_->Postorder(block_entries); | 134 false_successor_->Postorder(block_entries); |
| 96 } | 135 } |
| 97 if (true_successor_->mark() != mark()) { | 136 if (true_successor_->mark() != mark()) { |
| 98 true_successor_->Postorder(block_entries); | 137 true_successor_->Postorder(block_entries); |
| 99 } | 138 } |
| 100 } | 139 } |
| 101 | 140 |
| 102 | 141 |
| 103 void JoinEntryInstr::Postorder(GrowableArray<BlockEntryInstr*>* block_entries) { | |
| 104 flip_mark(); | |
| 105 if (successor_->mark() != mark()) successor_->Postorder(block_entries); | |
| 106 block_entries->Add(this); | |
| 107 } | |
| 108 | |
| 109 | |
| 110 void TargetEntryInstr::Postorder( | |
| 111 GrowableArray<BlockEntryInstr*>* block_entries) { | |
| 112 flip_mark(); | |
| 113 if (successor_->mark() != mark()) successor_->Postorder(block_entries); | |
| 114 block_entries->Add(this); | |
| 115 } | |
| 116 | |
| 117 | |
| 118 } // namespace dart | 142 } // namespace dart |
| OLD | NEW |