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

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
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)

Powered by Google App Engine
This is Rietveld 408576698