Index: src/spaces.h |
diff --git a/src/spaces.h b/src/spaces.h |
index 6144c95d14d689876dc2008c5c506ecfd37faa51..c3271664bdded1031934584be9e26f6f499903f6 100644 |
--- a/src/spaces.h |
+++ b/src/spaces.h |
@@ -1317,18 +1317,53 @@ class PageIterator BASE_EMBEDDED { |
// space. |
class AllocationInfo { |
public: |
- AllocationInfo() : top(NULL), limit(NULL) { |
+ AllocationInfo() : top_(NULL), limit_(NULL) { |
} |
- Address top; // Current allocation top. |
- Address limit; // Current allocation limit. |
+ INLINE(void set_top(Address top)) { |
+ ASSERT(top == NULL || |
Michael Starzinger
2013/10/25 08:34:56
nit: As discussed offline, maybe consider making a
Hannes Payer (out of office)
2013/11/20 09:58:47
Done.
|
+ (reinterpret_cast<intptr_t>(top) & HeapObjectTagMask()) == 0); |
+ top_ = top; |
+ } |
+ |
+ INLINE(Address top()) const { |
+ ASSERT(top_ == NULL || |
+ (reinterpret_cast<intptr_t>(top_) & HeapObjectTagMask()) == 0); |
+ return top_; |
+ } |
+ |
+ Address* top_address() { |
+ return &top_; |
+ } |
+ |
+ INLINE(void set_limit(Address limit)) { |
+ ASSERT(limit == NULL || |
+ (reinterpret_cast<intptr_t>(limit) & HeapObjectTagMask()) == 0); |
+ limit_ = limit; |
+ } |
+ |
+ INLINE(Address limit()) const { |
+ ASSERT(limit_ == NULL || |
+ (reinterpret_cast<intptr_t>(limit_) & HeapObjectTagMask()) == 0); |
+ return limit_; |
+ } |
+ |
+ Address* limit_address() { |
+ return &limit_; |
+ } |
#ifdef DEBUG |
bool VerifyPagedAllocation() { |
- return (Page::FromAllocationTop(top) == Page::FromAllocationTop(limit)) |
- && (top <= limit); |
+ return (Page::FromAllocationTop(top_) == Page::FromAllocationTop(limit_)) |
+ && (top_ <= limit_); |
} |
#endif |
+ |
+ private: |
+ // Current allocation top. |
+ Address top_; |
+ // Current allocation limit. |
+ Address limit_; |
}; |
@@ -1707,12 +1742,18 @@ class PagedSpace : public Space { |
virtual intptr_t Waste() { return accounting_stats_.Waste(); } |
// Returns the allocation pointer in this space. |
- Address top() { return allocation_info_.top; } |
- Address limit() { return allocation_info_.limit; } |
+ Address top() { return allocation_info_.top(); } |
+ Address limit() { return allocation_info_.limit(); } |
+ |
+ // The allocation top address. |
+ Address* allocation_top_address() { |
+ return allocation_info_.top_address(); |
+ } |
- // The allocation top and limit addresses. |
- Address* allocation_top_address() { return &allocation_info_.top; } |
- Address* allocation_limit_address() { return &allocation_info_.limit; } |
+ // The allocation limit address. |
+ Address* allocation_limit_address() { |
+ return allocation_info_.limit_address(); |
+ } |
enum AllocationType { |
NEW_OBJECT, |
@@ -1745,9 +1786,9 @@ class PagedSpace : public Space { |
void SetTop(Address top, Address limit) { |
ASSERT(top == limit || |
Page::FromAddress(top) == Page::FromAddress(limit - 1)); |
- MemoryChunk::UpdateHighWaterMark(allocation_info_.top); |
- allocation_info_.top = top; |
- allocation_info_.limit = limit; |
+ MemoryChunk::UpdateHighWaterMark(allocation_info_.top()); |
+ allocation_info_.set_top(top); |
+ allocation_info_.set_limit(limit); |
} |
void Allocate(int bytes) { |
@@ -2388,9 +2429,15 @@ class NewSpace : public Space { |
// Return the address of the allocation pointer in the active semispace. |
Address top() { |
- ASSERT(to_space_.current_page()->ContainsLimit(allocation_info_.top)); |
- return allocation_info_.top; |
+ ASSERT(to_space_.current_page()->ContainsLimit(allocation_info_.top())); |
+ return allocation_info_.top(); |
} |
+ |
+ void set_top(Address top) { |
+ ASSERT(to_space_.current_page()->ContainsLimit(top)); |
+ allocation_info_.set_top(top); |
+ } |
+ |
// Return the address of the first object in the active semispace. |
Address bottom() { return to_space_.space_start(); } |
@@ -2415,9 +2462,15 @@ class NewSpace : public Space { |
return reinterpret_cast<Address>(index << kPointerSizeLog2); |
} |
- // The allocation top and limit addresses. |
- Address* allocation_top_address() { return &allocation_info_.top; } |
- Address* allocation_limit_address() { return &allocation_info_.limit; } |
+ // The allocation top and limit address. |
+ Address* allocation_top_address() { |
+ return allocation_info_.top_address(); |
+ } |
+ |
+ // The allocation limit address. |
+ Address* allocation_limit_address() { |
+ return allocation_info_.limit_address(); |
+ } |
MUST_USE_RESULT INLINE(MaybeObject* AllocateRaw(int size_in_bytes)); |
@@ -2427,13 +2480,14 @@ class NewSpace : public Space { |
void LowerInlineAllocationLimit(intptr_t step) { |
inline_allocation_limit_step_ = step; |
if (step == 0) { |
- allocation_info_.limit = to_space_.page_high(); |
+ allocation_info_.set_limit(to_space_.page_high()); |
} else { |
- allocation_info_.limit = Min( |
- allocation_info_.top + inline_allocation_limit_step_, |
- allocation_info_.limit); |
+ Address new_limit = Min( |
+ allocation_info_.top() + inline_allocation_limit_step_, |
+ allocation_info_.limit()); |
+ allocation_info_.set_limit(new_limit); |
} |
- top_on_previous_step_ = allocation_info_.top; |
+ top_on_previous_step_ = allocation_info_.top(); |
} |
// Get the extent of the inactive semispace (for use as a marking stack, |
@@ -2580,9 +2634,9 @@ class OldSpace : public PagedSpace { |
// For contiguous spaces, top should be in the space (or at the end) and limit |
// should be the end of the space. |
#define ASSERT_SEMISPACE_ALLOCATION_INFO(info, space) \ |
- SLOW_ASSERT((space).page_low() <= (info).top \ |
- && (info).top <= (space).page_high() \ |
- && (info).limit <= (space).page_high()) |
+ SLOW_ASSERT((space).page_low() <= (info).top() \ |
+ && (info).top() <= (space).page_high() \ |
+ && (info).limit() <= (space).page_high()) |
// ----------------------------------------------------------------------------- |