applied patch

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3098 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mikhail.naganov@gmail.com 2009-10-20 23:25:05 +00:00
parent 361e4bf8a9
commit cd2065be00
4 changed files with 15 additions and 6 deletions

View File

@ -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());
}
}

View File

@ -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_

View File

@ -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;

View File

@ -1435,6 +1435,8 @@ class FreeListNode: public HeapObject {
return reinterpret_cast<FreeListNode*>(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