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

Unified Diff: src/heap/spaces.h

Issue 2028633002: Provide a tagged allocation top pointer. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP: adding a few tests. Created 4 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
« no previous file with comments | « src/globals.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | 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 0981c3650efe8d9b6fa6b55ac4e8b06de811e6b5..216665790294ef409e7b189844c9ef55ba2794cc 100644
--- a/src/heap/spaces.h
+++ b/src/heap/spaces.h
@@ -1642,51 +1642,39 @@ 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((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 allocation limit.
- Address limit_;
+ // Current tagged allocation top.
+ intptr_t top_;
+ // Current untagged allocation limit.
+ intptr_t limit_;
};
« no previous file with comments | « src/globals.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698