| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 | 1563 |
| 1564 void MarkCompactMarkingVisitor::ObjectStatsCountFixedArray( | 1564 void MarkCompactMarkingVisitor::ObjectStatsCountFixedArray( |
| 1565 FixedArrayBase* fixed_array, | 1565 FixedArrayBase* fixed_array, |
| 1566 FixedArraySubInstanceType fast_type, | 1566 FixedArraySubInstanceType fast_type, |
| 1567 FixedArraySubInstanceType dictionary_type) { | 1567 FixedArraySubInstanceType dictionary_type) { |
| 1568 Heap* heap = fixed_array->map()->GetHeap(); | 1568 Heap* heap = fixed_array->map()->GetHeap(); |
| 1569 if (fixed_array->map() != heap->fixed_cow_array_map() && | 1569 if (fixed_array->map() != heap->fixed_cow_array_map() && |
| 1570 fixed_array->map() != heap->fixed_double_array_map() && | 1570 fixed_array->map() != heap->fixed_double_array_map() && |
| 1571 fixed_array != heap->empty_fixed_array()) { | 1571 fixed_array != heap->empty_fixed_array()) { |
| 1572 if (fixed_array->IsDictionary()) { | 1572 if (fixed_array->IsDictionary()) { |
| 1573 heap->RecordObjectStats(FIXED_ARRAY_TYPE, | 1573 heap->RecordFixedArraySubTypeStats(dictionary_type, |
| 1574 dictionary_type, | 1574 fixed_array->Size()); |
| 1575 fixed_array->Size()); | |
| 1576 } else { | 1575 } else { |
| 1577 heap->RecordObjectStats(FIXED_ARRAY_TYPE, | 1576 heap->RecordFixedArraySubTypeStats(fast_type, |
| 1578 fast_type, | 1577 fixed_array->Size()); |
| 1579 fixed_array->Size()); | |
| 1580 } | 1578 } |
| 1581 } | 1579 } |
| 1582 } | 1580 } |
| 1583 | 1581 |
| 1584 | 1582 |
| 1585 void MarkCompactMarkingVisitor::ObjectStatsVisitBase( | 1583 void MarkCompactMarkingVisitor::ObjectStatsVisitBase( |
| 1586 MarkCompactMarkingVisitor::VisitorId id, Map* map, HeapObject* obj) { | 1584 MarkCompactMarkingVisitor::VisitorId id, Map* map, HeapObject* obj) { |
| 1587 Heap* heap = map->GetHeap(); | 1585 Heap* heap = map->GetHeap(); |
| 1588 int object_size = obj->Size(); | 1586 int object_size = obj->Size(); |
| 1589 heap->RecordObjectStats(map->instance_type(), -1, object_size); | 1587 heap->RecordObjectStats(map->instance_type(), object_size); |
| 1590 non_count_table_.GetVisitorById(id)(map, obj); | 1588 non_count_table_.GetVisitorById(id)(map, obj); |
| 1591 if (obj->IsJSObject()) { | 1589 if (obj->IsJSObject()) { |
| 1592 JSObject* object = JSObject::cast(obj); | 1590 JSObject* object = JSObject::cast(obj); |
| 1593 ObjectStatsCountFixedArray(object->elements(), | 1591 ObjectStatsCountFixedArray(object->elements(), |
| 1594 DICTIONARY_ELEMENTS_SUB_TYPE, | 1592 DICTIONARY_ELEMENTS_SUB_TYPE, |
| 1595 FAST_ELEMENTS_SUB_TYPE); | 1593 FAST_ELEMENTS_SUB_TYPE); |
| 1596 ObjectStatsCountFixedArray(object->properties(), | 1594 ObjectStatsCountFixedArray(object->properties(), |
| 1597 DICTIONARY_PROPERTIES_SUB_TYPE, | 1595 DICTIONARY_PROPERTIES_SUB_TYPE, |
| 1598 FAST_PROPERTIES_SUB_TYPE); | 1596 FAST_PROPERTIES_SUB_TYPE); |
| 1599 } | 1597 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1612 MarkCompactMarkingVisitor::kVisitMap> { | 1610 MarkCompactMarkingVisitor::kVisitMap> { |
| 1613 public: | 1611 public: |
| 1614 static inline void Visit(Map* map, HeapObject* obj) { | 1612 static inline void Visit(Map* map, HeapObject* obj) { |
| 1615 Heap* heap = map->GetHeap(); | 1613 Heap* heap = map->GetHeap(); |
| 1616 Map* map_obj = Map::cast(obj); | 1614 Map* map_obj = Map::cast(obj); |
| 1617 ASSERT(map->instance_type() == MAP_TYPE); | 1615 ASSERT(map->instance_type() == MAP_TYPE); |
| 1618 DescriptorArray* array = map_obj->instance_descriptors(); | 1616 DescriptorArray* array = map_obj->instance_descriptors(); |
| 1619 if (map_obj->owns_descriptors() && | 1617 if (map_obj->owns_descriptors() && |
| 1620 array != heap->empty_descriptor_array()) { | 1618 array != heap->empty_descriptor_array()) { |
| 1621 int fixed_array_size = array->Size(); | 1619 int fixed_array_size = array->Size(); |
| 1622 heap->RecordObjectStats(FIXED_ARRAY_TYPE, | 1620 heap->RecordFixedArraySubTypeStats(DESCRIPTOR_ARRAY_SUB_TYPE, |
| 1623 DESCRIPTOR_ARRAY_SUB_TYPE, | 1621 fixed_array_size); |
| 1624 fixed_array_size); | |
| 1625 } | 1622 } |
| 1626 if (map_obj->HasTransitionArray()) { | 1623 if (map_obj->HasTransitionArray()) { |
| 1627 int fixed_array_size = map_obj->transitions()->Size(); | 1624 int fixed_array_size = map_obj->transitions()->Size(); |
| 1628 heap->RecordObjectStats(FIXED_ARRAY_TYPE, | 1625 heap->RecordFixedArraySubTypeStats(TRANSITION_ARRAY_SUB_TYPE, |
| 1629 TRANSITION_ARRAY_SUB_TYPE, | 1626 fixed_array_size); |
| 1630 fixed_array_size); | |
| 1631 } | 1627 } |
| 1632 if (map_obj->has_code_cache()) { | 1628 if (map_obj->has_code_cache()) { |
| 1633 CodeCache* cache = CodeCache::cast(map_obj->code_cache()); | 1629 CodeCache* cache = CodeCache::cast(map_obj->code_cache()); |
| 1634 heap->RecordObjectStats( | 1630 heap->RecordFixedArraySubTypeStats(MAP_CODE_CACHE_SUB_TYPE, |
| 1635 FIXED_ARRAY_TYPE, | 1631 cache->default_cache()->Size()); |
| 1636 MAP_CODE_CACHE_SUB_TYPE, | |
| 1637 cache->default_cache()->Size()); | |
| 1638 if (!cache->normal_type_cache()->IsUndefined()) { | 1632 if (!cache->normal_type_cache()->IsUndefined()) { |
| 1639 heap->RecordObjectStats( | 1633 heap->RecordFixedArraySubTypeStats( |
| 1640 FIXED_ARRAY_TYPE, | |
| 1641 MAP_CODE_CACHE_SUB_TYPE, | 1634 MAP_CODE_CACHE_SUB_TYPE, |
| 1642 FixedArray::cast(cache->normal_type_cache())->Size()); | 1635 FixedArray::cast(cache->normal_type_cache())->Size()); |
| 1643 } | 1636 } |
| 1644 } | 1637 } |
| 1645 ObjectStatsVisitBase(kVisitMap, map, obj); | 1638 ObjectStatsVisitBase(kVisitMap, map, obj); |
| 1646 } | 1639 } |
| 1647 }; | 1640 }; |
| 1648 | 1641 |
| 1649 | 1642 |
| 1650 template<> | 1643 template<> |
| 1651 class MarkCompactMarkingVisitor::ObjectStatsTracker< | 1644 class MarkCompactMarkingVisitor::ObjectStatsTracker< |
| 1652 MarkCompactMarkingVisitor::kVisitCode> { | 1645 MarkCompactMarkingVisitor::kVisitCode> { |
| 1653 public: | 1646 public: |
| 1654 static inline void Visit(Map* map, HeapObject* obj) { | 1647 static inline void Visit(Map* map, HeapObject* obj) { |
| 1655 Heap* heap = map->GetHeap(); | 1648 Heap* heap = map->GetHeap(); |
| 1656 int object_size = obj->Size(); | 1649 int object_size = obj->Size(); |
| 1657 ASSERT(map->instance_type() == CODE_TYPE); | 1650 ASSERT(map->instance_type() == CODE_TYPE); |
| 1658 heap->RecordObjectStats(CODE_TYPE, Code::cast(obj)->kind(), object_size); | 1651 Code* code_obj = Code::cast(obj); |
| 1652 heap->RecordCodeSubTypeStats(code_obj->kind(), code_obj->GetAge(), |
| 1653 object_size); |
| 1659 ObjectStatsVisitBase(kVisitCode, map, obj); | 1654 ObjectStatsVisitBase(kVisitCode, map, obj); |
| 1660 } | 1655 } |
| 1661 }; | 1656 }; |
| 1662 | 1657 |
| 1663 | 1658 |
| 1664 template<> | 1659 template<> |
| 1665 class MarkCompactMarkingVisitor::ObjectStatsTracker< | 1660 class MarkCompactMarkingVisitor::ObjectStatsTracker< |
| 1666 MarkCompactMarkingVisitor::kVisitSharedFunctionInfo> { | 1661 MarkCompactMarkingVisitor::kVisitSharedFunctionInfo> { |
| 1667 public: | 1662 public: |
| 1668 static inline void Visit(Map* map, HeapObject* obj) { | 1663 static inline void Visit(Map* map, HeapObject* obj) { |
| 1669 Heap* heap = map->GetHeap(); | 1664 Heap* heap = map->GetHeap(); |
| 1670 SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); | 1665 SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); |
| 1671 if (sfi->scope_info() != heap->empty_fixed_array()) { | 1666 if (sfi->scope_info() != heap->empty_fixed_array()) { |
| 1672 heap->RecordObjectStats( | 1667 heap->RecordFixedArraySubTypeStats( |
| 1673 FIXED_ARRAY_TYPE, | |
| 1674 SCOPE_INFO_SUB_TYPE, | 1668 SCOPE_INFO_SUB_TYPE, |
| 1675 FixedArray::cast(sfi->scope_info())->Size()); | 1669 FixedArray::cast(sfi->scope_info())->Size()); |
| 1676 } | 1670 } |
| 1677 ObjectStatsVisitBase(kVisitSharedFunctionInfo, map, obj); | 1671 ObjectStatsVisitBase(kVisitSharedFunctionInfo, map, obj); |
| 1678 } | 1672 } |
| 1679 }; | 1673 }; |
| 1680 | 1674 |
| 1681 | 1675 |
| 1682 template<> | 1676 template<> |
| 1683 class MarkCompactMarkingVisitor::ObjectStatsTracker< | 1677 class MarkCompactMarkingVisitor::ObjectStatsTracker< |
| 1684 MarkCompactMarkingVisitor::kVisitFixedArray> { | 1678 MarkCompactMarkingVisitor::kVisitFixedArray> { |
| 1685 public: | 1679 public: |
| 1686 static inline void Visit(Map* map, HeapObject* obj) { | 1680 static inline void Visit(Map* map, HeapObject* obj) { |
| 1687 Heap* heap = map->GetHeap(); | 1681 Heap* heap = map->GetHeap(); |
| 1688 FixedArray* fixed_array = FixedArray::cast(obj); | 1682 FixedArray* fixed_array = FixedArray::cast(obj); |
| 1689 if (fixed_array == heap->string_table()) { | 1683 if (fixed_array == heap->string_table()) { |
| 1690 heap->RecordObjectStats( | 1684 heap->RecordFixedArraySubTypeStats( |
| 1691 FIXED_ARRAY_TYPE, | |
| 1692 STRING_TABLE_SUB_TYPE, | 1685 STRING_TABLE_SUB_TYPE, |
| 1693 fixed_array->Size()); | 1686 fixed_array->Size()); |
| 1694 } | 1687 } |
| 1695 ObjectStatsVisitBase(kVisitFixedArray, map, obj); | 1688 ObjectStatsVisitBase(kVisitFixedArray, map, obj); |
| 1696 } | 1689 } |
| 1697 }; | 1690 }; |
| 1698 | 1691 |
| 1699 | 1692 |
| 1700 void MarkCompactMarkingVisitor::Initialize() { | 1693 void MarkCompactMarkingVisitor::Initialize() { |
| 1701 StaticMarkingVisitor<MarkCompactMarkingVisitor>::Initialize(); | 1694 StaticMarkingVisitor<MarkCompactMarkingVisitor>::Initialize(); |
| (...skipping 2657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4359 while (buffer != NULL) { | 4352 while (buffer != NULL) { |
| 4360 SlotsBuffer* next_buffer = buffer->next(); | 4353 SlotsBuffer* next_buffer = buffer->next(); |
| 4361 DeallocateBuffer(buffer); | 4354 DeallocateBuffer(buffer); |
| 4362 buffer = next_buffer; | 4355 buffer = next_buffer; |
| 4363 } | 4356 } |
| 4364 *buffer_address = NULL; | 4357 *buffer_address = NULL; |
| 4365 } | 4358 } |
| 4366 | 4359 |
| 4367 | 4360 |
| 4368 } } // namespace v8::internal | 4361 } } // namespace v8::internal |
| OLD | NEW |