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

Unified Diff: src/heap.h

Issue 7149016: Multi-page growing and shrinking new-space (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Address review comments Created 9 years, 6 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 | « no previous file | src/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index ae6cc5b37459a01b72d9d456c049acc6f5818df0..fd79d4ad1eb59ebbb2ee5c19f24895c105d41484 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -265,22 +265,37 @@ class PromotionQueue {
PromotionQueue() : front_(NULL), rear_(NULL) { }
void Initialize(Address start_address) {
+ // Assumes that a NewSpacePage exactly fits a number of promotion queue
+ // entries (where each is a pair of intptr_t). This allows us to simplify
+ // the test fpr when to switch pages.
+ ASSERT((Page::kPageSize - MemoryChunk::kBodyOffset) % (2 * kPointerSize)
+ == 0);
+ ASSERT(NewSpacePage::IsAtEnd(start_address));
front_ = rear_ = reinterpret_cast<intptr_t*>(start_address);
}
- bool is_empty() { return front_ <= rear_; }
+ bool is_empty() { return front_ == rear_; }
inline void insert(HeapObject* target, int size);
void remove(HeapObject** target, int* size) {
+ ASSERT(!is_empty());
+ if (NewSpacePage::IsAtStart(reinterpret_cast<Address>(front_))) {
+ NewSpacePage* front_page =
+ NewSpacePage::FromAddress(reinterpret_cast<Address>(front_));
+ ASSERT(!front_page->prev_page()->is_anchor());
+ front_ =
+ reinterpret_cast<intptr_t*>(front_page->prev_page()->body_limit());
+ }
*target = reinterpret_cast<HeapObject*>(*(--front_));
*size = static_cast<int>(*(--front_));
// Assert no underflow.
- ASSERT(front_ >= rear_);
+ SemiSpace::AssertValidRange(reinterpret_cast<Address>(rear_),
+ reinterpret_cast<Address>(front_));
}
private:
- // The front of the queue is higher in memory than the rear.
+ // The front of the queue is higher in the memory page chain than the rear.
intptr_t* front_;
intptr_t* rear_;
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698