From 884345a789f635f5af96ac5e4958612526e41ffd Mon Sep 17 00:00:00 2001 From: "bak@chromium.org" Date: Thu, 16 Oct 2008 07:17:26 +0000 Subject: [PATCH] -Eliminated a excessive memory traffic in CopyObject. Review URL: http://codereview.chromium.org/7432 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@509 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/objects-inl.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/objects-inl.h b/src/objects-inl.h index 1d0d8b2..ce2da12 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -627,23 +627,19 @@ Map* MapWord::ToMap() { bool MapWord::IsForwardingAddress() { - // This function only works for map words that are heap object pointers. - // Since it is a heap object, it has a map. We use that map's instance - // type to detect if this map word is not actually a map (ie, it is a - // forwarding address during a scavenge collection). - return reinterpret_cast(value_)->map()->instance_type() != - MAP_TYPE; + return HAS_SMI_TAG(reinterpret_cast(value_)); } MapWord MapWord::FromForwardingAddress(HeapObject* object) { - return MapWord(reinterpret_cast(object)); + Address raw = reinterpret_cast
(object) - kHeapObjectTag; + return MapWord(reinterpret_cast(raw)); } HeapObject* MapWord::ToForwardingAddress() { ASSERT(IsForwardingAddress()); - return reinterpret_cast(value_); + return HeapObject::FromAddress(reinterpret_cast
(value_)); } -- 2.7.4