Commit a6c44361 authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[iwyu, objects.h splitting] Outline MarkCompactCollector::MarkingWorklist::PrintWorklist.

Calls a function defined in map-inl.h which mark-compact.h is not allowed to
include.

BUG=v8:7490,v8:5402,v8:7570

Change-Id: I51cef646fc2b650208d4e59b92bcd1e406ddd7fd
Reviewed-on: https://chromium-review.googlesource.com/1032332Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52829}
parent 8961287a
......@@ -3311,6 +3311,30 @@ void MarkCompactCollector::StartSweepSpaces() {
}
}
void MarkCompactCollector::MarkingWorklist::PrintWorklist(
const char* worklist_name, ConcurrentMarkingWorklist* worklist) {
std::map<InstanceType, int> count;
int total_count = 0;
worklist->IterateGlobalPool([&count, &total_count](HeapObject* obj) {
++total_count;
count[obj->map()->instance_type()]++;
});
std::vector<std::pair<int, InstanceType>> rank;
for (auto i : count) {
rank.push_back(std::make_pair(i.second, i.first));
}
std::map<InstanceType, std::string> instance_type_name;
#define INSTANCE_TYPE_NAME(name) instance_type_name[name] = #name;
INSTANCE_TYPE_LIST(INSTANCE_TYPE_NAME)
#undef INSTANCE_TYPE_NAME
std::sort(rank.begin(), rank.end(),
std::greater<std::pair<int, InstanceType>>());
PrintF("Worklist %s: %d\n", worklist_name, total_count);
for (auto i : rank) {
PrintF(" [%s]: %d\n", instance_type_name[i.second].c_str(), i.first);
}
}
#ifdef ENABLE_MINOR_MC
namespace {
......
......@@ -5,7 +5,6 @@
#ifndef V8_HEAP_MARK_COMPACT_H_
#define V8_HEAP_MARK_COMPACT_H_
#include <deque>
#include <vector>
#include "src/heap/concurrent-marking.h"
......@@ -530,28 +529,7 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
private:
// Prints the stats about the global pool of the worklist.
void PrintWorklist(const char* worklist_name,
ConcurrentMarkingWorklist* worklist) {
std::map<InstanceType, int> count;
int total_count = 0;
worklist->IterateGlobalPool([&count, &total_count](HeapObject* obj) {
++total_count;
count[obj->map()->instance_type()]++;
});
std::vector<std::pair<int, InstanceType>> rank;
for (auto i : count) {
rank.push_back(std::make_pair(i.second, i.first));
}
std::map<InstanceType, std::string> instance_type_name;
#define INSTANCE_TYPE_NAME(name) instance_type_name[name] = #name;
INSTANCE_TYPE_LIST(INSTANCE_TYPE_NAME)
#undef INSTANCE_TYPE_NAME
std::sort(rank.begin(), rank.end(),
std::greater<std::pair<int, InstanceType>>());
PrintF("Worklist %s: %d\n", worklist_name, total_count);
for (auto i : rank) {
PrintF(" [%s]: %d\n", instance_type_name[i.second].c_str(), i.first);
}
}
ConcurrentMarkingWorklist* worklist);
ConcurrentMarkingWorklist shared_;
ConcurrentMarkingWorklist bailout_;
ConcurrentMarkingWorklist on_hold_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment