From: alph@chromium.org Date: Tue, 16 Jul 2013 17:47:35 +0000 (+0000) Subject: Add missing links from GlobalPropertyCell to dependent_code X-Git-Tag: upstream/4.7.83~13355 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=09131296ac1b0171528b31ecf7e411c322d8af29;p=platform%2Fupstream%2Fv8.git Add missing links from GlobalPropertyCell to dependent_code It produced orphan DependentCode nodes because links were not created explicitly in ExtractPropertyCellReferences and IndexedReferencesExtractor was disabled for ProperyCells. R=danno@chromium.org, loislo@chromium.org Review URL: https://codereview.chromium.org/19368002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15694 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc index f5257e6..6d2d891 100644 --- a/src/heap-snapshot-generator.cc +++ b/src/heap-snapshot-generator.cc @@ -930,7 +930,6 @@ void V8HeapExplorer::ExtractReferences(HeapObject* obj) { if (heap_entry == NULL) return; // No interest in this object. int entry = heap_entry->index(); - bool extract_indexed_refs = true; if (obj->IsJSGlobalProxy()) { ExtractJSGlobalProxyReferences(entry, JSGlobalProxy::cast(obj)); } else if (obj->IsJSObject()) { @@ -953,18 +952,17 @@ void V8HeapExplorer::ExtractReferences(HeapObject* obj) { ExtractCodeReferences(entry, Code::cast(obj)); } else if (obj->IsCell()) { ExtractCellReferences(entry, Cell::cast(obj)); - extract_indexed_refs = false; } else if (obj->IsPropertyCell()) { ExtractPropertyCellReferences(entry, PropertyCell::cast(obj)); - extract_indexed_refs = false; } else if (obj->IsAllocationSite()) { ExtractAllocationSiteReferences(entry, AllocationSite::cast(obj)); } - if (extract_indexed_refs) { - SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset); - IndexedReferencesExtractor refs_extractor(this, obj, entry); - obj->Iterate(&refs_extractor); - } + SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset); + + // Extract unvisited fields as hidden references and restore tags + // of visited fields. + IndexedReferencesExtractor refs_extractor(this, obj, entry); + obj->Iterate(&refs_extractor); } @@ -1250,14 +1248,17 @@ void V8HeapExplorer::ExtractCodeReferences(int entry, Code* code) { void V8HeapExplorer::ExtractCellReferences(int entry, Cell* cell) { - SetInternalReference(cell, entry, "value", cell->value()); + SetInternalReference(cell, entry, "value", cell->value(), Cell::kValueOffset); } void V8HeapExplorer::ExtractPropertyCellReferences(int entry, PropertyCell* cell) { - SetInternalReference(cell, entry, "value", cell->value()); - SetInternalReference(cell, entry, "type", cell->type()); + ExtractCellReferences(entry, cell); + SetInternalReference(cell, entry, "type", cell->type(), + PropertyCell::kTypeOffset); + SetInternalReference(cell, entry, "dependent_code", cell->dependent_code(), + PropertyCell::kDependentCodeOffset); } diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc index edcfff2..079f4a4 100644 --- a/test/cctest/test-heap-profiler.cc +++ b/test/cctest/test-heap-profiler.cc @@ -160,7 +160,7 @@ static bool ValidateSnapshot(const v8::HeapSnapshot* snapshot, int depth) { ++unretained_entries_count; } } - return unretained_entries_count > 1 ? false : true; + return unretained_entries_count == 0; }