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

Unified Diff: src/heap/spaces.h

Issue 1809863003: [heap] Remove separate constant for newspace page allocatable size (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.h
diff --git a/src/heap/spaces.h b/src/heap/spaces.h
index 8ac8103f17d98f5b2ce52b73a176b41b5829b02b..75b9752b5b48289478f207ec92f93e67263f9b69 100644
--- a/src/heap/spaces.h
+++ b/src/heap/spaces.h
@@ -417,6 +417,12 @@ class MemoryChunk {
static const int kFlagsOffset = kPointerSize;
+ // Page size in bytes. This must be a multiple of the OS page size.
+ static const int kPageSize = 1 << kPageSizeBits;
+ static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1;
+
+ static const int kAllocatableMemory = kPageSize - kObjectStartOffset;
+
static inline void IncrementLiveBytesFromMutator(HeapObject* object, int by);
static inline void IncrementLiveBytesFromGC(HeapObject* object, int by);
@@ -778,9 +784,6 @@ class Page : public MemoryChunk {
// ---------------------------------------------------------------------
- // Page size in bytes. This must be a multiple of the OS page size.
- static const int kPageSize = 1 << kPageSizeBits;
-
// Maximum object size that gets allocated into regular pages. Objects larger
// than that size are allocated in large object space and are never moved in
// memory. This also applies to new space allocation, since objects are never
@@ -790,11 +793,6 @@ class Page : public MemoryChunk {
// short living objects >256K.
static const int kMaxRegularHeapObjectSize = 600 * KB;
- static const int kAllocatableMemory = kPageSize - kObjectStartOffset;
-
- // Page size mask.
- static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1;
-
inline void ClearGCFields();
static inline Page* Initialize(Heap* heap, MemoryChunk* chunk,
@@ -2198,30 +2196,6 @@ enum SemiSpaceId { kFromSpace = 0, kToSpace = 1 };
class NewSpacePage : public MemoryChunk {
public:
- // GC related flags copied from from-space to to-space when
- // flipping semispaces.
- static const intptr_t kCopyOnFlipFlagsMask =
- (1 << MemoryChunk::POINTERS_TO_HERE_ARE_INTERESTING) |
- (1 << MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING);
-
- static const int kAreaSize = Page::kAllocatableMemory;
Michael Lippautz 2016/03/17 10:13:43 Now available on MemoryChunk since the allocatable
-
- inline NewSpacePage* next_page() {
- return static_cast<NewSpacePage*>(next_chunk());
- }
-
- inline void set_next_page(NewSpacePage* page) { set_next_chunk(page); }
-
- inline NewSpacePage* prev_page() {
- return static_cast<NewSpacePage*>(prev_chunk());
- }
-
- inline void set_prev_page(NewSpacePage* page) { set_prev_chunk(page); }
-
- SemiSpace* semi_space() { return reinterpret_cast<SemiSpace*>(owner()); }
-
- bool is_anchor() { return !this->InNewSpace(); }
-
static bool IsAtStart(Address addr) {
return (reinterpret_cast<intptr_t>(addr) & Page::kPageAlignmentMask) ==
kObjectStartOffset;
@@ -2231,8 +2205,6 @@ class NewSpacePage : public MemoryChunk {
return (reinterpret_cast<intptr_t>(addr) & Page::kPageAlignmentMask) == 0;
}
- Address address() { return reinterpret_cast<Address>(this); }
Michael Lippautz 2016/03/17 10:13:43 dead code
-
// Finds the NewSpacePage containing the given address.
static inline NewSpacePage* FromAddress(Address address_in_page) {
Address page_start =
@@ -2254,7 +2226,29 @@ class NewSpacePage : public MemoryChunk {
NewSpacePage::FromAddress(address2);
}
+ inline NewSpacePage* next_page() {
+ return static_cast<NewSpacePage*>(next_chunk());
+ }
+
+ inline void set_next_page(NewSpacePage* page) { set_next_chunk(page); }
+
+ inline NewSpacePage* prev_page() {
+ return static_cast<NewSpacePage*>(prev_chunk());
+ }
+
+ inline void set_prev_page(NewSpacePage* page) { set_prev_chunk(page); }
+
+ SemiSpace* semi_space() { return reinterpret_cast<SemiSpace*>(owner()); }
+
+ bool is_anchor() { return !this->InNewSpace(); }
+
private:
+ // GC related flags copied from from-space to to-space when
+ // flipping semispaces.
+ static const intptr_t kCopyOnFlipFlagsMask =
+ (1 << MemoryChunk::POINTERS_TO_HERE_ARE_INTERESTING) |
+ (1 << MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING);
+
// Create a NewSpacePage object that is only used as anchor
// for the doubly-linked list of real pages.
explicit NewSpacePage(SemiSpace* owner) { InitializeAsAnchor(owner); }
@@ -2531,7 +2525,7 @@ class NewSpace : public Space {
// Return the allocated bytes in the active semispace.
intptr_t Size() override {
- return pages_used_ * NewSpacePage::kAreaSize +
+ return pages_used_ * NewSpacePage::kAllocatableMemory +
static_cast<int>(top() - to_space_.page_low());
}
@@ -2544,7 +2538,7 @@ class NewSpace : public Space {
intptr_t Capacity() {
SLOW_DCHECK(to_space_.current_capacity() == from_space_.current_capacity());
return (to_space_.current_capacity() / Page::kPageSize) *
- NewSpacePage::kAreaSize;
+ NewSpacePage::kAllocatableMemory;
}
// Return the current size of a semispace, allocatable and non-allocatable
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698