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 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 1943 |
1944 List<ObjectGroupConnection>* groups = | 1944 List<ObjectGroupConnection>* groups = |
1945 isolate->global_handles()->object_groups(); | 1945 isolate->global_handles()->object_groups(); |
1946 List<ObjectGroupRetainerInfo>* infos = | 1946 List<ObjectGroupRetainerInfo>* infos = |
1947 isolate->global_handles()->retainer_infos(); | 1947 isolate->global_handles()->retainer_infos(); |
1948 groups->Sort(); | 1948 groups->Sort(); |
1949 infos->Sort(); | 1949 infos->Sort(); |
1950 | 1950 |
1951 int info_ix = 0; | 1951 int info_index = 0; |
1952 UniqueId current_group_id(0); | 1952 UniqueId current_group_id(0); |
1953 size_t current_group_start = 0; | 1953 int current_group_start = 0; |
1954 | 1954 |
1955 if (groups->length() > 0) { | 1955 if (groups->length() > 0) { |
1956 for (int i = 0; i <= groups->length(); ++i) { | 1956 for (int i = 0; i <= groups->length(); ++i) { |
1957 if (i == 0) | 1957 if (i == 0) |
1958 current_group_id = groups->at(i).id; | 1958 current_group_id = groups->at(i).id; |
1959 if (i == groups->length() || | 1959 if (i == groups->length() || |
1960 current_group_id != groups->at(i).id) { | 1960 current_group_id != groups->at(i).id) { |
1961 // Group detected: objects in indices [current_group_start, i[. | 1961 // Group detected: objects in indices [current_group_start, i[. |
1962 if (info_ix < infos->length() && | 1962 if (info_index < infos->length() && |
1963 infos->at(info_ix).id == groups->at(current_group_start).id) { | 1963 infos->at(info_index).id == groups->at(current_group_start).id) { |
1964 // Transfer the ownership of info. | 1964 // Transfer the ownership of info. |
1965 List<HeapObject*>* list = | 1965 List<HeapObject*>* list = |
1966 GetListMaybeDisposeInfo(infos->at(info_ix).info); | 1966 GetListMaybeDisposeInfo(infos->at(info_index).info); |
1967 infos->at(info_ix).info = NULL; | 1967 infos->at(info_index).info = NULL; |
1968 for (int j = current_group_start; j < i; ++j) { | 1968 for (int j = current_group_start; j < i; ++j) { |
1969 HeapObject* obj = HeapObject::cast(*(groups->at(j).object)); | 1969 HeapObject* obj = HeapObject::cast(*(groups->at(j).object)); |
1970 list->Add(obj); | 1970 list->Add(obj); |
1971 in_groups_.Insert(obj); | 1971 in_groups_.Insert(obj); |
1972 } | 1972 } |
1973 } | 1973 } |
1974 if (i < groups->length()) { | 1974 if (i < groups->length()) { |
1975 current_group_id = groups->at(i).id; | 1975 current_group_id = groups->at(i).id; |
1976 current_group_start = i; | 1976 current_group_start = i; |
1977 } | 1977 } |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2720 | 2720 |
2721 | 2721 |
2722 void HeapSnapshotJSONSerializer::SortHashMap( | 2722 void HeapSnapshotJSONSerializer::SortHashMap( |
2723 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2723 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
2724 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)) |
2725 sorted_entries->Add(p); | 2725 sorted_entries->Add(p); |
2726 sorted_entries->Sort(SortUsingEntryValue); | 2726 sorted_entries->Sort(SortUsingEntryValue); |
2727 } | 2727 } |
2728 | 2728 |
2729 } } // namespace v8::internal | 2729 } } // namespace v8::internal |
OLD | NEW |