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

Unified Diff: src/spaces.h

Issue 7149016: Multi-page growing and shrinking new-space (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: 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
Index: src/spaces.h
diff --git a/src/spaces.h b/src/spaces.h
index c72fa7f82c5987c7f77e5cd3d21947f9a7ef8dd1..a910dac6663ecc8be93aa227881805ca481b5185 100644
--- a/src/spaces.h
+++ b/src/spaces.h
@@ -1528,6 +1528,15 @@ class NewSpacePage : public MemoryChunk {
bool is_anchor() { return !this->InNewSpace(); }
+ static bool at_start(Address addr) {
Erik Corry 2011/06/14 12:17:17 AtStart() or IsAtStart()
Lasse Reichstein 2011/06/14 14:13:03 Done
+ return (reinterpret_cast<intptr_t>(addr) & Page::kPageAlignmentMask)
+ == kObjectStartOffset;
+ }
+
+ static bool at_end(Address addr) {
Erik Corry 2011/06/14 12:17:17 & here
Lasse Reichstein 2011/06/14 14:13:03 do.
+ return (reinterpret_cast<intptr_t>(addr) & Page::kPageAlignmentMask) == 0;
+ }
+
// Finds the NewSpacePage containg the given address.
static inline NewSpacePage* FromAddress(Address address_in_page) {
Address page_start =
@@ -1632,7 +1641,7 @@ class SemiSpace : public Space {
bool AdvancePage() {
NewSpacePage* next_page = current_page_->next_page();
- if (next_page == &anchor_) return false;
+ if (next_page == anchor()) return false;
current_page_ = next_page;
return true;
}
@@ -1672,7 +1681,13 @@ class SemiSpace : public Space {
#ifdef DEBUG
virtual void Print();
virtual void Verify();
- static void ValidateRange(Address from, Address to);
+ // Validate a range of of addresses in a SemiSpace.
+ // The "from" address must be on a page prior to the "to" address,
+ // in the linked page order, or it must be earlier on the same page.
+ static void AssertValidRange(Address from, Address to);
+#else
+ // Do nothing.
+ inline static void AssertValidRange(Address from, Address to) {}
#endif
// Returns the current capacity of the semi space.
@@ -1746,8 +1761,8 @@ class SemiSpaceIterator : public ObjectIterator {
HeapObject* Next() {
if (current_ == limit_) return NULL;
- if (current_ == current_page_limit_) {
- NewSpacePage* page = NewSpacePage::FromAddress(current_ - 1);
+ if (NewSpacePage::at_end(current_)) {
+ NewSpacePage* page = NewSpacePage::FromLimit(current_);
page = page->next_page();
ASSERT(!page->is_anchor());
current_ = page->body();
@@ -1771,8 +1786,6 @@ class SemiSpaceIterator : public ObjectIterator {
// The current iteration point.
Address current_;
- // The end of the current page.
- Address current_page_limit_;
// The end of iteration.
Address limit_;
// The callback function.
@@ -1946,12 +1959,12 @@ class NewSpace : public Space {
void ResetAllocationInfo();
void LowerInlineAllocationLimit(intptr_t step) {
- inline_alloction_limit_step_ = step;
+ inline_allocation_limit_step_ = step;
if (step == 0) {
allocation_info_.limit = to_space_.page_high();
} else {
allocation_info_.limit = Min(
- allocation_info_.top + inline_alloction_limit_step_,
+ allocation_info_.top + inline_allocation_limit_step_,
allocation_info_.limit);
}
top_on_previous_step_ = allocation_info_.top;
@@ -2044,17 +2057,11 @@ class NewSpace : public Space {
return from_space_.Uncommit();
}
- inline intptr_t inline_alloction_limit_step() {
- return inline_alloction_limit_step_;
+ inline intptr_t inline_allocation_limit_step() {
+ return inline_allocation_limit_step_;
}
- NewSpacePage* ActivePage() {
- return to_space_.current_page();
- }
-
- NewSpacePage* InactivePage() {
- return from_space_.current_page();
- }
+ SemiSpace* active_space() { return &to_space_; }
private:
// Update allocation info to match the current to-space page.
@@ -2081,7 +2088,7 @@ class NewSpace : public Space {
// to be lower than actual limit and then will gradually increase it
// in steps to guarantee that we do incremental marking steps even
// when all allocation is performed from inlined generated code.
- intptr_t inline_alloction_limit_step_;
+ intptr_t inline_allocation_limit_step_;
Address top_on_previous_step_;

Powered by Google App Engine
This is Rietveld 408576698