Chromium Code Reviews| Index: vm/intermediate_language.h |
| =================================================================== |
| --- vm/intermediate_language.h (revision 9842) |
| +++ vm/intermediate_language.h (working copy) |
| @@ -1950,6 +1950,7 @@ |
| public: |
| explicit ForwardInstructionIterator(BlockEntryInstr* block_entry) |
| : block_entry_(block_entry), current_(block_entry) { |
| + ASSERT(block_entry_->last_instruction()->next() == NULL); |
| Advance(); |
| } |
| @@ -1958,9 +1959,7 @@ |
| current_ = current_->next(); |
| } |
| - bool Done() const { |
| - return current_ == block_entry_->last_instruction()->next(); |
| - } |
| + bool Done() const { return current_ == NULL; } |
| // Removes 'current_' from graph and sets 'current_' to previous instruction. |
| void RemoveCurrentFromGraph(); |
| @@ -1973,6 +1972,28 @@ |
| }; |
| +class BackwardInstructionIterator : public ValueObject { |
| + public: |
| + explicit BackwardInstructionIterator(BlockEntryInstr* block_entry) |
| + : block_entry_(block_entry), current_(block_entry->last_instruction()) { |
| + ASSERT(block_entry_->previous() == NULL); |
| + } |
| + |
| + void Advance() { |
| + ASSERT(!Done()); |
| + current_ = current_->previous(); |
| + } |
| + |
| + bool Done() const { return current_ == block_entry_; } |
| + |
| + Instruction* Current() const { return current_; } |
|
srdjan
2012/07/24 15:49:30
s/Current/current/ (also for ForwardInstructionI
Florian Schneider
2012/07/25 08:31:29
I leave it as is to be consistent with the names o
srdjan
2012/07/25 15:19:30
Yes, the consistency argument is valid.
Since lowe
|
| + |
| + private: |
| + BlockEntryInstr* block_entry_; |
| + Instruction* current_; |
| +}; |
| + |
| + |
| class GraphEntryInstr : public BlockEntryInstr { |
| public: |
| explicit GraphEntryInstr(TargetEntryInstr* normal_entry) |