Commit ead726f3 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[snapshot][ptr-compr] Stop using UnalignedSlot

... in favor of [Full]MaybeObjectSlot and finally make deserializer
pointer compression friendly.

Bug: v8:8794
Change-Id: I23e5b119ccfe7d0c12c15a857978d89813e0522f
Reviewed-on: https://chromium-review.googlesource.com/c/1460460
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59472}
parent 51f11f0f
......@@ -137,6 +137,8 @@ class FullMaybeObjectSlot
explicit FullMaybeObjectSlot(Address ptr) : SlotBase(ptr) {}
explicit FullMaybeObjectSlot(Object* ptr)
: SlotBase(reinterpret_cast<Address>(ptr)) {}
explicit FullMaybeObjectSlot(MaybeObject* ptr)
: SlotBase(reinterpret_cast<Address>(ptr)) {}
template <typename T>
explicit FullMaybeObjectSlot(SlotBase<T, TData, kSlotDataSize> slot)
: SlotBase(slot.address()) {}
......
......@@ -99,6 +99,8 @@ class CompressedMaybeObjectSlot
explicit CompressedMaybeObjectSlot(Address ptr) : SlotBase(ptr) {}
explicit CompressedMaybeObjectSlot(Object* ptr)
: SlotBase(reinterpret_cast<Address>(ptr)) {}
explicit CompressedMaybeObjectSlot(MaybeObject* ptr)
: SlotBase(reinterpret_cast<Address>(ptr)) {}
template <typename T>
explicit CompressedMaybeObjectSlot(SlotBase<T, TData, kSlotDataSize> slot)
: SlotBase(slot.address()) {}
......
This diff is collapsed.
......@@ -22,7 +22,6 @@ namespace internal {
class HeapObject;
class Object;
class UnalignedSlot;
// Used for platforms with embedded constant pools to trigger deserialization
// of objects found in code.
......@@ -113,23 +112,26 @@ class Deserializer : public SerializerDeserializer {
void Synchronize(VisitorSynchronization::SyncTag tag) override;
void UnalignedCopy(UnalignedSlot dest, MaybeObject value);
void UnalignedCopy(UnalignedSlot dest, Address value);
template <typename TSlot>
inline TSlot Write(TSlot dest, MaybeObject value);
template <typename TSlot>
inline TSlot WriteAddress(TSlot dest, Address value);
// Fills in some heap data in an area from start to end (non-inclusive). The
// space id is used for the write barrier. The object_address is the address
// of the object we are writing into, or nullptr if we are not writing into an
// object, i.e. if we are writing a series of tagged values that are not on
// the heap. Return false if the object content has been deferred.
bool ReadData(UnalignedSlot start, UnalignedSlot end, int space,
Address object_address);
template <typename TSlot>
bool ReadData(TSlot start, TSlot end, int space, Address object_address);
// A helper function for ReadData, templatized on the bytecode for efficiency.
// Returns the new value of {current}.
template <Bytecode bytecode, int space_number_if_any>
inline UnalignedSlot ReadDataCase(Isolate* isolate, UnalignedSlot current,
Address current_object_address, byte data,
bool write_barrier_needed);
template <typename TSlot, Bytecode bytecode, int space_number_if_any>
inline TSlot ReadDataCase(Isolate* isolate, TSlot current,
Address current_object_address, byte data,
bool write_barrier_needed);
// A helper function for ReadData for reading external references.
inline Address ReadExternalReferenceCase();
......@@ -147,7 +149,8 @@ class Deserializer : public SerializerDeserializer {
void VisitOffHeapTarget(Code host, RelocInfo* rinfo);
private:
UnalignedSlot ReadRepeatedObject(UnalignedSlot current, int repeat_count);
template <typename TSlot>
TSlot ReadRepeatedObject(TSlot current, int repeat_count);
// Special handling for serialized code like hooking up internalized strings.
HeapObject PostProcessNewObject(HeapObject obj, int space);
......
......@@ -481,6 +481,7 @@ void Serializer::ObjectSerializer::SerializeExternalStringAsSequentialString() {
// Output the rest of the imaginary string.
int bytes_to_output = allocation_size - HeapObject::kHeaderSize;
DCHECK(IsAligned(bytes_to_output, kTaggedSize));
// Output raw data header. Do not bother with common raw length cases here.
sink_->Put(kVariableRawData, "RawDataForString");
......@@ -876,6 +877,7 @@ void Serializer::ObjectSerializer::OutputCode(int size) {
Address start = off_heap_code->address() + Code::kDataStart;
int bytes_to_output = size - Code::kDataStart;
DCHECK(IsAligned(bytes_to_output, kTaggedSize));
sink_->Put(kVariableRawCode, "VariableRawCode");
sink_->PutInt(bytes_to_output, "length");
......
......@@ -38,7 +38,7 @@ class SnapshotByteSource final {
void Advance(int by) { position_ += by; }
void CopyRaw(byte* to, int number_of_bytes) {
void CopyRaw(void* to, int number_of_bytes) {
memcpy(to, data_ + position_, number_of_bytes);
position_ += number_of_bytes;
}
......
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