[heap] Small refactoring to tidy up heap.
Bug: v8:8015 Change-Id: I6b1283f893944ca45ff7816d51e0c7fb26c8a8e1 Reviewed-on: https://chromium-review.googlesource.com/1209785 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Florian Sattler <sattlerf@google.com> Cr-Commit-Position: refs/heads/master@{#55693}
This commit is contained in:
parent
8c1e038322
commit
5f0e0f63b7
@ -2488,8 +2488,8 @@ void Heap::ProcessWeakListRoots(WeakObjectRetainer* retainer) {
|
||||
set_allocation_sites_list(retainer->RetainAs(allocation_sites_list()));
|
||||
}
|
||||
|
||||
void Heap::ForeachAllocationSite(Object* list,
|
||||
std::function<void(AllocationSite*)> visitor) {
|
||||
void Heap::ForeachAllocationSite(
|
||||
Object* list, const std::function<void(AllocationSite*)>& visitor) {
|
||||
DisallowHeapAllocation disallow_heap_allocation;
|
||||
Object* current = list;
|
||||
while (current->IsAllocationSite()) {
|
||||
|
@ -567,8 +567,8 @@ class Heap {
|
||||
|
||||
// Traverse all the allocaions_sites [nested_site and weak_next] in the list
|
||||
// and foreach call the visitor
|
||||
void ForeachAllocationSite(Object* list,
|
||||
std::function<void(AllocationSite*)> visitor);
|
||||
void ForeachAllocationSite(
|
||||
Object* list, const std::function<void(AllocationSite*)>& visitor);
|
||||
|
||||
// Number of mark-sweeps.
|
||||
int ms_count() const { return ms_count_; }
|
||||
|
@ -58,7 +58,7 @@ ItemParallelJob::~ItemParallelJob() {
|
||||
}
|
||||
}
|
||||
|
||||
void ItemParallelJob::Run(std::shared_ptr<Counters> async_counters) {
|
||||
void ItemParallelJob::Run(const std::shared_ptr<Counters>& async_counters) {
|
||||
DCHECK_GT(tasks_.size(), 0);
|
||||
const size_t num_items = items_.size();
|
||||
const size_t num_tasks = tasks_.size();
|
||||
|
@ -137,7 +137,7 @@ class V8_EXPORT_PRIVATE ItemParallelJob {
|
||||
|
||||
// Runs this job. Reporting metrics in a thread-safe manner to
|
||||
// |async_counters|.
|
||||
void Run(std::shared_ptr<Counters> async_counters);
|
||||
void Run(const std::shared_ptr<Counters>& async_counters);
|
||||
|
||||
private:
|
||||
std::vector<Item*> items_;
|
||||
|
@ -3426,8 +3426,9 @@ void MarkCompactCollector::MarkingWorklist::PrintWorklist(
|
||||
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));
|
||||
rank.reserve(count.size());
|
||||
for (const auto& i : count) {
|
||||
rank.emplace_back(i.second, i.first);
|
||||
}
|
||||
std::map<InstanceType, std::string> instance_type_name;
|
||||
#define INSTANCE_TYPE_NAME(name) instance_type_name[name] = #name;
|
||||
|
Loading…
Reference in New Issue
Block a user