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

Unified Diff: vm/pages.h

Issue 11265026: - Consolidate code into the old generation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 2 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
« vm/gc_sweeper.cc ('K') | « vm/object.cc ('k') | vm/pages.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/pages.h
===================================================================
--- vm/pages.h (revision 14048)
+++ vm/pages.h (working copy)
@@ -21,6 +21,12 @@
// able to get to a HeapPage header quickly based on a pointer to an object.
class HeapPage {
public:
+ enum PageType {
+ kData = 0,
+ kExecutable,
+ kNumPageTypes
+ };
+
HeapPage* next() const { return next_; }
void set_next(HeapPage* next) { next_ = next; }
@@ -29,7 +35,8 @@
}
uword object_start() const {
- return (reinterpret_cast<uword>(this) + sizeof(HeapPage));
+ return (reinterpret_cast<uword>(this) +
+ Utils::RoundUp(sizeof(HeapPage), kObjectAlignment));
}
uword object_end() const {
return object_end_;
@@ -41,6 +48,10 @@
used_ += size;
}
+ PageType type() const {
+ return executable_ ? kExecutable : kData;
+ }
+
void VisitObjects(ObjectVisitor* visitor) const;
void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
@@ -54,8 +65,8 @@
object_end_ = val;
}
- static HeapPage* Initialize(VirtualMemory* memory, bool is_executable);
- static HeapPage* Allocate(intptr_t size, bool is_executable);
+ static HeapPage* Initialize(VirtualMemory* memory, PageType type);
+ static HeapPage* Allocate(intptr_t size, PageType type);
// Deallocate the virtual memory backing this page. The page pointer to this
// page becomes immediately inaccessible.
@@ -65,6 +76,7 @@
HeapPage* next_;
uword used_;
uword object_end_;
+ bool executable_;
friend class PageSpace;
@@ -157,16 +169,18 @@
kForceGrowth
};
- PageSpace(Heap* heap, intptr_t max_capacity, bool is_executable = false);
+ PageSpace(Heap* heap, intptr_t max_capacity);
~PageSpace();
- uword TryAllocate(intptr_t size);
- uword TryAllocate(intptr_t size, GrowthPolicy growth_policy);
+ uword TryAllocate(intptr_t size,
+ HeapPage::PageType type = HeapPage::kData,
+ GrowthPolicy growth_policy = kControlGrowth);
intptr_t in_use() const { return in_use_; }
intptr_t capacity() const { return capacity_; }
bool Contains(uword addr) const;
+ bool Contains(uword addr, HeapPage::PageType type) const;
bool IsValidAddress(uword addr) const {
return Contains(addr);
}
@@ -177,7 +191,8 @@
void VisitObjects(ObjectVisitor* visitor) const;
void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
- RawObject* FindObject(FindObjectVisitor* visitor) const;
+ RawObject* FindObject(FindObjectVisitor* visitor,
+ HeapPage::PageType type) const;
// Collect the garbage in the page space using mark-sweep.
void MarkSweep(bool invoke_api_callbacks, const char* gc_reason);
@@ -208,9 +223,9 @@
private:
static const intptr_t kAllocatablePageSize = kPageSize - sizeof(HeapPage);
- HeapPage* AllocatePage();
+ HeapPage* AllocatePage(HeapPage::PageType type);
void FreePage(HeapPage* page, HeapPage* previous_page);
- HeapPage* AllocateLargePage(intptr_t size);
+ HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type);
void FreeLargePage(HeapPage* page, HeapPage* previous_page);
void FreePages(HeapPage* pages);
@@ -221,7 +236,7 @@
return increase <= (max_capacity_ - capacity_);
}
- FreeList freelist_;
+ FreeList freelist_[HeapPage::kNumPageTypes];
Heap* heap_;
@@ -239,8 +254,6 @@
// Old-gen GC cycle count.
int count_;
- bool is_executable_;
-
// Keep track whether a MarkSweep is currently running.
bool sweeping_;
« vm/gc_sweeper.cc ('K') | « vm/object.cc ('k') | vm/pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698