Commit b8761260 authored by Zhi An Ng's avatar Zhi An Ng Committed by Commit Bot

[cleanup] Remove DISALLOW_COPY_AND_ASSIGN in test/{common,unittests}

Bug: v8:11074
Change-Id: I7b34b6a647bf9ad317bdb97a344739302f892957
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2519184Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70997}
parent 62eb0019
......@@ -44,6 +44,9 @@ using ControlTransferMap = ZoneMap<pc_t, ControlTransferEntry>;
// An interpreter capable of executing WebAssembly.
class WasmInterpreter {
public:
WasmInterpreter(const WasmInterpreter&) = delete;
WasmInterpreter& operator=(const WasmInterpreter&) = delete;
// State machine for the interpreter:
// +----------------------------------------------------------+
// | +--------Run()/Step()---------+ |
......@@ -104,8 +107,6 @@ class WasmInterpreter {
private:
Zone zone_;
std::unique_ptr<WasmInterpreterInternals> internals_;
DISALLOW_COPY_AND_ASSIGN(WasmInterpreter);
};
} // namespace wasm
......
......@@ -25,6 +25,8 @@ class MemoryPressureTask : public v8::Task {
MemoryPressureTask(Isolate* isolate, base::Semaphore* semaphore)
: isolate_(isolate), semaphore_(semaphore) {}
~MemoryPressureTask() override = default;
MemoryPressureTask(const MemoryPressureTask&) = delete;
MemoryPressureTask& operator=(const MemoryPressureTask&) = delete;
// v8::Task implementation.
void Run() override {
......@@ -35,8 +37,6 @@ class MemoryPressureTask : public v8::Task {
private:
Isolate* isolate_;
base::Semaphore* semaphore_;
DISALLOW_COPY_AND_ASSIGN(MemoryPressureTask);
};
} // namespace
......
......@@ -45,13 +45,13 @@ class FunctionalTest : public ::testing::Test {
FunctionalTest()
: rng_(GetRandomSeedFromFlag(::v8::internal::FLAG_random_seed)) {}
~FunctionalTest() override = default;
FunctionalTest(const FunctionalTest&) = delete;
FunctionalTest& operator=(const FunctionalTest&) = delete;
RandomNumberGenerator* rng() { return &rng_; }
private:
RandomNumberGenerator rng_;
DISALLOW_COPY_AND_ASSIGN(FunctionalTest);
};
using FunctionalTypes =
......
......@@ -29,6 +29,9 @@ namespace internal {
class CompilerDispatcherTestFlags {
public:
CompilerDispatcherTestFlags(const CompilerDispatcherTestFlags&) = delete;
CompilerDispatcherTestFlags& operator=(const CompilerDispatcherTestFlags&) =
delete;
static void SetFlagsForTest() {
CHECK_NULL(save_flags_);
save_flags_ = new SaveFlags();
......@@ -47,8 +50,6 @@ class CompilerDispatcherTestFlags {
private:
static SaveFlags* save_flags_;
DISALLOW_IMPLICIT_CONSTRUCTORS(CompilerDispatcherTestFlags);
};
SaveFlags* CompilerDispatcherTestFlags::save_flags_ = nullptr;
......@@ -57,6 +58,8 @@ class CompilerDispatcherTest : public TestWithNativeContext {
public:
CompilerDispatcherTest() = default;
~CompilerDispatcherTest() override = default;
CompilerDispatcherTest(const CompilerDispatcherTest&) = delete;
CompilerDispatcherTest& operator=(const CompilerDispatcherTest&) = delete;
static void SetUpTestCase() {
CompilerDispatcherTestFlags::SetFlagsForTest();
......@@ -102,9 +105,6 @@ class CompilerDispatcherTest : public TestWithNativeContext {
return dispatcher->Enqueue(outer_parse_info.get(), function_name,
function_literal);
}
private:
DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherTest);
};
namespace {
......@@ -123,6 +123,8 @@ class MockPlatform : public v8::Platform {
EXPECT_TRUE(worker_tasks_.empty());
EXPECT_TRUE(idle_task_ == nullptr);
}
MockPlatform(const MockPlatform&) = delete;
MockPlatform& operator=(const MockPlatform&) = delete;
int NumberOfWorkerThreads() override { return 1; }
......@@ -253,6 +255,8 @@ class MockPlatform : public v8::Platform {
std::vector<std::unique_ptr<Task>> tasks, bool signal)
: platform_(platform), tasks_(std::move(tasks)), signal_(signal) {}
~TaskWrapper() override = default;
TaskWrapper(const TaskWrapper&) = delete;
TaskWrapper& operator=(const TaskWrapper&) = delete;
void Run() override {
for (auto& task : tasks_) {
......@@ -267,8 +271,6 @@ class MockPlatform : public v8::Platform {
MockPlatform* platform_;
std::vector<std::unique_ptr<Task>> tasks_;
bool signal_;
DISALLOW_COPY_AND_ASSIGN(TaskWrapper);
};
class MockForegroundTaskRunner final : public TaskRunner {
......@@ -319,8 +321,6 @@ class MockPlatform : public v8::Platform {
base::Semaphore sem_;
v8::TracingController* tracing_controller_;
DISALLOW_COPY_AND_ASSIGN(MockPlatform);
};
} // namespace
......
......@@ -37,6 +37,8 @@ class BlockingCompilationJob : public OptimizedCompilationJob {
blocking_(false),
semaphore_(0) {}
~BlockingCompilationJob() override = default;
BlockingCompilationJob(const BlockingCompilationJob&) = delete;
BlockingCompilationJob& operator=(const BlockingCompilationJob&) = delete;
bool IsBlocking() const { return blocking_.Value(); }
void Signal() { semaphore_.Signal(); }
......@@ -60,8 +62,6 @@ class BlockingCompilationJob : public OptimizedCompilationJob {
OptimizedCompilationInfo info_;
base::AtomicValue<bool> blocking_;
base::Semaphore semaphore_;
DISALLOW_COPY_AND_ASSIGN(BlockingCompilationJob);
};
} // namespace
......
......@@ -148,6 +148,8 @@ class InstructionSequenceTest : public TestWithIsolateAndZone {
}
InstructionSequenceTest();
InstructionSequenceTest(const InstructionSequenceTest&) = delete;
InstructionSequenceTest& operator=(const InstructionSequenceTest&) = delete;
void SetNumRegs(int num_general_registers, int num_double_registers);
int GetNumRegs(MachineRepresentation rep);
......@@ -280,8 +282,6 @@ class InstructionSequenceTest : public TestWithIsolateAndZone {
LoopBlocks loop_blocks_;
InstructionBlock* current_block_;
bool block_returns_;
DISALLOW_COPY_AND_ASSIGN(InstructionSequenceTest);
};
} // namespace compiler
......
......@@ -24,6 +24,8 @@ class BytecodeAnalysisTest : public TestWithIsolateAndZone {
public:
BytecodeAnalysisTest() = default;
~BytecodeAnalysisTest() override = default;
BytecodeAnalysisTest(const BytecodeAnalysisTest&) = delete;
BytecodeAnalysisTest& operator=(const BytecodeAnalysisTest&) = delete;
static void SetUpTestCase() {
CHECK_NULL(save_flags_);
......@@ -83,8 +85,6 @@ class BytecodeAnalysisTest : public TestWithIsolateAndZone {
private:
static SaveFlags* save_flags_;
DISALLOW_COPY_AND_ASSIGN(BytecodeAnalysisTest);
};
SaveFlags* BytecodeAnalysisTest::save_flags_ = nullptr;
......
......@@ -34,6 +34,9 @@ class WithFinalizationRegistryMixin : public TMixin {
public:
WithFinalizationRegistryMixin() = default;
~WithFinalizationRegistryMixin() override = default;
WithFinalizationRegistryMixin(const WithFinalizationRegistryMixin&) = delete;
WithFinalizationRegistryMixin& operator=(
const WithFinalizationRegistryMixin&) = delete;
static void SetUpTestCase() {
CHECK_NULL(save_flags_);
......@@ -53,8 +56,6 @@ class WithFinalizationRegistryMixin : public TMixin {
private:
static SaveFlags* save_flags_;
DISALLOW_COPY_AND_ASSIGN(WithFinalizationRegistryMixin);
};
template <typename TMixin>
......
......@@ -17,15 +17,14 @@ template <typename TMixin>
class WithHeapInternals : public TMixin {
public:
WithHeapInternals() = default;
WithHeapInternals(const WithHeapInternals&) = delete;
WithHeapInternals& operator=(const WithHeapInternals&) = delete;
void CollectGarbage(i::AllocationSpace space) {
heap()->CollectGarbage(space, i::GarbageCollectionReason::kTesting);
}
Heap* heap() const { return this->i_isolate()->heap(); }
private:
DISALLOW_COPY_AND_ASSIGN(WithHeapInternals);
};
using TestWithHeapInternals = //
......
......@@ -13,12 +13,13 @@ namespace internal {
class ItemParallelJobTest : public TestWithIsolate {
public:
ItemParallelJobTest() : parallel_job_semaphore_(0) {}
ItemParallelJobTest(const ItemParallelJobTest&) = delete;
ItemParallelJobTest& operator=(const ItemParallelJobTest&) = delete;
base::Semaphore* parallel_job_semaphore() { return &parallel_job_semaphore_; }
private:
base::Semaphore parallel_job_semaphore_;
DISALLOW_COPY_AND_ASSIGN(ItemParallelJobTest);
};
namespace {
......
......@@ -227,6 +227,8 @@ class SequentialUnmapperTest : public TestWithIsolate {
public:
SequentialUnmapperTest() = default;
~SequentialUnmapperTest() override = default;
SequentialUnmapperTest(const SequentialUnmapperTest&) = delete;
SequentialUnmapperTest& operator=(const SequentialUnmapperTest&) = delete;
static void SetUpTestCase() {
CHECK_NULL(tracking_page_allocator_);
......@@ -264,8 +266,6 @@ class SequentialUnmapperTest : public TestWithIsolate {
static TrackingPageAllocator* tracking_page_allocator_;
static v8::PageAllocator* old_page_allocator_;
static bool old_flag_;
DISALLOW_COPY_AND_ASSIGN(SequentialUnmapperTest);
};
TrackingPageAllocator* SequentialUnmapperTest::tracking_page_allocator_ =
......
......@@ -38,6 +38,9 @@ class InterpreterAssemblerTest : public TestWithIsolateAndZone {
OperandScale operand_scale = OperandScale::kSingle)
: InterpreterAssembler(state, bytecode, operand_scale) {}
~InterpreterAssemblerForTest();
InterpreterAssemblerForTest(const InterpreterAssemblerForTest&) = delete;
InterpreterAssemblerForTest& operator=(const InterpreterAssemblerForTest&) =
delete;
Matcher<compiler::Node*> IsLoad(
const Matcher<compiler::LoadRepresentation>& rep_matcher,
......@@ -83,9 +86,6 @@ class InterpreterAssemblerTest : public TestWithIsolateAndZone {
Matcher<compiler::Node*> IsLoadRegisterOperand(int offset,
OperandSize operand_size);
private:
DISALLOW_COPY_AND_ASSIGN(InterpreterAssemblerForTest);
};
};
......
......@@ -26,6 +26,10 @@ using ::testing::Invoke;
using ::testing::Return;
class ValueSerializerTest : public TestWithIsolate {
public:
ValueSerializerTest(const ValueSerializerTest&) = delete;
ValueSerializerTest& operator=(const ValueSerializerTest&) = delete;
protected:
ValueSerializerTest()
: serialization_context_(Context::New(isolate())),
......@@ -266,8 +270,6 @@ class ValueSerializerTest : public TestWithIsolate {
Local<Context> deserialization_context_;
Local<FunctionTemplate> host_object_constructor_template_;
i::Isolate* isolate_;
DISALLOW_COPY_AND_ASSIGN(ValueSerializerTest);
};
TEST_F(ValueSerializerTest, DecodeInvalid) {
......
......@@ -14,9 +14,8 @@ namespace internal {
class PreParserTest : public TestWithNativeContext {
public:
PreParserTest() = default;
private:
DISALLOW_COPY_AND_ASSIGN(PreParserTest);
PreParserTest(const PreParserTest&) = delete;
PreParserTest& operator=(const PreParserTest&) = delete;
};
TEST_F(PreParserTest, LazyFunctionLength) {
......
......@@ -29,6 +29,9 @@ class BackgroundCompileTaskTest : public TestWithNativeContext {
public:
BackgroundCompileTaskTest() : allocator_(isolate()->allocator()) {}
~BackgroundCompileTaskTest() override = default;
BackgroundCompileTaskTest(const BackgroundCompileTaskTest&) = delete;
BackgroundCompileTaskTest& operator=(const BackgroundCompileTaskTest&) =
delete;
AccountingAllocator* allocator() { return allocator_; }
......@@ -87,8 +90,6 @@ class BackgroundCompileTaskTest : public TestWithNativeContext {
private:
AccountingAllocator* allocator_;
static SaveFlags* save_flags_;
DISALLOW_COPY_AND_ASSIGN(BackgroundCompileTaskTest);
};
SaveFlags* BackgroundCompileTaskTest::save_flags_ = nullptr;
......@@ -173,6 +174,8 @@ class CompileTask : public Task {
CompileTask(BackgroundCompileTask* task, base::Semaphore* semaphore)
: task_(task), semaphore_(semaphore) {}
~CompileTask() override = default;
CompileTask(const CompileTask&) = delete;
CompileTask& operator=(const CompileTask&) = delete;
void Run() override {
task_->Run();
......@@ -182,7 +185,6 @@ class CompileTask : public Task {
private:
BackgroundCompileTask* task_;
base::Semaphore* semaphore_;
DISALLOW_COPY_AND_ASSIGN(CompileTask);
};
TEST_F(BackgroundCompileTaskTest, CompileOnBackgroundThread) {
......
......@@ -28,6 +28,8 @@ class ScriptResource : public v8::String::ExternalOneByteStringResource {
ScriptResource(const char* data, size_t length)
: data_(data), length_(length) {}
~ScriptResource() override = default;
ScriptResource(const ScriptResource&) = delete;
ScriptResource& operator=(const ScriptResource&) = delete;
const char* data() const override { return data_; }
size_t length() const override { return length_; }
......@@ -35,8 +37,6 @@ class ScriptResource : public v8::String::ExternalOneByteStringResource {
private:
const char* data_;
size_t length_;
DISALLOW_COPY_AND_ASSIGN(ScriptResource);
};
Handle<String> CreateSource(
......
......@@ -32,6 +32,8 @@ class IsolateWrapper final {
public:
explicit IsolateWrapper(CountersMode counters_mode);
~IsolateWrapper();
IsolateWrapper(const IsolateWrapper&) = delete;
IsolateWrapper& operator=(const IsolateWrapper&) = delete;
v8::Isolate* isolate() const { return isolate_; }
......@@ -39,8 +41,6 @@ class IsolateWrapper final {
std::unique_ptr<v8::ArrayBuffer::Allocator> array_buffer_allocator_;
std::unique_ptr<CounterMap> counter_map_;
v8::Isolate* isolate_;
DISALLOW_COPY_AND_ASSIGN(IsolateWrapper);
};
//
......@@ -62,6 +62,8 @@ class WithIsolateScopeMixin : public TMixin {
public:
WithIsolateScopeMixin()
: isolate_scope_(this->v8_isolate()), handle_scope_(this->v8_isolate()) {}
WithIsolateScopeMixin(const WithIsolateScopeMixin&) = delete;
WithIsolateScopeMixin& operator=(const WithIsolateScopeMixin&) = delete;
v8::Isolate* isolate() const { return this->v8_isolate(); }
......@@ -72,8 +74,6 @@ class WithIsolateScopeMixin : public TMixin {
private:
v8::Isolate::Scope isolate_scope_;
v8::HandleScope handle_scope_;
DISALLOW_COPY_AND_ASSIGN(WithIsolateScopeMixin);
};
template <typename TMixin>
......@@ -81,6 +81,8 @@ class WithContextMixin : public TMixin {
public:
WithContextMixin()
: context_(Context::New(this->v8_isolate())), context_scope_(context_) {}
WithContextMixin(const WithContextMixin&) = delete;
WithContextMixin& operator=(const WithContextMixin&) = delete;
const Local<Context>& context() const { return v8_context(); }
const Local<Context>& v8_context() const { return context_; }
......@@ -116,8 +118,6 @@ class WithContextMixin : public TMixin {
v8::Local<v8::Context> context_;
v8::Context::Scope context_scope_;
DISALLOW_COPY_AND_ASSIGN(WithContextMixin);
};
// Use v8::internal::TestWithIsolate if you are testing internals,
......@@ -144,6 +144,8 @@ template <typename TMixin>
class WithInternalIsolateMixin : public TMixin {
public:
WithInternalIsolateMixin() = default;
WithInternalIsolateMixin(const WithInternalIsolateMixin&) = delete;
WithInternalIsolateMixin& operator=(const WithInternalIsolateMixin&) = delete;
Factory* factory() const { return isolate()->factory(); }
Isolate* isolate() const { return TMixin::i_isolate(); }
......@@ -174,9 +176,6 @@ class WithInternalIsolateMixin : public TMixin {
base::RandomNumberGenerator* random_number_generator() const {
return isolate()->random_number_generator();
}
private:
DISALLOW_COPY_AND_ASSIGN(WithInternalIsolateMixin);
};
template <typename TMixin>
......@@ -184,14 +183,14 @@ class WithZoneMixin : public TMixin {
public:
explicit WithZoneMixin(bool support_zone_compression = false)
: zone_(&allocator_, ZONE_NAME, support_zone_compression) {}
WithZoneMixin(const WithZoneMixin&) = delete;
WithZoneMixin& operator=(const WithZoneMixin&) = delete;
Zone* zone() { return &zone_; }
private:
v8::internal::AccountingAllocator allocator_;
Zone zone_;
DISALLOW_COPY_AND_ASSIGN(WithZoneMixin);
};
using TestWithIsolate = //
......@@ -235,13 +234,13 @@ class SaveFlags {
public:
SaveFlags();
~SaveFlags();
SaveFlags(const SaveFlags&) = delete;
SaveFlags& operator=(const SaveFlags&) = delete;
private:
#define FLAG_MODE_APPLY(ftype, ctype, nam, def, cmt) ctype SAVED_##nam;
#include "src/flags/flag-definitions.h" // NOLINT
#undef FLAG_MODE_APPLY
DISALLOW_COPY_AND_ASSIGN(SaveFlags);
};
// For GTest.
......
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