Commit 5f0e0f63 authored by Florian Sattler's avatar Florian Sattler Committed by Commit Bot

[heap] Small refactoring to tidy up heap.

Bug: v8:8015
Change-Id: I6b1283f893944ca45ff7816d51e0c7fb26c8a8e1
Reviewed-on: https://chromium-review.googlesource.com/1209785Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Florian Sattler <sattlerf@google.com>
Cr-Commit-Position: refs/heads/master@{#55693}
parent 8c1e0383
......@@ -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;
......
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