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

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

Issue 13786002: [WIP] New GC related APIs. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: use old testing machinery Created 7 years, 8 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
« no previous file with comments | « src/global-handles.cc ('k') | test/cctest/test-api.cc » ('j') | 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 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 return objects_by_info_.occupancy(); 1933 return objects_by_info_.occupancy();
1934 } 1934 }
1935 1935
1936 1936
1937 void NativeObjectsExplorer::FillRetainedObjects() { 1937 void NativeObjectsExplorer::FillRetainedObjects() {
1938 if (embedder_queried_) return; 1938 if (embedder_queried_) return;
1939 Isolate* isolate = Isolate::Current(); 1939 Isolate* isolate = Isolate::Current();
1940 const GCType major_gc_type = kGCTypeMarkSweepCompact; 1940 const GCType major_gc_type = kGCTypeMarkSweepCompact;
1941 // Record objects that are joined into ObjectGroups. 1941 // Record objects that are joined into ObjectGroups.
1942 isolate->heap()->CallGCPrologueCallbacks(major_gc_type); 1942 isolate->heap()->CallGCPrologueCallbacks(major_gc_type);
1943 List<ObjectGroup*>* groups = isolate->global_handles()->object_groups(); 1943
1944 for (int i = 0; i < groups->length(); ++i) { 1944 List<ObjectGroupConnection>* groups =
1945 ObjectGroup* group = groups->at(i); 1945 isolate->global_handles()->object_groups();
1946 if (group->info_ == NULL) continue; 1946 List<ObjectGroupRetainerInfo>* infos =
1947 List<HeapObject*>* list = GetListMaybeDisposeInfo(group->info_); 1947 isolate->global_handles()->retainer_infos();
1948 for (size_t j = 0; j < group->length_; ++j) { 1948 groups->Sort();
1949 HeapObject* obj = HeapObject::cast(*group->objects_[j]); 1949 infos->Sort();
1950 list->Add(obj); 1950
1951 in_groups_.Insert(obj); 1951 int info_ix = 0;
1952 UniqueId current_group_id(0);
1953 size_t current_group_start = 0;
1954
1955 if (groups->length() > 0) {
1956 for (int i = 0; i <= groups->length(); ++i) {
1957 if (i == 0)
1958 current_group_id = groups->at(i).id;
1959 if (i == groups->length() ||
1960 current_group_id != groups->at(i).id) {
1961 // Group detected: objects in indices [current_group_start, i[.
1962 if (info_ix < infos->length() &&
1963 infos->at(info_ix).id == groups->at(current_group_start).id) {
1964 // Transfer the ownership of info.
1965 List<HeapObject*>* list =
1966 GetListMaybeDisposeInfo(infos->at(info_ix).info);
1967 infos->at(info_ix).info = NULL;
1968 for (int j = current_group_start; j < i; ++j) {
1969 HeapObject* obj = HeapObject::cast(*(groups->at(j).object));
1970 list->Add(obj);
1971 in_groups_.Insert(obj);
1972 }
1973 }
1974 if (i < groups->length()) {
1975 current_group_id = groups->at(i).id;
1976 current_group_start = i;
1977 }
1978 }
1952 } 1979 }
1953 group->info_ = NULL; // Acquire info object ownership.
1954 } 1980 }
1955 isolate->global_handles()->RemoveObjectGroups(); 1981 isolate->global_handles()->RemoveObjectGroups();
1956 isolate->heap()->CallGCEpilogueCallbacks(major_gc_type); 1982 isolate->heap()->CallGCEpilogueCallbacks(major_gc_type);
1957 // Record objects that are not in ObjectGroups, but have class ID. 1983 // Record objects that are not in ObjectGroups, but have class ID.
1958 GlobalHandlesExtractor extractor(this); 1984 GlobalHandlesExtractor extractor(this);
1959 isolate->global_handles()->IterateAllRootsWithClassIds(&extractor); 1985 isolate->global_handles()->IterateAllRootsWithClassIds(&extractor);
1960 embedder_queried_ = true; 1986 embedder_queried_ = true;
1961 } 1987 }
1962 1988
1963 void NativeObjectsExplorer::FillImplicitReferences() { 1989 void NativeObjectsExplorer::FillImplicitReferences() {
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 2720
2695 2721
2696 void HeapSnapshotJSONSerializer::SortHashMap( 2722 void HeapSnapshotJSONSerializer::SortHashMap(
2697 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 2723 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
2698 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 2724 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
2699 sorted_entries->Add(p); 2725 sorted_entries->Add(p);
2700 sorted_entries->Sort(SortUsingEntryValue); 2726 sorted_entries->Sort(SortUsingEntryValue);
2701 } 2727 }
2702 2728
2703 } } // namespace v8::internal 2729 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/global-handles.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698