From cd2065be009aba7512678da35ec3adf5b13aad8f Mon Sep 17 00:00:00 2001 From: "mikhail.naganov@gmail.com" Date: Tue, 20 Oct 2009 23:25:05 +0000 Subject: [PATCH] applied patch git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3098 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/heap-profiler.cc | 6 ++++-- src/spaces-inl.h | 7 +++++++ src/spaces.cc | 6 ++---- src/spaces.h | 2 ++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/heap-profiler.cc b/src/heap-profiler.cc index 8f55ce1..f80c9a0 100644 --- a/src/heap-profiler.cc +++ b/src/heap-profiler.cc @@ -576,8 +576,10 @@ void RetainerHeapProfile::PrintStats() { void HeapProfiler::CollectStats(HeapObject* obj, HistogramInfo* info) { InstanceType type = obj->map()->instance_type(); ASSERT(0 <= type && type <= LAST_TYPE); - info[type].increment_number(1); - info[type].increment_bytes(obj->Size()); + if (!FreeListNode::IsFreeListNode(obj)) { + info[type].increment_number(1); + info[type].increment_bytes(obj->Size()); + } } diff --git a/src/spaces-inl.h b/src/spaces-inl.h index da72497..847bb9a 100644 --- a/src/spaces-inl.h +++ b/src/spaces-inl.h @@ -360,6 +360,13 @@ Object* NewSpace::AllocateRawInternal(int size_in_bytes, return obj; } + +bool FreeListNode::IsFreeListNode(HeapObject* object) { + return object->map() == Heap::raw_unchecked_byte_array_map() + || object->map() == Heap::raw_unchecked_one_pointer_filler_map() + || object->map() == Heap::raw_unchecked_two_pointer_filler_map(); +} + } } // namespace v8::internal #endif // V8_SPACES_INL_H_ diff --git a/src/spaces.cc b/src/spaces.cc index 43abaa4..7014172 100644 --- a/src/spaces.cc +++ b/src/spaces.cc @@ -1540,8 +1540,7 @@ void FreeListNode::set_size(int size_in_bytes) { Address FreeListNode::next() { - ASSERT(map() == Heap::raw_unchecked_byte_array_map() || - map() == Heap::raw_unchecked_two_pointer_filler_map()); + ASSERT(IsFreeListNode(this)); if (map() == Heap::raw_unchecked_byte_array_map()) { ASSERT(Size() >= kNextOffset + kPointerSize); return Memory::Address_at(address() + kNextOffset); @@ -1552,8 +1551,7 @@ Address FreeListNode::next() { void FreeListNode::set_next(Address next) { - ASSERT(map() == Heap::raw_unchecked_byte_array_map() || - map() == Heap::raw_unchecked_two_pointer_filler_map()); + ASSERT(IsFreeListNode(this)); if (map() == Heap::raw_unchecked_byte_array_map()) { ASSERT(Size() >= kNextOffset + kPointerSize); Memory::Address_at(address() + kNextOffset) = next; diff --git a/src/spaces.h b/src/spaces.h index 92f9f81..9e1d873 100644 --- a/src/spaces.h +++ b/src/spaces.h @@ -1435,6 +1435,8 @@ class FreeListNode: public HeapObject { return reinterpret_cast(HeapObject::FromAddress(address)); } + static inline bool IsFreeListNode(HeapObject* object); + // Set the size in bytes, which can be read with HeapObject::Size(). This // function also writes a map to the first word of the block so that it // looks like a heap object to the garbage collector and heap iteration -- 2.7.4