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

Unified Diff: src/lithium-allocator-inl.h

Issue 7348008: Merge up to 8597 to experimental/gc from the bleeding edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 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 | « src/lithium-allocator.cc ('k') | src/liveedit.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lithium-allocator-inl.h
===================================================================
--- src/lithium-allocator-inl.h (revision 8618)
+++ src/lithium-allocator-inl.h (working copy)
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -62,27 +62,27 @@
: instr_(instr),
limit_(instr->TempCount()),
current_(0) {
- current_ = AdvanceToNext(0);
+ SkipUninteresting();
}
-bool TempIterator::HasNext() { return current_ < limit_; }
+bool TempIterator::Done() { return current_ >= limit_; }
-LOperand* TempIterator::Next() {
- ASSERT(HasNext());
+LOperand* TempIterator::Current() {
+ ASSERT(!Done());
return instr_->TempAt(current_);
}
-int TempIterator::AdvanceToNext(int start) {
- while (start < limit_ && instr_->TempAt(start) == NULL) start++;
- return start;
+void TempIterator::SkipUninteresting() {
+ while (current_ < limit_ && instr_->TempAt(current_) == NULL) ++current_;
}
void TempIterator::Advance() {
- current_ = AdvanceToNext(current_ + 1);
+ ++current_;
+ SkipUninteresting();
}
@@ -90,27 +90,29 @@
: instr_(instr),
limit_(instr->InputCount()),
current_(0) {
- current_ = AdvanceToNext(0);
+ SkipUninteresting();
}
-bool InputIterator::HasNext() { return current_ < limit_; }
+bool InputIterator::Done() { return current_ >= limit_; }
-LOperand* InputIterator::Next() {
- ASSERT(HasNext());
+LOperand* InputIterator::Current() {
+ ASSERT(!Done());
return instr_->InputAt(current_);
}
void InputIterator::Advance() {
- current_ = AdvanceToNext(current_ + 1);
+ ++current_;
+ SkipUninteresting();
}
-int InputIterator::AdvanceToNext(int start) {
- while (start < limit_ && instr_->InputAt(start)->IsConstantOperand()) start++;
- return start;
+void InputIterator::SkipUninteresting() {
+ while (current_ < limit_ && instr_->InputAt(current_)->IsConstantOperand()) {
+ ++current_;
+ }
}
@@ -118,23 +120,23 @@
: input_iterator_(instr), env_iterator_(instr->environment()) { }
-bool UseIterator::HasNext() {
- return input_iterator_.HasNext() || env_iterator_.HasNext();
+bool UseIterator::Done() {
+ return input_iterator_.Done() && env_iterator_.Done();
}
-LOperand* UseIterator::Next() {
- ASSERT(HasNext());
- return input_iterator_.HasNext()
- ? input_iterator_.Next()
- : env_iterator_.Next();
+LOperand* UseIterator::Current() {
+ ASSERT(!Done());
+ return input_iterator_.Done()
+ ? env_iterator_.Current()
+ : input_iterator_.Current();
}
void UseIterator::Advance() {
- input_iterator_.HasNext()
- ? input_iterator_.Advance()
- : env_iterator_.Advance();
+ input_iterator_.Done()
+ ? env_iterator_.Advance()
+ : input_iterator_.Advance();
}
} } // namespace v8::internal
« no previous file with comments | « src/lithium-allocator.cc ('k') | src/liveedit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698