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

[cleanup] Remove DISALLOW_COPY_AND_ASSIGN in snapshot/

Bug: v8:11074
Change-Id: I9d6925e8e68f4a0e71a10ec39d10ae306f9efcbf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2524413Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71030}
parent b06f7da4
...@@ -18,6 +18,8 @@ class V8_EXPORT_PRIVATE ScriptData { ...@@ -18,6 +18,8 @@ class V8_EXPORT_PRIVATE ScriptData {
~ScriptData() { ~ScriptData() {
if (owns_data_) DeleteArray(data_); if (owns_data_) DeleteArray(data_);
} }
ScriptData(const ScriptData&) = delete;
ScriptData& operator=(const ScriptData&) = delete;
const byte* data() const { return data_; } const byte* data() const { return data_; }
int length() const { return length_; } int length() const { return length_; }
...@@ -40,12 +42,12 @@ class V8_EXPORT_PRIVATE ScriptData { ...@@ -40,12 +42,12 @@ class V8_EXPORT_PRIVATE ScriptData {
bool rejected_ : 1; bool rejected_ : 1;
const byte* data_; const byte* data_;
int length_; int length_;
DISALLOW_COPY_AND_ASSIGN(ScriptData);
}; };
class CodeSerializer : public Serializer { class CodeSerializer : public Serializer {
public: public:
CodeSerializer(const CodeSerializer&) = delete;
CodeSerializer& operator=(const CodeSerializer&) = delete;
V8_EXPORT_PRIVATE static ScriptCompiler::CachedData* Serialize( V8_EXPORT_PRIVATE static ScriptCompiler::CachedData* Serialize(
Handle<SharedFunctionInfo> info); Handle<SharedFunctionInfo> info);
...@@ -71,7 +73,6 @@ class CodeSerializer : public Serializer { ...@@ -71,7 +73,6 @@ class CodeSerializer : public Serializer {
DISALLOW_HEAP_ALLOCATION(no_gc_) DISALLOW_HEAP_ALLOCATION(no_gc_)
uint32_t source_hash_; uint32_t source_hash_;
DISALLOW_COPY_AND_ASSIGN(CodeSerializer);
}; };
// Wrapper around ScriptData to provide code-serializer-specific functionality. // Wrapper around ScriptData to provide code-serializer-specific functionality.
......
...@@ -21,6 +21,8 @@ class V8_EXPORT_PRIVATE ContextSerializer : public Serializer { ...@@ -21,6 +21,8 @@ class V8_EXPORT_PRIVATE ContextSerializer : public Serializer {
v8::SerializeEmbedderFieldsCallback callback); v8::SerializeEmbedderFieldsCallback callback);
~ContextSerializer() override; ~ContextSerializer() override;
ContextSerializer(const ContextSerializer&) = delete;
ContextSerializer& operator=(const ContextSerializer&) = delete;
// Serialize the objects reachable from a single object pointer. // Serialize the objects reachable from a single object pointer.
void Serialize(Context* o, const DisallowGarbageCollection& no_gc); void Serialize(Context* o, const DisallowGarbageCollection& no_gc);
...@@ -42,7 +44,6 @@ class V8_EXPORT_PRIVATE ContextSerializer : public Serializer { ...@@ -42,7 +44,6 @@ class V8_EXPORT_PRIVATE ContextSerializer : public Serializer {
// Used to store serialized data for embedder fields. // Used to store serialized data for embedder fields.
SnapshotByteSink embedder_fields_sink_; SnapshotByteSink embedder_fields_sink_;
DISALLOW_COPY_AND_ASSIGN(ContextSerializer);
}; };
} // namespace internal } // namespace internal
......
...@@ -53,6 +53,8 @@ class V8_EXPORT_PRIVATE Deserializer : public SerializerDeserializer { ...@@ -53,6 +53,8 @@ class V8_EXPORT_PRIVATE Deserializer : public SerializerDeserializer {
static constexpr Smi uninitialized_field_value() { return Smi(kNullAddress); } static constexpr Smi uninitialized_field_value() { return Smi(kNullAddress); }
~Deserializer() override; ~Deserializer() override;
Deserializer(const Deserializer&) = delete;
Deserializer& operator=(const Deserializer&) = delete;
uint32_t GetChecksum() const { return source_.GetChecksum(); } uint32_t GetChecksum() const { return source_.GetChecksum(); }
...@@ -138,6 +140,8 @@ class V8_EXPORT_PRIVATE Deserializer : public SerializerDeserializer { ...@@ -138,6 +140,8 @@ class V8_EXPORT_PRIVATE Deserializer : public SerializerDeserializer {
class HotObjectsList { class HotObjectsList {
public: public:
HotObjectsList() = default; HotObjectsList() = default;
HotObjectsList(const HotObjectsList&) = delete;
HotObjectsList& operator=(const HotObjectsList&) = delete;
void Add(Handle<HeapObject> object) { void Add(Handle<HeapObject> object) {
circular_queue_[index_] = object; circular_queue_[index_] = object;
...@@ -155,8 +159,6 @@ class V8_EXPORT_PRIVATE Deserializer : public SerializerDeserializer { ...@@ -155,8 +159,6 @@ class V8_EXPORT_PRIVATE Deserializer : public SerializerDeserializer {
STATIC_ASSERT(base::bits::IsPowerOfTwo(kSize)); STATIC_ASSERT(base::bits::IsPowerOfTwo(kSize));
Handle<HeapObject> circular_queue_[kSize]; Handle<HeapObject> circular_queue_[kSize];
int index_ = 0; int index_ = 0;
DISALLOW_COPY_AND_ASSIGN(HotObjectsList);
}; };
void VisitRootPointers(Root root, const char* description, void VisitRootPointers(Root root, const char* description,
...@@ -260,8 +262,6 @@ class V8_EXPORT_PRIVATE Deserializer : public SerializerDeserializer { ...@@ -260,8 +262,6 @@ class V8_EXPORT_PRIVATE Deserializer : public SerializerDeserializer {
Handle<HeapObject> previous_allocation_obj_; Handle<HeapObject> previous_allocation_obj_;
int previous_allocation_size_ = 0; int previous_allocation_size_ = 0;
#endif // DEBUG #endif // DEBUG
DISALLOW_COPY_AND_ASSIGN(Deserializer);
}; };
// Used to insert a deserialized internalized string into the string table. // Used to insert a deserialized internalized string into the string table.
......
...@@ -20,6 +20,8 @@ class V8_EXPORT_PRIVATE ReadOnlySerializer : public RootsSerializer { ...@@ -20,6 +20,8 @@ class V8_EXPORT_PRIVATE ReadOnlySerializer : public RootsSerializer {
public: public:
ReadOnlySerializer(Isolate* isolate, Snapshot::SerializerFlags flags); ReadOnlySerializer(Isolate* isolate, Snapshot::SerializerFlags flags);
~ReadOnlySerializer() override; ~ReadOnlySerializer() override;
ReadOnlySerializer(const ReadOnlySerializer&) = delete;
ReadOnlySerializer& operator=(const ReadOnlySerializer&) = delete;
void SerializeReadOnlyRoots(); void SerializeReadOnlyRoots();
...@@ -42,7 +44,6 @@ class V8_EXPORT_PRIVATE ReadOnlySerializer : public RootsSerializer { ...@@ -42,7 +44,6 @@ class V8_EXPORT_PRIVATE ReadOnlySerializer : public RootsSerializer {
IdentityMap<int, base::DefaultAllocationPolicy> serialized_objects_; IdentityMap<int, base::DefaultAllocationPolicy> serialized_objects_;
bool did_serialize_not_mapped_symbol_; bool did_serialize_not_mapped_symbol_;
#endif #endif
DISALLOW_COPY_AND_ASSIGN(ReadOnlySerializer);
}; };
} // namespace internal } // namespace internal
......
...@@ -26,6 +26,8 @@ class RootsSerializer : public Serializer { ...@@ -26,6 +26,8 @@ class RootsSerializer : public Serializer {
// are already serialized. // are already serialized.
RootsSerializer(Isolate* isolate, Snapshot::SerializerFlags flags, RootsSerializer(Isolate* isolate, Snapshot::SerializerFlags flags,
RootIndex first_root_to_be_serialized); RootIndex first_root_to_be_serialized);
RootsSerializer(const RootsSerializer&) = delete;
RootsSerializer& operator=(const RootsSerializer&) = delete;
bool can_be_rehashed() const { return can_be_rehashed_; } bool can_be_rehashed() const { return can_be_rehashed_; }
bool root_has_been_serialized(RootIndex root_index) const { bool root_has_been_serialized(RootIndex root_index) const {
...@@ -55,8 +57,6 @@ class RootsSerializer : public Serializer { ...@@ -55,8 +57,6 @@ class RootsSerializer : public Serializer {
// Indicates whether we only serialized hash tables that we can rehash. // Indicates whether we only serialized hash tables that we can rehash.
// TODO(yangguo): generalize rehashing, and remove this flag. // TODO(yangguo): generalize rehashing, and remove this flag.
bool can_be_rehashed_; bool can_be_rehashed_;
DISALLOW_COPY_AND_ASSIGN(RootsSerializer);
}; };
} // namespace internal } // namespace internal
......
...@@ -47,6 +47,8 @@ class CodeAddressMap : public CodeEventLogger { ...@@ -47,6 +47,8 @@ class CodeAddressMap : public CodeEventLogger {
class NameMap { class NameMap {
public: public:
NameMap() : impl_() {} NameMap() : impl_() {}
NameMap(const NameMap&) = delete;
NameMap& operator=(const NameMap&) = delete;
~NameMap() { ~NameMap() {
for (base::HashMap::Entry* p = impl_.Start(); p != nullptr; for (base::HashMap::Entry* p = impl_.Start(); p != nullptr;
...@@ -114,8 +116,6 @@ class CodeAddressMap : public CodeEventLogger { ...@@ -114,8 +116,6 @@ class CodeAddressMap : public CodeEventLogger {
} }
base::HashMap impl_; base::HashMap impl_;
DISALLOW_COPY_AND_ASSIGN(NameMap);
}; };
void LogRecordedBuffer(Handle<AbstractCode> code, void LogRecordedBuffer(Handle<AbstractCode> code,
...@@ -135,6 +135,8 @@ class CodeAddressMap : public CodeEventLogger { ...@@ -135,6 +135,8 @@ class CodeAddressMap : public CodeEventLogger {
class ObjectCacheIndexMap { class ObjectCacheIndexMap {
public: public:
explicit ObjectCacheIndexMap(Heap* heap) : map_(heap), next_index_(0) {} explicit ObjectCacheIndexMap(Heap* heap) : map_(heap), next_index_(0) {}
ObjectCacheIndexMap(const ObjectCacheIndexMap&) = delete;
ObjectCacheIndexMap& operator=(const ObjectCacheIndexMap&) = delete;
// If |obj| is in the map, immediately return true. Otherwise add it to the // If |obj| is in the map, immediately return true. Otherwise add it to the
// map and return false. In either case set |*index_out| to the index // map and return false. In either case set |*index_out| to the index
...@@ -153,14 +155,14 @@ class ObjectCacheIndexMap { ...@@ -153,14 +155,14 @@ class ObjectCacheIndexMap {
IdentityMap<int, base::DefaultAllocationPolicy> map_; IdentityMap<int, base::DefaultAllocationPolicy> map_;
int next_index_; int next_index_;
DISALLOW_COPY_AND_ASSIGN(ObjectCacheIndexMap);
}; };
class Serializer : public SerializerDeserializer { class Serializer : public SerializerDeserializer {
public: public:
Serializer(Isolate* isolate, Snapshot::SerializerFlags flags); Serializer(Isolate* isolate, Snapshot::SerializerFlags flags);
~Serializer() override { DCHECK_EQ(unresolved_forward_refs_, 0); } ~Serializer() override { DCHECK_EQ(unresolved_forward_refs_, 0); }
Serializer(const Serializer&) = delete;
Serializer& operator=(const Serializer&) = delete;
const std::vector<byte>* Payload() const { return sink_.data(); } const std::vector<byte>* Payload() const { return sink_.data(); }
...@@ -298,6 +300,8 @@ class Serializer : public SerializerDeserializer { ...@@ -298,6 +300,8 @@ class Serializer : public SerializerDeserializer {
public: public:
explicit HotObjectsList(Heap* heap); explicit HotObjectsList(Heap* heap);
~HotObjectsList(); ~HotObjectsList();
HotObjectsList(const HotObjectsList&) = delete;
HotObjectsList& operator=(const HotObjectsList&) = delete;
void Add(HeapObject object) { void Add(HeapObject object) {
circular_queue_[index_] = object.ptr(); circular_queue_[index_] = object.ptr();
...@@ -324,8 +328,6 @@ class Serializer : public SerializerDeserializer { ...@@ -324,8 +328,6 @@ class Serializer : public SerializerDeserializer {
StrongRootsEntry* strong_roots_entry_; StrongRootsEntry* strong_roots_entry_;
Address circular_queue_[kSize] = {kNullAddress}; Address circular_queue_[kSize] = {kNullAddress};
int index_ = 0; int index_ = 0;
DISALLOW_COPY_AND_ASSIGN(HotObjectsList);
}; };
// Disallow GC during serialization. // Disallow GC during serialization.
...@@ -380,8 +382,6 @@ class Serializer : public SerializerDeserializer { ...@@ -380,8 +382,6 @@ class Serializer : public SerializerDeserializer {
GlobalHandleVector<HeapObject> back_refs_; GlobalHandleVector<HeapObject> back_refs_;
GlobalHandleVector<HeapObject> stack_; GlobalHandleVector<HeapObject> stack_;
#endif // DEBUG #endif // DEBUG
DISALLOW_COPY_AND_ASSIGN(Serializer);
}; };
class RelocInfoIterator; class RelocInfoIterator;
......
...@@ -30,6 +30,8 @@ class SerializedData { ...@@ -30,6 +30,8 @@ class SerializedData {
// Ensure |other| will not attempt to destroy our data in destructor. // Ensure |other| will not attempt to destroy our data in destructor.
other.owns_data_ = false; other.owns_data_ = false;
} }
SerializedData(const SerializedData&) = delete;
SerializedData& operator=(const SerializedData&) = delete;
virtual ~SerializedData() { virtual ~SerializedData() {
if (owns_data_) DeleteArray<byte>(data_); if (owns_data_) DeleteArray<byte>(data_);
...@@ -62,9 +64,6 @@ class SerializedData { ...@@ -62,9 +64,6 @@ class SerializedData {
byte* data_; byte* data_;
uint32_t size_; uint32_t size_;
bool owns_data_; bool owns_data_;
private:
DISALLOW_COPY_AND_ASSIGN(SerializedData);
}; };
// Wrapper around reservation sizes and the serialization payload. // Wrapper around reservation sizes and the serialization payload.
......
...@@ -33,6 +33,8 @@ class SnapshotByteSource final { ...@@ -33,6 +33,8 @@ class SnapshotByteSource final {
: data_(payload.begin()), length_(payload.length()), position_(0) {} : data_(payload.begin()), length_(payload.length()), position_(0) {}
~SnapshotByteSource() = default; ~SnapshotByteSource() = default;
SnapshotByteSource(const SnapshotByteSource&) = delete;
SnapshotByteSource& operator=(const SnapshotByteSource&) = delete;
bool HasMore() { return position_ < length_; } bool HasMore() { return position_ < length_; }
...@@ -108,8 +110,6 @@ class SnapshotByteSource final { ...@@ -108,8 +110,6 @@ class SnapshotByteSource final {
const byte* data_; const byte* data_;
int length_; int length_;
int position_; int position_;
DISALLOW_COPY_AND_ASSIGN(SnapshotByteSource);
}; };
/** /**
......
...@@ -22,6 +22,8 @@ class V8_EXPORT_PRIVATE StartupSerializer : public RootsSerializer { ...@@ -22,6 +22,8 @@ class V8_EXPORT_PRIVATE StartupSerializer : public RootsSerializer {
StartupSerializer(Isolate* isolate, Snapshot::SerializerFlags flags, StartupSerializer(Isolate* isolate, Snapshot::SerializerFlags flags,
ReadOnlySerializer* read_only_serializer); ReadOnlySerializer* read_only_serializer);
~StartupSerializer() override; ~StartupSerializer() override;
StartupSerializer(const StartupSerializer&) = delete;
StartupSerializer& operator=(const StartupSerializer&) = delete;
// Serialize the current state of the heap. The order is: // Serialize the current state of the heap. The order is:
// 1) Strong roots // 1) Strong roots
...@@ -54,8 +56,6 @@ class V8_EXPORT_PRIVATE StartupSerializer : public RootsSerializer { ...@@ -54,8 +56,6 @@ class V8_EXPORT_PRIVATE StartupSerializer : public RootsSerializer {
ReadOnlySerializer* read_only_serializer_; ReadOnlySerializer* read_only_serializer_;
GlobalHandleVector<AccessorInfo> accessor_infos_; GlobalHandleVector<AccessorInfo> accessor_infos_;
GlobalHandleVector<CallHandlerInfo> call_handler_infos_; GlobalHandleVector<CallHandlerInfo> call_handler_infos_;
DISALLOW_COPY_AND_ASSIGN(StartupSerializer);
}; };
class SerializedHandleChecker : public RootVisitor { class SerializedHandleChecker : public RootVisitor {
......
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