Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: src/heap-snapshot-generator.cc

Issue 19265002: Make TransitionArray internal references originate from TA in heap snapshot. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Moved TransitionArray processing into Map. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 i < Context::NATIVE_CONTEXT_SLOTS; 1102 i < Context::NATIVE_CONTEXT_SLOTS;
1103 ++i) { 1103 ++i) {
1104 SetWeakReference(context, entry, i, context->get(i), 1104 SetWeakReference(context, entry, i, context->get(i),
1105 FixedArray::OffsetOfElementAt(i)); 1105 FixedArray::OffsetOfElementAt(i));
1106 } 1106 }
1107 } 1107 }
1108 } 1108 }
1109 1109
1110 1110
1111 void V8HeapExplorer::ExtractMapReferences(int entry, Map* map) { 1111 void V8HeapExplorer::ExtractMapReferences(int entry, Map* map) {
1112 SetInternalReference(map, entry,
1113 "prototype", map->prototype(), Map::kPrototypeOffset);
1114 SetInternalReference(map, entry,
1115 "constructor", map->constructor(),
1116 Map::kConstructorOffset);
1117 if (map->HasTransitionArray()) { 1112 if (map->HasTransitionArray()) {
1118 TransitionArray* transitions = map->transitions(); 1113 TransitionArray* transitions = map->transitions();
1119 1114 int transitions_entry = GetEntry(transitions)->index();
1120 Object* back_pointer = transitions->back_pointer_storage(); 1115 Object* back_pointer = transitions->back_pointer_storage();
1121 TagObject(transitions->back_pointer_storage(), "(back pointer)"); 1116 TagObject(back_pointer, "(back pointer)");
1122 SetInternalReference(transitions, entry, 1117 SetInternalReference(transitions, transitions_entry,
1123 "backpointer", back_pointer, 1118 "back_pointer", back_pointer);
1124 TransitionArray::kBackPointerStorageOffset);
1125 IndexedReferencesExtractor transitions_refs(this, transitions, entry);
1126 transitions->Iterate(&transitions_refs);
1127
1128 TagObject(transitions, "(transition array)"); 1119 TagObject(transitions, "(transition array)");
1129 SetInternalReference(map, entry, 1120 SetInternalReference(map, entry,
1130 "transitions", transitions, 1121 "transitions", transitions,
1131 Map::kTransitionsOrBackPointerOffset); 1122 Map::kTransitionsOrBackPointerOffset);
1132 } else { 1123 } else {
1133 Object* back_pointer = map->GetBackPointer(); 1124 Object* back_pointer = map->GetBackPointer();
1134 TagObject(back_pointer, "(back pointer)"); 1125 TagObject(back_pointer, "(back pointer)");
1135 SetInternalReference(map, entry, 1126 SetInternalReference(map, entry,
1136 "backpointer", back_pointer, 1127 "back_pointer", back_pointer,
1137 Map::kTransitionsOrBackPointerOffset); 1128 Map::kTransitionsOrBackPointerOffset);
1138 } 1129 }
1139 DescriptorArray* descriptors = map->instance_descriptors(); 1130 DescriptorArray* descriptors = map->instance_descriptors();
1140 TagObject(descriptors, "(map descriptors)"); 1131 TagObject(descriptors, "(map descriptors)");
1141 SetInternalReference(map, entry, 1132 SetInternalReference(map, entry,
1142 "descriptors", descriptors, 1133 "descriptors", descriptors,
1143 Map::kDescriptorsOffset); 1134 Map::kDescriptorsOffset);
1144 1135
1145 SetInternalReference(map, entry, 1136 SetInternalReference(map, entry,
1146 "code_cache", map->code_cache(), 1137 "code_cache", map->code_cache(),
1147 Map::kCodeCacheOffset); 1138 Map::kCodeCacheOffset);
1139 SetInternalReference(map, entry,
1140 "prototype", map->prototype(), Map::kPrototypeOffset);
1141 SetInternalReference(map, entry,
1142 "constructor", map->constructor(),
1143 Map::kConstructorOffset);
1148 } 1144 }
1149 1145
1150 1146
1151 void V8HeapExplorer::ExtractSharedFunctionInfoReferences( 1147 void V8HeapExplorer::ExtractSharedFunctionInfoReferences(
1152 int entry, SharedFunctionInfo* shared) { 1148 int entry, SharedFunctionInfo* shared) {
1153 HeapObject* obj = shared; 1149 HeapObject* obj = shared;
1154 SetInternalReference(obj, entry, 1150 SetInternalReference(obj, entry,
1155 "name", shared->name(), 1151 "name", shared->name(),
1156 SharedFunctionInfo::kNameOffset); 1152 SharedFunctionInfo::kNameOffset);
1157 TagObject(shared->code(), "(code)"); 1153 TagObject(shared->code(), "(code)");
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 && object != heap_->one_pointer_filler_map() 1565 && object != heap_->one_pointer_filler_map()
1570 && object != heap_->two_pointer_filler_map(); 1566 && object != heap_->two_pointer_filler_map();
1571 } 1567 }
1572 1568
1573 1569
1574 void V8HeapExplorer::SetContextReference(HeapObject* parent_obj, 1570 void V8HeapExplorer::SetContextReference(HeapObject* parent_obj,
1575 int parent_entry, 1571 int parent_entry,
1576 String* reference_name, 1572 String* reference_name,
1577 Object* child_obj, 1573 Object* child_obj,
1578 int field_offset) { 1574 int field_offset) {
1575 ASSERT(parent_entry == GetEntry(parent_obj)->index());
1579 HeapEntry* child_entry = GetEntry(child_obj); 1576 HeapEntry* child_entry = GetEntry(child_obj);
1580 if (child_entry != NULL) { 1577 if (child_entry != NULL) {
1581 filler_->SetNamedReference(HeapGraphEdge::kContextVariable, 1578 filler_->SetNamedReference(HeapGraphEdge::kContextVariable,
1582 parent_entry, 1579 parent_entry,
1583 collection_->names()->GetName(reference_name), 1580 collection_->names()->GetName(reference_name),
1584 child_entry); 1581 child_entry);
1585 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset); 1582 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
1586 } 1583 }
1587 } 1584 }
1588 1585
1589 1586
1590 void V8HeapExplorer::SetNativeBindReference(HeapObject* parent_obj, 1587 void V8HeapExplorer::SetNativeBindReference(HeapObject* parent_obj,
1591 int parent_entry, 1588 int parent_entry,
1592 const char* reference_name, 1589 const char* reference_name,
1593 Object* child_obj) { 1590 Object* child_obj) {
1591 ASSERT(parent_entry == GetEntry(parent_obj)->index());
1594 HeapEntry* child_entry = GetEntry(child_obj); 1592 HeapEntry* child_entry = GetEntry(child_obj);
1595 if (child_entry != NULL) { 1593 if (child_entry != NULL) {
1596 filler_->SetNamedReference(HeapGraphEdge::kShortcut, 1594 filler_->SetNamedReference(HeapGraphEdge::kShortcut,
1597 parent_entry, 1595 parent_entry,
1598 reference_name, 1596 reference_name,
1599 child_entry); 1597 child_entry);
1600 } 1598 }
1601 } 1599 }
1602 1600
1603 1601
1604 void V8HeapExplorer::SetElementReference(HeapObject* parent_obj, 1602 void V8HeapExplorer::SetElementReference(HeapObject* parent_obj,
1605 int parent_entry, 1603 int parent_entry,
1606 int index, 1604 int index,
1607 Object* child_obj) { 1605 Object* child_obj) {
1606 ASSERT(parent_entry == GetEntry(parent_obj)->index());
1608 HeapEntry* child_entry = GetEntry(child_obj); 1607 HeapEntry* child_entry = GetEntry(child_obj);
1609 if (child_entry != NULL) { 1608 if (child_entry != NULL) {
1610 filler_->SetIndexedReference(HeapGraphEdge::kElement, 1609 filler_->SetIndexedReference(HeapGraphEdge::kElement,
1611 parent_entry, 1610 parent_entry,
1612 index, 1611 index,
1613 child_entry); 1612 child_entry);
1614 } 1613 }
1615 } 1614 }
1616 1615
1617 1616
1618 void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj, 1617 void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj,
1619 int parent_entry, 1618 int parent_entry,
1620 const char* reference_name, 1619 const char* reference_name,
1621 Object* child_obj, 1620 Object* child_obj,
1622 int field_offset) { 1621 int field_offset) {
1622 ASSERT(parent_entry == GetEntry(parent_obj)->index());
1623 HeapEntry* child_entry = GetEntry(child_obj); 1623 HeapEntry* child_entry = GetEntry(child_obj);
1624 if (child_entry == NULL) return; 1624 if (child_entry == NULL) return;
1625 if (IsEssentialObject(child_obj)) { 1625 if (IsEssentialObject(child_obj)) {
1626 filler_->SetNamedReference(HeapGraphEdge::kInternal, 1626 filler_->SetNamedReference(HeapGraphEdge::kInternal,
1627 parent_entry, 1627 parent_entry,
1628 reference_name, 1628 reference_name,
1629 child_entry); 1629 child_entry);
1630 } 1630 }
1631 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset); 1631 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
1632 } 1632 }
1633 1633
1634 1634
1635 void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj, 1635 void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj,
1636 int parent_entry, 1636 int parent_entry,
1637 int index, 1637 int index,
1638 Object* child_obj, 1638 Object* child_obj,
1639 int field_offset) { 1639 int field_offset) {
1640 ASSERT(parent_entry == GetEntry(parent_obj)->index());
1640 HeapEntry* child_entry = GetEntry(child_obj); 1641 HeapEntry* child_entry = GetEntry(child_obj);
1641 if (child_entry == NULL) return; 1642 if (child_entry == NULL) return;
1642 if (IsEssentialObject(child_obj)) { 1643 if (IsEssentialObject(child_obj)) {
1643 filler_->SetNamedReference(HeapGraphEdge::kInternal, 1644 filler_->SetNamedReference(HeapGraphEdge::kInternal,
1644 parent_entry, 1645 parent_entry,
1645 collection_->names()->GetName(index), 1646 collection_->names()->GetName(index),
1646 child_entry); 1647 child_entry);
1647 } 1648 }
1648 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset); 1649 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
1649 } 1650 }
1650 1651
1651 1652
1652 void V8HeapExplorer::SetHiddenReference(HeapObject* parent_obj, 1653 void V8HeapExplorer::SetHiddenReference(HeapObject* parent_obj,
1653 int parent_entry, 1654 int parent_entry,
1654 int index, 1655 int index,
1655 Object* child_obj) { 1656 Object* child_obj) {
1657 ASSERT(parent_entry == GetEntry(parent_obj)->index());
1656 HeapEntry* child_entry = GetEntry(child_obj); 1658 HeapEntry* child_entry = GetEntry(child_obj);
1657 if (child_entry != NULL && IsEssentialObject(child_obj)) { 1659 if (child_entry != NULL && IsEssentialObject(child_obj)) {
1658 filler_->SetIndexedReference(HeapGraphEdge::kHidden, 1660 filler_->SetIndexedReference(HeapGraphEdge::kHidden,
1659 parent_entry, 1661 parent_entry,
1660 index, 1662 index,
1661 child_entry); 1663 child_entry);
1662 } 1664 }
1663 } 1665 }
1664 1666
1665 1667
1666 void V8HeapExplorer::SetWeakReference(HeapObject* parent_obj, 1668 void V8HeapExplorer::SetWeakReference(HeapObject* parent_obj,
1667 int parent_entry, 1669 int parent_entry,
1668 int index, 1670 int index,
1669 Object* child_obj, 1671 Object* child_obj,
1670 int field_offset) { 1672 int field_offset) {
1673 ASSERT(parent_entry == GetEntry(parent_obj)->index());
1671 HeapEntry* child_entry = GetEntry(child_obj); 1674 HeapEntry* child_entry = GetEntry(child_obj);
1672 if (child_entry != NULL) { 1675 if (child_entry != NULL) {
1673 filler_->SetIndexedReference(HeapGraphEdge::kWeak, 1676 filler_->SetIndexedReference(HeapGraphEdge::kWeak,
1674 parent_entry, 1677 parent_entry,
1675 index, 1678 index,
1676 child_entry); 1679 child_entry);
1677 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset); 1680 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
1678 } 1681 }
1679 } 1682 }
1680 1683
1681 1684
1682 void V8HeapExplorer::SetPropertyReference(HeapObject* parent_obj, 1685 void V8HeapExplorer::SetPropertyReference(HeapObject* parent_obj,
1683 int parent_entry, 1686 int parent_entry,
1684 Name* reference_name, 1687 Name* reference_name,
1685 Object* child_obj, 1688 Object* child_obj,
1686 const char* name_format_string, 1689 const char* name_format_string,
1687 int field_offset) { 1690 int field_offset) {
1691 ASSERT(parent_entry == GetEntry(parent_obj)->index());
1688 HeapEntry* child_entry = GetEntry(child_obj); 1692 HeapEntry* child_entry = GetEntry(child_obj);
1689 if (child_entry != NULL) { 1693 if (child_entry != NULL) {
1690 HeapGraphEdge::Type type = 1694 HeapGraphEdge::Type type =
1691 reference_name->IsSymbol() || String::cast(reference_name)->length() > 0 1695 reference_name->IsSymbol() || String::cast(reference_name)->length() > 0
1692 ? HeapGraphEdge::kProperty : HeapGraphEdge::kInternal; 1696 ? HeapGraphEdge::kProperty : HeapGraphEdge::kInternal;
1693 const char* name = name_format_string != NULL && reference_name->IsString() 1697 const char* name = name_format_string != NULL && reference_name->IsString()
1694 ? collection_->names()->GetFormatted( 1698 ? collection_->names()->GetFormatted(
1695 name_format_string, 1699 name_format_string,
1696 *String::cast(reference_name)->ToCString( 1700 *String::cast(reference_name)->ToCString(
1697 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL)) : 1701 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL)) :
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
2675 2679
2676 2680
2677 void HeapSnapshotJSONSerializer::SortHashMap( 2681 void HeapSnapshotJSONSerializer::SortHashMap(
2678 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 2682 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
2679 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 2683 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
2680 sorted_entries->Add(p); 2684 sorted_entries->Add(p);
2681 sorted_entries->Sort(SortUsingEntryValue); 2685 sorted_entries->Sort(SortUsingEntryValue);
2682 } 2686 }
2683 2687
2684 } } // namespace v8::internal 2688 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698