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

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

Issue 14007008: New GC APIs, try 2. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: . 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
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 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 List<ObjectGroup*>* groups = isolate->global_handles()->object_groups();
1944 for (int i = 0; i < groups->length(); ++i) { 1944 for (int i = 0; i < groups->length(); ++i) {
1945 ObjectGroup* group = groups->at(i); 1945 ObjectGroup* group = groups->at(i);
1946 if (group->info_ == NULL) continue; 1946 if (group->info == NULL) continue;
1947 List<HeapObject*>* list = GetListMaybeDisposeInfo(group->info_); 1947 List<HeapObject*>* list = GetListMaybeDisposeInfo(group->info);
1948 for (size_t j = 0; j < group->length_; ++j) { 1948 for (size_t j = 0; j < group->length; ++j) {
1949 HeapObject* obj = HeapObject::cast(*group->objects_[j]); 1949 HeapObject* obj = HeapObject::cast(*group->objects[j]);
1950 list->Add(obj); 1950 list->Add(obj);
1951 in_groups_.Insert(obj); 1951 in_groups_.Insert(obj);
1952 } 1952 }
1953 group->info_ = NULL; // Acquire info object ownership. 1953 group->info = NULL; // Acquire info object ownership.
1954 } 1954 }
1955 isolate->global_handles()->RemoveObjectGroups(); 1955 isolate->global_handles()->RemoveObjectGroups();
1956 isolate->heap()->CallGCEpilogueCallbacks(major_gc_type); 1956 isolate->heap()->CallGCEpilogueCallbacks(major_gc_type);
1957 // Record objects that are not in ObjectGroups, but have class ID. 1957 // Record objects that are not in ObjectGroups, but have class ID.
1958 GlobalHandlesExtractor extractor(this); 1958 GlobalHandlesExtractor extractor(this);
1959 isolate->global_handles()->IterateAllRootsWithClassIds(&extractor); 1959 isolate->global_handles()->IterateAllRootsWithClassIds(&extractor);
1960 embedder_queried_ = true; 1960 embedder_queried_ = true;
1961 } 1961 }
1962 1962
1963 void NativeObjectsExplorer::FillImplicitReferences() { 1963 void NativeObjectsExplorer::FillImplicitReferences() {
1964 Isolate* isolate = Isolate::Current(); 1964 Isolate* isolate = Isolate::Current();
1965 List<ImplicitRefGroup*>* groups = 1965 List<ImplicitRefGroup*>* groups =
1966 isolate->global_handles()->implicit_ref_groups(); 1966 isolate->global_handles()->implicit_ref_groups();
1967 for (int i = 0; i < groups->length(); ++i) { 1967 for (int i = 0; i < groups->length(); ++i) {
1968 ImplicitRefGroup* group = groups->at(i); 1968 ImplicitRefGroup* group = groups->at(i);
1969 HeapObject* parent = *group->parent_; 1969 HeapObject* parent = *group->parent;
1970 int parent_entry = 1970 int parent_entry =
1971 filler_->FindOrAddEntry(parent, native_entries_allocator_)->index(); 1971 filler_->FindOrAddEntry(parent, native_entries_allocator_)->index();
1972 ASSERT(parent_entry != HeapEntry::kNoEntry); 1972 ASSERT(parent_entry != HeapEntry::kNoEntry);
1973 Object*** children = group->children_; 1973 Object*** children = group->children;
1974 for (size_t j = 0; j < group->length_; ++j) { 1974 for (size_t j = 0; j < group->length; ++j) {
1975 Object* child = *children[j]; 1975 Object* child = *children[j];
1976 HeapEntry* child_entry = 1976 HeapEntry* child_entry =
1977 filler_->FindOrAddEntry(child, native_entries_allocator_); 1977 filler_->FindOrAddEntry(child, native_entries_allocator_);
1978 filler_->SetNamedReference( 1978 filler_->SetNamedReference(
1979 HeapGraphEdge::kInternal, 1979 HeapGraphEdge::kInternal,
1980 parent_entry, 1980 parent_entry,
1981 "native", 1981 "native",
1982 child_entry); 1982 child_entry);
1983 } 1983 }
1984 } 1984 }
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 2694
2695 2695
2696 void HeapSnapshotJSONSerializer::SortHashMap( 2696 void HeapSnapshotJSONSerializer::SortHashMap(
2697 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 2697 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
2698 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 2698 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
2699 sorted_entries->Add(p); 2699 sorted_entries->Add(p);
2700 sorted_entries->Sort(SortUsingEntryValue); 2700 sorted_entries->Sort(SortUsingEntryValue);
2701 } 2701 }
2702 2702
2703 } } // namespace v8::internal 2703 } } // namespace v8::internal
OLDNEW
« src/global-handles.cc ('K') | « src/global-handles.cc ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698