Chromium Code Reviews| Index: src/heap/spaces.h |
| diff --git a/src/heap/spaces.h b/src/heap/spaces.h |
| index c468ca4d87ff8964e4a8c9fbaf8d0854571b335c..8f3746e8e43cd49393e21e22764110a20f0de6ca 100644 |
| --- a/src/heap/spaces.h |
| +++ b/src/heap/spaces.h |
| @@ -1569,51 +1569,40 @@ class PageIterator BASE_EMBEDDED { |
| // space. |
| class AllocationInfo { |
| public: |
| - AllocationInfo() : top_(nullptr), limit_(nullptr) {} |
| - AllocationInfo(Address top, Address limit) : top_(top), limit_(limit) {} |
| + AllocationInfo() { Reset(nullptr, nullptr); } |
| + AllocationInfo(Address top, Address limit) { Reset(top, limit); } |
| void Reset(Address top, Address limit) { |
| set_top(top); |
| set_limit(limit); |
| } |
| - INLINE(void set_top(Address top)) { |
| - SLOW_DCHECK(top == NULL || |
| - (reinterpret_cast<intptr_t>(top) & kHeapObjectTagMask) == 0); |
| - top_ = top; |
| + inline void set_top(Address top) { |
| + SLOW_DCHECK((reinterpret_cast<intptr_t>(top) & kHeapObjectTagMask) == 0); |
| + top_ = reinterpret_cast<intptr_t>(top) + kHeapObjectTag; |
| } |
| - INLINE(Address top()) const { |
| - SLOW_DCHECK(top_ == NULL || |
| - (reinterpret_cast<intptr_t>(top_) & kHeapObjectTagMask) == 0); |
| - return top_; |
| + inline Address top() const { |
| + SLOW_DCHECK((reinterpret_cast<intptr_t>(top_) & kHeapObjectTagMask) == |
| + kHeapObjectTag); |
| + return reinterpret_cast<Address>(top_ - kHeapObjectTag); |
| } |
| - Address* top_address() { return &top_; } |
| + Address* top_address() { return reinterpret_cast<Address*>(&top_); } |
| - INLINE(void set_limit(Address limit)) { |
| - limit_ = limit; |
| + inline void set_limit(Address limit) { |
| + limit_ = reinterpret_cast<intptr_t>(limit); |
| } |
| - INLINE(Address limit()) const { |
| - return limit_; |
| - } |
| - |
| - Address* limit_address() { return &limit_; } |
| + inline Address limit() const { return reinterpret_cast<Address>(limit_); } |
| -#ifdef DEBUG |
| - bool VerifyPagedAllocation() { |
| - return (Page::FromAllocationAreaAddress(top_) == |
| - Page::FromAllocationAreaAddress(limit_)) && |
| - (top_ <= limit_); |
| - } |
| -#endif |
| + Address* limit_address() { return reinterpret_cast<Address*>(&limit_); } |
| private: |
| - // Current allocation top. |
| - Address top_; |
| + // Current tagged allocation top. |
| + intptr_t top_; |
|
Michael Lippautz
2016/04/28 16:58:08
Pointer arithmetic out of object bounds is undefin
Hannes Payer (out of office)
2016/04/29 14:13:31
Oh boy!
|
| // Current allocation limit. |
| - Address limit_; |
| + intptr_t limit_; |
| }; |