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