Index: src/lithium.h |
diff --git a/src/lithium.h b/src/lithium.h |
index a3e574d89e32c656c8db7bafef090ea57dfc37d2..ea023a980b86fb228d93d1758a26398919dcc58a 100644 |
--- a/src/lithium.h |
+++ b/src/lithium.h |
@@ -518,34 +518,34 @@ class ShallowIterator BASE_EMBEDDED { |
: env_(env), |
limit_(env != NULL ? env->values()->length() : 0), |
current_(0) { |
- current_ = AdvanceToNext(0); |
+ SkipUninteresting(); |
} |
- inline bool HasNext() { |
- return env_ != NULL && current_ < limit_; |
- } |
+ bool Done() { return current_ >= limit_; } |
- inline LOperand* Next() { |
- ASSERT(HasNext()); |
+ LOperand* Current() { |
+ ASSERT(!Done()); |
return env_->values()->at(current_); |
} |
- inline void Advance() { |
- current_ = AdvanceToNext(current_ + 1); |
+ void Advance() { |
+ ASSERT(!Done()); |
+ ++current_; |
+ SkipUninteresting(); |
} |
- inline LEnvironment* env() { return env_; } |
+ LEnvironment* env() { return env_; } |
private: |
- inline bool ShouldSkip(LOperand* op) { |
+ bool ShouldSkip(LOperand* op) { |
return op == NULL || op->IsConstantOperand() || op->IsArgument(); |
} |
- inline int AdvanceToNext(int start) { |
- while (start < limit_ && ShouldSkip(env_->values()->at(start))) { |
- start++; |
+ // Skip until something interesting, beginning with and including current_. |
+ void SkipUninteresting() { |
+ while (current_ < limit_ && ShouldSkip(env_->values()->at(current_))) { |
+ ++current_; |
} |
- return start; |
} |
LEnvironment* env_; |
@@ -558,31 +558,27 @@ class ShallowIterator BASE_EMBEDDED { |
class DeepIterator BASE_EMBEDDED { |
public: |
explicit DeepIterator(LEnvironment* env) |
- : current_iterator_(env) { } |
- |
- inline bool HasNext() { |
- if (current_iterator_.HasNext()) return true; |
- if (current_iterator_.env() == NULL) return false; |
- AdvanceToOuter(); |
- return current_iterator_.HasNext(); |
+ : current_iterator_(env) { |
+ SkipUninteresting(); |
} |
- inline LOperand* Next() { |
- ASSERT(current_iterator_.HasNext()); |
- return current_iterator_.Next(); |
+ bool Done() { return current_iterator_.Done(); } |
+ |
+ LOperand* Current() { |
+ ASSERT(!current_iterator_.Done()); |
+ return current_iterator_.Current(); |
} |
- inline void Advance() { |
- if (current_iterator_.HasNext()) { |
- current_iterator_.Advance(); |
- } else { |
- AdvanceToOuter(); |
- } |
+ void Advance() { |
+ current_iterator_.Advance(); |
+ SkipUninteresting(); |
} |
private: |
- inline void AdvanceToOuter() { |
- current_iterator_ = ShallowIterator(current_iterator_.env()->outer()); |
+ void SkipUninteresting() { |
+ while (current_iterator_.env() != NULL && current_iterator_.Done()) { |
+ current_iterator_ = ShallowIterator(current_iterator_.env()->outer()); |
+ } |
} |
ShallowIterator current_iterator_; |