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

Unified Diff: runtime/vm/intermediate_language.h

Issue 12178019: Add a use list iterator that allows mutation of current. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.h
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index cd62742709f47ad855663573cfb612b7385f1a14..11ffe568ae08918df7ee595a73018c891a61eacf 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -71,6 +71,23 @@ RECOGNIZED_LIST(DEFINE_ENUM_LIST)
class Value : public ZoneAllocated {
public:
+ // A forward iterator that allows removing the current value from the
+ // underlying use list during iteration.
+ class Iterator {
srdjan 2013/02/04 21:38:17 public ValueObject?
+ public:
+ explicit Iterator(Value* head) : next_(head) { Advance(); }
+ Value* Current() const { return current_; }
+ bool Done() const { return current_ == NULL; }
+ void Advance() {
+ // Pre-fetch next on advance and cache it.
+ current_ = next_;
+ if (next_ != NULL) next_ = next_->next_use();
+ }
+ private:
+ Value* current_;
+ Value* next_;
+ };
+
explicit Value(Definition* definition)
: definition_(definition),
previous_use_(NULL),
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698