Commit 49d1c866 authored by Florian Sattler's avatar Florian Sattler Committed by Commit Bot

[cleanup] Refactor heap classes to use default members.

Fixing clang-tidy warning.

Bug: v8:8015
Change-Id: Ibe5906fa96f2d7327bce1eff70637a2d00f99668
Reviewed-on: https://chromium-review.googlesource.com/1224030Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Commit-Queue: Florian Sattler <sattlerf@google.com>
Cr-Commit-Position: refs/heads/master@{#55865}
parent 855fcea7
...@@ -47,7 +47,7 @@ class ArrayBufferCollector::FreeingTask final : public CancelableTask { ...@@ -47,7 +47,7 @@ class ArrayBufferCollector::FreeingTask final : public CancelableTask {
explicit FreeingTask(Heap* heap) explicit FreeingTask(Heap* heap)
: CancelableTask(heap->isolate()), heap_(heap) {} : CancelableTask(heap->isolate()), heap_(heap) {}
virtual ~FreeingTask() {} virtual ~FreeingTask() = default;
private: private:
void RunInternal() final { void RunInternal() final {
......
...@@ -524,7 +524,7 @@ class ConcurrentMarking::Task : public CancelableTask { ...@@ -524,7 +524,7 @@ class ConcurrentMarking::Task : public CancelableTask {
task_state_(task_state), task_state_(task_state),
task_id_(task_id) {} task_id_(task_id) {}
virtual ~Task() {} virtual ~Task() = default;
private: private:
// v8::internal::CancelableTask overrides. // v8::internal::CancelableTask overrides.
......
...@@ -1053,7 +1053,7 @@ class NewFunctionArgs final { ...@@ -1053,7 +1053,7 @@ class NewFunctionArgs final {
Handle<Map> GetMap(Isolate* isolate) const; Handle<Map> GetMap(Isolate* isolate) const;
private: private:
NewFunctionArgs() {} // Use the static factory constructors. NewFunctionArgs() = default; // Use the static factory constructors.
void SetShouldCreateAndSetInitialMap(); void SetShouldCreateAndSetInitialMap();
void SetShouldSetPrototype(); void SetShouldSetPrototype();
......
...@@ -24,7 +24,7 @@ class V8_EXPORT_PRIVATE MemoryController { ...@@ -24,7 +24,7 @@ class V8_EXPORT_PRIVATE MemoryController {
max_growing_factor_(max_growing_factor), max_growing_factor_(max_growing_factor),
conservative_growing_factor_(conservative_growing_factor), conservative_growing_factor_(conservative_growing_factor),
target_mutator_utilization_(target_mutator_utilization) {} target_mutator_utilization_(target_mutator_utilization) {}
virtual ~MemoryController() {} virtual ~MemoryController() = default;
// Computes the allocation limit to trigger the next garbage collection. // Computes the allocation limit to trigger the next garbage collection.
size_t CalculateAllocationLimit(size_t curr_size, size_t max_size, size_t CalculateAllocationLimit(size_t curr_size, size_t max_size,
......
...@@ -108,12 +108,7 @@ bool Heap::GCCallbackTuple::operator==( ...@@ -108,12 +108,7 @@ bool Heap::GCCallbackTuple::operator==(
} }
Heap::GCCallbackTuple& Heap::GCCallbackTuple::operator=( Heap::GCCallbackTuple& Heap::GCCallbackTuple::operator=(
const Heap::GCCallbackTuple& other) { const Heap::GCCallbackTuple& other) = default;
callback = other.callback;
gc_type = other.gc_type;
data = other.data;
return *this;
}
struct Heap::StrongRootsList { struct Heap::StrongRootsList {
Object** start; Object** start;
...@@ -2021,7 +2016,7 @@ static bool IsLogging(Isolate* isolate) { ...@@ -2021,7 +2016,7 @@ static bool IsLogging(Isolate* isolate) {
class PageScavengingItem final : public ItemParallelJob::Item { class PageScavengingItem final : public ItemParallelJob::Item {
public: public:
explicit PageScavengingItem(MemoryChunk* chunk) : chunk_(chunk) {} explicit PageScavengingItem(MemoryChunk* chunk) : chunk_(chunk) {}
virtual ~PageScavengingItem() {} virtual ~PageScavengingItem() = default;
void Process(Scavenger* scavenger) { scavenger->ScavengePage(chunk_); } void Process(Scavenger* scavenger) { scavenger->ScavengePage(chunk_); }
...@@ -3532,7 +3527,7 @@ class MemoryPressureInterruptTask : public CancelableTask { ...@@ -3532,7 +3527,7 @@ class MemoryPressureInterruptTask : public CancelableTask {
explicit MemoryPressureInterruptTask(Heap* heap) explicit MemoryPressureInterruptTask(Heap* heap)
: CancelableTask(heap->isolate()), heap_(heap) {} : CancelableTask(heap->isolate()), heap_(heap) {}
virtual ~MemoryPressureInterruptTask() {} virtual ~MemoryPressureInterruptTask() = default;
private: private:
// v8::internal::CancelableTask overrides. // v8::internal::CancelableTask overrides.
...@@ -5313,9 +5308,7 @@ PagedSpace* PagedSpaces::next() { ...@@ -5313,9 +5308,7 @@ PagedSpace* PagedSpaces::next() {
SpaceIterator::SpaceIterator(Heap* heap) SpaceIterator::SpaceIterator(Heap* heap)
: heap_(heap), current_space_(FIRST_SPACE - 1) {} : heap_(heap), current_space_(FIRST_SPACE - 1) {}
SpaceIterator::~SpaceIterator() { SpaceIterator::~SpaceIterator() = default;
}
bool SpaceIterator::has_next() { bool SpaceIterator::has_next() {
// Iterate until no more spaces. // Iterate until no more spaces.
...@@ -5330,7 +5323,7 @@ Space* SpaceIterator::next() { ...@@ -5330,7 +5323,7 @@ Space* SpaceIterator::next() {
class HeapObjectsFilter { class HeapObjectsFilter {
public: public:
virtual ~HeapObjectsFilter() {} virtual ~HeapObjectsFilter() = default;
virtual bool SkipObject(HeapObject* object) = 0; virtual bool SkipObject(HeapObject* object) = 0;
}; };
......
...@@ -2505,7 +2505,7 @@ class HeapIterator { ...@@ -2505,7 +2505,7 @@ class HeapIterator {
// Abstract base class for checking whether a weak object should be retained. // Abstract base class for checking whether a weak object should be retained.
class WeakObjectRetainer { class WeakObjectRetainer {
public: public:
virtual ~WeakObjectRetainer() {} virtual ~WeakObjectRetainer() = default;
// Return whether this object should be retained. If nullptr is returned the // Return whether this object should be retained. If nullptr is returned the
// object has no references. Otherwise the address of the retained object // object has no references. Otherwise the address of the retained object
...@@ -2521,7 +2521,7 @@ class AllocationObserver { ...@@ -2521,7 +2521,7 @@ class AllocationObserver {
: step_size_(step_size), bytes_to_next_step_(step_size) { : step_size_(step_size), bytes_to_next_step_(step_size) {
DCHECK_LE(kPointerSize, step_size); DCHECK_LE(kPointerSize, step_size);
} }
virtual ~AllocationObserver() {} virtual ~AllocationObserver() = default;
// Called each time the observed space does an allocation step. This may be // Called each time the observed space does an allocation step. This may be
// more frequently than the step_size we are monitoring (e.g. when there are // more frequently than the step_size we are monitoring (e.g. when there are
......
...@@ -1133,7 +1133,7 @@ class MigrationObserver { ...@@ -1133,7 +1133,7 @@ class MigrationObserver {
public: public:
explicit MigrationObserver(Heap* heap) : heap_(heap) {} explicit MigrationObserver(Heap* heap) : heap_(heap) {}
virtual ~MigrationObserver() {} virtual ~MigrationObserver() = default;
virtual void Move(AllocationSpace dest, HeapObject* src, HeapObject* dst, virtual void Move(AllocationSpace dest, HeapObject* src, HeapObject* dst,
int size) = 0; int size) = 0;
...@@ -1157,7 +1157,7 @@ class ProfilingMigrationObserver final : public MigrationObserver { ...@@ -1157,7 +1157,7 @@ class ProfilingMigrationObserver final : public MigrationObserver {
class HeapObjectVisitor { class HeapObjectVisitor {
public: public:
virtual ~HeapObjectVisitor() {} virtual ~HeapObjectVisitor() = default;
virtual bool Visit(HeapObject* object, int size) = 0; virtual bool Visit(HeapObject* object, int size) = 0;
}; };
...@@ -2366,7 +2366,7 @@ class Evacuator : public Malloced { ...@@ -2366,7 +2366,7 @@ class Evacuator : public Malloced {
duration_(0.0), duration_(0.0),
bytes_compacted_(0) {} bytes_compacted_(0) {}
virtual ~Evacuator() {} virtual ~Evacuator() = default;
void EvacuatePage(Page* page); void EvacuatePage(Page* page);
...@@ -2522,7 +2522,7 @@ void FullEvacuator::RawEvacuatePage(Page* page, intptr_t* live_bytes) { ...@@ -2522,7 +2522,7 @@ void FullEvacuator::RawEvacuatePage(Page* page, intptr_t* live_bytes) {
class PageEvacuationItem : public ItemParallelJob::Item { class PageEvacuationItem : public ItemParallelJob::Item {
public: public:
explicit PageEvacuationItem(Page* page) : page_(page) {} explicit PageEvacuationItem(Page* page) : page_(page) {}
virtual ~PageEvacuationItem() {} virtual ~PageEvacuationItem() = default;
Page* page() const { return page_; } Page* page() const { return page_; }
private: private:
...@@ -2819,7 +2819,7 @@ void MarkCompactCollector::Evacuate() { ...@@ -2819,7 +2819,7 @@ void MarkCompactCollector::Evacuate() {
class UpdatingItem : public ItemParallelJob::Item { class UpdatingItem : public ItemParallelJob::Item {
public: public:
virtual ~UpdatingItem() {} virtual ~UpdatingItem() = default;
virtual void Process() = 0; virtual void Process() = 0;
}; };
...@@ -2854,7 +2854,7 @@ class ToSpaceUpdatingItem : public UpdatingItem { ...@@ -2854,7 +2854,7 @@ class ToSpaceUpdatingItem : public UpdatingItem {
start_(start), start_(start),
end_(end), end_(end),
marking_state_(marking_state) {} marking_state_(marking_state) {}
virtual ~ToSpaceUpdatingItem() {} virtual ~ToSpaceUpdatingItem() = default;
void Process() override { void Process() override {
if (chunk_->IsFlagSet(Page::PAGE_NEW_NEW_PROMOTION)) { if (chunk_->IsFlagSet(Page::PAGE_NEW_NEW_PROMOTION)) {
...@@ -2908,7 +2908,7 @@ class RememberedSetUpdatingItem : public UpdatingItem { ...@@ -2908,7 +2908,7 @@ class RememberedSetUpdatingItem : public UpdatingItem {
marking_state_(marking_state), marking_state_(marking_state),
chunk_(chunk), chunk_(chunk),
updating_mode_(updating_mode) {} updating_mode_(updating_mode) {}
virtual ~RememberedSetUpdatingItem() {} virtual ~RememberedSetUpdatingItem() = default;
void Process() override { void Process() override {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"), TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"),
...@@ -3056,7 +3056,7 @@ class GlobalHandlesUpdatingItem : public UpdatingItem { ...@@ -3056,7 +3056,7 @@ class GlobalHandlesUpdatingItem : public UpdatingItem {
global_handles_(global_handles), global_handles_(global_handles),
start_(start), start_(start),
end_(end) {} end_(end) {}
virtual ~GlobalHandlesUpdatingItem() {} virtual ~GlobalHandlesUpdatingItem() = default;
void Process() override { void Process() override {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"), TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"),
...@@ -3083,7 +3083,7 @@ class ArrayBufferTrackerUpdatingItem : public UpdatingItem { ...@@ -3083,7 +3083,7 @@ class ArrayBufferTrackerUpdatingItem : public UpdatingItem {
explicit ArrayBufferTrackerUpdatingItem(Page* page, EvacuationState state) explicit ArrayBufferTrackerUpdatingItem(Page* page, EvacuationState state)
: page_(page), state_(state) {} : page_(page), state_(state) {}
virtual ~ArrayBufferTrackerUpdatingItem() {} virtual ~ArrayBufferTrackerUpdatingItem() = default;
void Process() override { void Process() override {
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.gc"), TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.gc"),
...@@ -4027,7 +4027,7 @@ class YoungGenerationMarkingTask; ...@@ -4027,7 +4027,7 @@ class YoungGenerationMarkingTask;
class MarkingItem : public ItemParallelJob::Item { class MarkingItem : public ItemParallelJob::Item {
public: public:
virtual ~MarkingItem() {} virtual ~MarkingItem() = default;
virtual void Process(YoungGenerationMarkingTask* task) = 0; virtual void Process(YoungGenerationMarkingTask* task) = 0;
}; };
...@@ -4175,7 +4175,7 @@ class GlobalHandlesMarkingItem : public MarkingItem { ...@@ -4175,7 +4175,7 @@ class GlobalHandlesMarkingItem : public MarkingItem {
GlobalHandlesMarkingItem(Heap* heap, GlobalHandles* global_handles, GlobalHandlesMarkingItem(Heap* heap, GlobalHandles* global_handles,
size_t start, size_t end) size_t start, size_t end)
: global_handles_(global_handles), start_(start), end_(end) {} : global_handles_(global_handles), start_(start), end_(end) {}
virtual ~GlobalHandlesMarkingItem() {} virtual ~GlobalHandlesMarkingItem() = default;
void Process(YoungGenerationMarkingTask* task) override { void Process(YoungGenerationMarkingTask* task) override {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"), TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"),
......
...@@ -250,7 +250,7 @@ enum class RememberedSetUpdatingMode { ALL, OLD_TO_NEW_ONLY }; ...@@ -250,7 +250,7 @@ enum class RememberedSetUpdatingMode { ALL, OLD_TO_NEW_ONLY };
// Base class for minor and full MC collectors. // Base class for minor and full MC collectors.
class MarkCompactCollectorBase { class MarkCompactCollectorBase {
public: public:
virtual ~MarkCompactCollectorBase() {} virtual ~MarkCompactCollectorBase() = default;
virtual void SetUp() = 0; virtual void SetUp() = 0;
virtual void TearDown() = 0; virtual void TearDown() = 0;
......
...@@ -1588,7 +1588,7 @@ MemoryAllocator::AllocatePage<MemoryAllocator::kPooled, SemiSpace>( ...@@ -1588,7 +1588,7 @@ MemoryAllocator::AllocatePage<MemoryAllocator::kPooled, SemiSpace>(
class V8_EXPORT_PRIVATE ObjectIterator : public Malloced { class V8_EXPORT_PRIVATE ObjectIterator : public Malloced {
public: public:
virtual ~ObjectIterator() {} virtual ~ObjectIterator() = default;
virtual HeapObject* Next() = 0; virtual HeapObject* Next() = 0;
}; };
......
...@@ -123,7 +123,7 @@ class StoreBuffer { ...@@ -123,7 +123,7 @@ class StoreBuffer {
: CancelableTask(isolate), : CancelableTask(isolate),
store_buffer_(store_buffer), store_buffer_(store_buffer),
tracer_(isolate->heap()->tracer()) {} tracer_(isolate->heap()->tracer()) {}
virtual ~Task() {} virtual ~Task() = default;
private: private:
void RunInternal() override { void RunInternal() override {
......
...@@ -76,7 +76,7 @@ class Sweeper::SweeperTask final : public CancelableTask { ...@@ -76,7 +76,7 @@ class Sweeper::SweeperTask final : public CancelableTask {
space_to_start_(space_to_start), space_to_start_(space_to_start),
tracer_(isolate->heap()->tracer()) {} tracer_(isolate->heap()->tracer()) {}
virtual ~SweeperTask() {} virtual ~SweeperTask() = default;
private: private:
void RunInternal() final { void RunInternal() final {
...@@ -111,7 +111,7 @@ class Sweeper::IncrementalSweeperTask final : public CancelableTask { ...@@ -111,7 +111,7 @@ class Sweeper::IncrementalSweeperTask final : public CancelableTask {
IncrementalSweeperTask(Isolate* isolate, Sweeper* sweeper) IncrementalSweeperTask(Isolate* isolate, Sweeper* sweeper)
: CancelableTask(isolate), isolate_(isolate), sweeper_(sweeper) {} : CancelableTask(isolate), isolate_(isolate), sweeper_(sweeper) {}
virtual ~IncrementalSweeperTask() {} virtual ~IncrementalSweeperTask() = default;
private: private:
void RunInternal() final { void RunInternal() final {
...@@ -530,7 +530,7 @@ class Sweeper::IterabilityTask final : public CancelableTask { ...@@ -530,7 +530,7 @@ class Sweeper::IterabilityTask final : public CancelableTask {
pending_iterability_task_(pending_iterability_task), pending_iterability_task_(pending_iterability_task),
tracer_(isolate->heap()->tracer()) {} tracer_(isolate->heap()->tracer()) {}
virtual ~IterabilityTask() {} virtual ~IterabilityTask() = default;
private: private:
void RunInternal() final { void RunInternal() final {
......
...@@ -5427,7 +5427,7 @@ class StaticOneByteResource : public v8::String::ExternalOneByteStringResource { ...@@ -5427,7 +5427,7 @@ class StaticOneByteResource : public v8::String::ExternalOneByteStringResource {
public: public:
explicit StaticOneByteResource(const char* data) : data_(data) {} explicit StaticOneByteResource(const char* data) : data_(data) {}
~StaticOneByteResource() {} ~StaticOneByteResource() = default;
const char* data() const { return data_; } const char* data() const { return data_; }
......
...@@ -14,8 +14,8 @@ namespace { ...@@ -14,8 +14,8 @@ namespace {
class GCIdleTimeHandlerTest : public ::testing::Test { class GCIdleTimeHandlerTest : public ::testing::Test {
public: public:
GCIdleTimeHandlerTest() {} GCIdleTimeHandlerTest() = default;
virtual ~GCIdleTimeHandlerTest() {} virtual ~GCIdleTimeHandlerTest() = default;
GCIdleTimeHandler* handler() { return &handler_; } GCIdleTimeHandler* handler() { return &handler_; }
......
...@@ -151,7 +151,7 @@ class TaskForDifferentItems; ...@@ -151,7 +151,7 @@ class TaskForDifferentItems;
class BaseItem : public ItemParallelJob::Item { class BaseItem : public ItemParallelJob::Item {
public: public:
virtual ~BaseItem() {} virtual ~BaseItem() = default;
virtual void ProcessItem(TaskForDifferentItems* task) = 0; virtual void ProcessItem(TaskForDifferentItems* task) = 0;
}; };
...@@ -162,7 +162,7 @@ class TaskForDifferentItems : public ItemParallelJob::Task { ...@@ -162,7 +162,7 @@ class TaskForDifferentItems : public ItemParallelJob::Task {
: ItemParallelJob::Task(isolate), : ItemParallelJob::Task(isolate),
processed_a_(processed_a), processed_a_(processed_a),
processed_b_(processed_b) {} processed_b_(processed_b) {}
virtual ~TaskForDifferentItems() {} virtual ~TaskForDifferentItems() = default;
void RunInParallel() override { void RunInParallel() override {
BaseItem* item = nullptr; BaseItem* item = nullptr;
...@@ -182,13 +182,13 @@ class TaskForDifferentItems : public ItemParallelJob::Task { ...@@ -182,13 +182,13 @@ class TaskForDifferentItems : public ItemParallelJob::Task {
class ItemA : public BaseItem { class ItemA : public BaseItem {
public: public:
virtual ~ItemA() {} virtual ~ItemA() = default;
void ProcessItem(TaskForDifferentItems* task) override { task->ProcessA(); } void ProcessItem(TaskForDifferentItems* task) override { task->ProcessA(); }
}; };
class ItemB : public BaseItem { class ItemB : public BaseItem {
public: public:
virtual ~ItemB() {} virtual ~ItemB() = default;
void ProcessItem(TaskForDifferentItems* task) override { task->ProcessB(); } void ProcessItem(TaskForDifferentItems* task) override { task->ProcessB(); }
}; };
......
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