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 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 | 1933 |
1934 void NativeObjectsExplorer::FillRetainedObjects() { | 1934 void NativeObjectsExplorer::FillRetainedObjects() { |
1935 if (embedder_queried_) return; | 1935 if (embedder_queried_) return; |
1936 Isolate* isolate = Isolate::Current(); | 1936 Isolate* isolate = Isolate::Current(); |
1937 const GCType major_gc_type = kGCTypeMarkSweepCompact; | 1937 const GCType major_gc_type = kGCTypeMarkSweepCompact; |
1938 // Record objects that are joined into ObjectGroups. | 1938 // Record objects that are joined into ObjectGroups. |
1939 isolate->heap()->CallGCPrologueCallbacks(major_gc_type); | 1939 isolate->heap()->CallGCPrologueCallbacks(major_gc_type); |
1940 List<ObjectGroup*>* groups = isolate->global_handles()->object_groups(); | 1940 List<ObjectGroup*>* groups = isolate->global_handles()->object_groups(); |
1941 for (int i = 0; i < groups->length(); ++i) { | 1941 for (int i = 0; i < groups->length(); ++i) { |
1942 ObjectGroup* group = groups->at(i); | 1942 ObjectGroup* group = groups->at(i); |
1943 if (group->info_ == NULL) continue; | 1943 if (group->info == NULL) continue; |
1944 List<HeapObject*>* list = GetListMaybeDisposeInfo(group->info_); | 1944 List<HeapObject*>* list = GetListMaybeDisposeInfo(group->info); |
1945 for (size_t j = 0; j < group->length_; ++j) { | 1945 for (size_t j = 0; j < group->length; ++j) { |
1946 HeapObject* obj = HeapObject::cast(*group->objects_[j]); | 1946 HeapObject* obj = HeapObject::cast(*group->objects[j]); |
1947 list->Add(obj); | 1947 list->Add(obj); |
1948 in_groups_.Insert(obj); | 1948 in_groups_.Insert(obj); |
1949 } | 1949 } |
1950 group->info_ = NULL; // Acquire info object ownership. | 1950 group->info = NULL; // Acquire info object ownership. |
1951 } | 1951 } |
1952 isolate->global_handles()->RemoveObjectGroups(); | 1952 isolate->global_handles()->RemoveObjectGroups(); |
1953 isolate->heap()->CallGCEpilogueCallbacks(major_gc_type); | 1953 isolate->heap()->CallGCEpilogueCallbacks(major_gc_type); |
1954 // Record objects that are not in ObjectGroups, but have class ID. | 1954 // Record objects that are not in ObjectGroups, but have class ID. |
1955 GlobalHandlesExtractor extractor(this); | 1955 GlobalHandlesExtractor extractor(this); |
1956 isolate->global_handles()->IterateAllRootsWithClassIds(&extractor); | 1956 isolate->global_handles()->IterateAllRootsWithClassIds(&extractor); |
1957 embedder_queried_ = true; | 1957 embedder_queried_ = true; |
1958 } | 1958 } |
1959 | 1959 |
1960 void NativeObjectsExplorer::FillImplicitReferences() { | 1960 void NativeObjectsExplorer::FillImplicitReferences() { |
1961 Isolate* isolate = Isolate::Current(); | 1961 Isolate* isolate = Isolate::Current(); |
1962 List<ImplicitRefGroup*>* groups = | 1962 List<ImplicitRefGroup*>* groups = |
1963 isolate->global_handles()->implicit_ref_groups(); | 1963 isolate->global_handles()->implicit_ref_groups(); |
1964 for (int i = 0; i < groups->length(); ++i) { | 1964 for (int i = 0; i < groups->length(); ++i) { |
1965 ImplicitRefGroup* group = groups->at(i); | 1965 ImplicitRefGroup* group = groups->at(i); |
1966 HeapObject* parent = *group->parent_; | 1966 HeapObject* parent = *group->parent; |
1967 int parent_entry = | 1967 int parent_entry = |
1968 filler_->FindOrAddEntry(parent, native_entries_allocator_)->index(); | 1968 filler_->FindOrAddEntry(parent, native_entries_allocator_)->index(); |
1969 ASSERT(parent_entry != HeapEntry::kNoEntry); | 1969 ASSERT(parent_entry != HeapEntry::kNoEntry); |
1970 Object*** children = group->children_; | 1970 Object*** children = group->children; |
1971 for (size_t j = 0; j < group->length_; ++j) { | 1971 for (size_t j = 0; j < group->length; ++j) { |
1972 Object* child = *children[j]; | 1972 Object* child = *children[j]; |
1973 HeapEntry* child_entry = | 1973 HeapEntry* child_entry = |
1974 filler_->FindOrAddEntry(child, native_entries_allocator_); | 1974 filler_->FindOrAddEntry(child, native_entries_allocator_); |
1975 filler_->SetNamedReference( | 1975 filler_->SetNamedReference( |
1976 HeapGraphEdge::kInternal, | 1976 HeapGraphEdge::kInternal, |
1977 parent_entry, | 1977 parent_entry, |
1978 "native", | 1978 "native", |
1979 child_entry); | 1979 child_entry); |
1980 } | 1980 } |
1981 } | 1981 } |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2658 | 2658 |
2659 | 2659 |
2660 void HeapSnapshotJSONSerializer::SortHashMap( | 2660 void HeapSnapshotJSONSerializer::SortHashMap( |
2661 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2661 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
2662 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 2662 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
2663 sorted_entries->Add(p); | 2663 sorted_entries->Add(p); |
2664 sorted_entries->Sort(SortUsingEntryValue); | 2664 sorted_entries->Sort(SortUsingEntryValue); |
2665 } | 2665 } |
2666 | 2666 |
2667 } } // namespace v8::internal | 2667 } } // namespace v8::internal |
OLD | NEW |