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