OLD | NEW |
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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 int parent_; | 923 int parent_; |
924 int next_index_; | 924 int next_index_; |
925 }; | 925 }; |
926 | 926 |
927 | 927 |
928 void V8HeapExplorer::ExtractReferences(HeapObject* obj) { | 928 void V8HeapExplorer::ExtractReferences(HeapObject* obj) { |
929 HeapEntry* heap_entry = GetEntry(obj); | 929 HeapEntry* heap_entry = GetEntry(obj); |
930 if (heap_entry == NULL) return; // No interest in this object. | 930 if (heap_entry == NULL) return; // No interest in this object. |
931 int entry = heap_entry->index(); | 931 int entry = heap_entry->index(); |
932 | 932 |
933 bool extract_indexed_refs = true; | |
934 if (obj->IsJSGlobalProxy()) { | 933 if (obj->IsJSGlobalProxy()) { |
935 ExtractJSGlobalProxyReferences(entry, JSGlobalProxy::cast(obj)); | 934 ExtractJSGlobalProxyReferences(entry, JSGlobalProxy::cast(obj)); |
936 } else if (obj->IsJSObject()) { | 935 } else if (obj->IsJSObject()) { |
937 ExtractJSObjectReferences(entry, JSObject::cast(obj)); | 936 ExtractJSObjectReferences(entry, JSObject::cast(obj)); |
938 } else if (obj->IsString()) { | 937 } else if (obj->IsString()) { |
939 ExtractStringReferences(entry, String::cast(obj)); | 938 ExtractStringReferences(entry, String::cast(obj)); |
940 } else if (obj->IsContext()) { | 939 } else if (obj->IsContext()) { |
941 ExtractContextReferences(entry, Context::cast(obj)); | 940 ExtractContextReferences(entry, Context::cast(obj)); |
942 } else if (obj->IsMap()) { | 941 } else if (obj->IsMap()) { |
943 ExtractMapReferences(entry, Map::cast(obj)); | 942 ExtractMapReferences(entry, Map::cast(obj)); |
944 } else if (obj->IsSharedFunctionInfo()) { | 943 } else if (obj->IsSharedFunctionInfo()) { |
945 ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj)); | 944 ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj)); |
946 } else if (obj->IsScript()) { | 945 } else if (obj->IsScript()) { |
947 ExtractScriptReferences(entry, Script::cast(obj)); | 946 ExtractScriptReferences(entry, Script::cast(obj)); |
948 } else if (obj->IsAccessorPair()) { | 947 } else if (obj->IsAccessorPair()) { |
949 ExtractAccessorPairReferences(entry, AccessorPair::cast(obj)); | 948 ExtractAccessorPairReferences(entry, AccessorPair::cast(obj)); |
950 } else if (obj->IsCodeCache()) { | 949 } else if (obj->IsCodeCache()) { |
951 ExtractCodeCacheReferences(entry, CodeCache::cast(obj)); | 950 ExtractCodeCacheReferences(entry, CodeCache::cast(obj)); |
952 } else if (obj->IsCode()) { | 951 } else if (obj->IsCode()) { |
953 ExtractCodeReferences(entry, Code::cast(obj)); | 952 ExtractCodeReferences(entry, Code::cast(obj)); |
954 } else if (obj->IsCell()) { | 953 } else if (obj->IsCell()) { |
955 ExtractCellReferences(entry, Cell::cast(obj)); | 954 ExtractCellReferences(entry, Cell::cast(obj)); |
956 extract_indexed_refs = false; | |
957 } else if (obj->IsPropertyCell()) { | 955 } else if (obj->IsPropertyCell()) { |
958 ExtractPropertyCellReferences(entry, PropertyCell::cast(obj)); | 956 ExtractPropertyCellReferences(entry, PropertyCell::cast(obj)); |
959 extract_indexed_refs = false; | |
960 } else if (obj->IsAllocationSite()) { | 957 } else if (obj->IsAllocationSite()) { |
961 ExtractAllocationSiteReferences(entry, AllocationSite::cast(obj)); | 958 ExtractAllocationSiteReferences(entry, AllocationSite::cast(obj)); |
962 } | 959 } |
963 if (extract_indexed_refs) { | 960 SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset); |
964 SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset); | 961 |
965 IndexedReferencesExtractor refs_extractor(this, obj, entry); | 962 // Extract unvisited fields as hidden references and restore tags |
966 obj->Iterate(&refs_extractor); | 963 // of visited fields. |
967 } | 964 IndexedReferencesExtractor refs_extractor(this, obj, entry); |
| 965 obj->Iterate(&refs_extractor); |
968 } | 966 } |
969 | 967 |
970 | 968 |
971 void V8HeapExplorer::ExtractJSGlobalProxyReferences( | 969 void V8HeapExplorer::ExtractJSGlobalProxyReferences( |
972 int entry, JSGlobalProxy* proxy) { | 970 int entry, JSGlobalProxy* proxy) { |
973 SetInternalReference(proxy, entry, | 971 SetInternalReference(proxy, entry, |
974 "native_context", proxy->native_context(), | 972 "native_context", proxy->native_context(), |
975 JSGlobalProxy::kNativeContextOffset); | 973 JSGlobalProxy::kNativeContextOffset); |
976 } | 974 } |
977 | 975 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 "type_feedback_info", code->type_feedback_info(), | 1245 "type_feedback_info", code->type_feedback_info(), |
1248 Code::kTypeFeedbackInfoOffset); | 1246 Code::kTypeFeedbackInfoOffset); |
1249 } | 1247 } |
1250 SetInternalReference(code, entry, | 1248 SetInternalReference(code, entry, |
1251 "gc_metadata", code->gc_metadata(), | 1249 "gc_metadata", code->gc_metadata(), |
1252 Code::kGCMetadataOffset); | 1250 Code::kGCMetadataOffset); |
1253 } | 1251 } |
1254 | 1252 |
1255 | 1253 |
1256 void V8HeapExplorer::ExtractCellReferences(int entry, Cell* cell) { | 1254 void V8HeapExplorer::ExtractCellReferences(int entry, Cell* cell) { |
1257 SetInternalReference(cell, entry, "value", cell->value()); | 1255 SetInternalReference(cell, entry, "value", cell->value(), Cell::kValueOffset); |
1258 } | 1256 } |
1259 | 1257 |
1260 | 1258 |
1261 void V8HeapExplorer::ExtractPropertyCellReferences(int entry, | 1259 void V8HeapExplorer::ExtractPropertyCellReferences(int entry, |
1262 PropertyCell* cell) { | 1260 PropertyCell* cell) { |
1263 SetInternalReference(cell, entry, "value", cell->value()); | 1261 ExtractCellReferences(entry, cell); |
1264 SetInternalReference(cell, entry, "type", cell->type()); | 1262 SetInternalReference(cell, entry, "type", cell->type(), |
| 1263 PropertyCell::kTypeOffset); |
| 1264 SetInternalReference(cell, entry, "dependent_code", cell->dependent_code(), |
| 1265 PropertyCell::kDependentCodeOffset); |
1265 } | 1266 } |
1266 | 1267 |
1267 | 1268 |
1268 void V8HeapExplorer::ExtractAllocationSiteReferences(int entry, | 1269 void V8HeapExplorer::ExtractAllocationSiteReferences(int entry, |
1269 AllocationSite* site) { | 1270 AllocationSite* site) { |
1270 SetInternalReference(site, entry, "transition_info", site->transition_info(), | 1271 SetInternalReference(site, entry, "transition_info", site->transition_info(), |
1271 AllocationSite::kTransitionInfoOffset); | 1272 AllocationSite::kTransitionInfoOffset); |
1272 } | 1273 } |
1273 | 1274 |
1274 | 1275 |
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 | 2676 |
2676 | 2677 |
2677 void HeapSnapshotJSONSerializer::SortHashMap( | 2678 void HeapSnapshotJSONSerializer::SortHashMap( |
2678 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2679 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
2679 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 2680 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
2680 sorted_entries->Add(p); | 2681 sorted_entries->Add(p); |
2681 sorted_entries->Sort(SortUsingEntryValue); | 2682 sorted_entries->Sort(SortUsingEntryValue); |
2682 } | 2683 } |
2683 | 2684 |
2684 } } // namespace v8::internal | 2685 } } // namespace v8::internal |
OLD | NEW |