From 41c6b0ba3ff2a244312887b33b4c46ed0a172d3c Mon Sep 17 00:00:00 2001 From: "hpayer@chromium.org" Date: Mon, 28 Jul 2014 18:54:06 +0000 Subject: [PATCH] Rename failure tag to page owner tag and add proper description. BUG= R=mstarzinger@chromium.org Review URL: https://codereview.chromium.org/420293003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22655 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/globals.h | 14 +++++++++----- src/spaces.h | 14 +++++++------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/globals.h b/src/globals.h index bddd4ef..5959750 100644 --- a/src/globals.h +++ b/src/globals.h @@ -216,11 +216,15 @@ const int kCodeAlignmentBits = 5; const intptr_t kCodeAlignment = 1 << kCodeAlignmentBits; const intptr_t kCodeAlignmentMask = kCodeAlignment - 1; -// Tag information for Failure. -// TODO(yangguo): remove this from space owner calculation. -const int kFailureTag = 3; -const int kFailureTagSize = 2; -const intptr_t kFailureTagMask = (1 << kFailureTagSize) - 1; +// The owner field of a page is tagged with the page header tag. We need that +// to find out if a slot is part of a large object. If we mask out the lower +// 0xfffff bits (1M pages), go to the owner offset, and see that this field +// is tagged with the page header tag, we can just look up the owner. +// Otherwise, we know that we are somewhere (not within the first 1M) in a +// large object. +const int kPageHeaderTag = 3; +const int kPageHeaderTagSize = 2; +const intptr_t kPageHeaderTagMask = (1 << kPageHeaderTagSize) - 1; // Zap-value: The value used for zapping dead objects. diff --git a/src/spaces.h b/src/spaces.h index 3103204..3fe71b2 100644 --- a/src/spaces.h +++ b/src/spaces.h @@ -312,20 +312,20 @@ class MemoryChunk { } Space* owner() const { - if ((reinterpret_cast(owner_) & kFailureTagMask) == - kFailureTag) { + if ((reinterpret_cast(owner_) & kPageHeaderTagMask) == + kPageHeaderTag) { return reinterpret_cast(reinterpret_cast(owner_) - - kFailureTag); + kPageHeaderTag); } else { return NULL; } } void set_owner(Space* space) { - ASSERT((reinterpret_cast(space) & kFailureTagMask) == 0); - owner_ = reinterpret_cast
(space) + kFailureTag; - ASSERT((reinterpret_cast(owner_) & kFailureTagMask) == - kFailureTag); + ASSERT((reinterpret_cast(space) & kPageHeaderTagMask) == 0); + owner_ = reinterpret_cast
(space) + kPageHeaderTag; + ASSERT((reinterpret_cast(owner_) & kPageHeaderTagMask) == + kPageHeaderTag); } base::VirtualMemory* reserved_memory() { -- 2.7.4