Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: vm/intermediate_language.h

Issue 10796108: Add a backward instruction iterator and use it in the liveness analysis. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vm/flow_graph_allocator.cc ('k') | vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/intermediate_language.h
===================================================================
--- vm/intermediate_language.h (revision 9874)
+++ 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_; }
+
+ private:
+ BlockEntryInstr* block_entry_;
+ Instruction* current_;
+};
+
+
class GraphEntryInstr : public BlockEntryInstr {
public:
explicit GraphEntryInstr(TargetEntryInstr* normal_entry)
« no previous file with comments | « vm/flow_graph_allocator.cc ('k') | vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698