Chromium Code Reviews| Index: src/serialize.h |
| diff --git a/src/serialize.h b/src/serialize.h |
| index 958f20e24f3d45e84e939c4cf2aea7200dc7e212..e8383a99e1f6a3565d40e7639717063df80e1927 100644 |
| --- a/src/serialize.h |
| +++ b/src/serialize.h |
| @@ -5,7 +5,8 @@ |
| #ifndef V8_SERIALIZE_H_ |
| #define V8_SERIALIZE_H_ |
| -#include "hashmap.h" |
| +#include "v8.h" |
|
Benedikt Meurer
2014/05/27 04:09:59
Nit: Please don't introduce new v8.h includes, but
vogelheim
2014/05/27 15:20:23
Done.
|
| +#include "snapshot-source-sink.h" |
| namespace v8 { |
| namespace internal { |
| @@ -135,49 +136,6 @@ class ExternalReferenceDecoder { |
| }; |
| -class SnapshotByteSource { |
| - public: |
| - SnapshotByteSource(const byte* array, int length) |
| - : data_(array), length_(length), position_(0) { } |
| - |
| - bool HasMore() { return position_ < length_; } |
| - |
| - int Get() { |
| - ASSERT(position_ < length_); |
| - return data_[position_++]; |
| - } |
| - |
| - int32_t GetUnalignedInt() { |
| -#if defined(V8_HOST_CAN_READ_UNALIGNED) && __BYTE_ORDER == __LITTLE_ENDIAN |
| - int32_t answer; |
| - ASSERT(position_ + sizeof(answer) <= length_ + 0u); |
| - answer = *reinterpret_cast<const int32_t*>(data_ + position_); |
| -#else |
| - int32_t answer = data_[position_]; |
| - answer |= data_[position_ + 1] << 8; |
| - answer |= data_[position_ + 2] << 16; |
| - answer |= data_[position_ + 3] << 24; |
| -#endif |
| - return answer; |
| - } |
| - |
| - void Advance(int by) { position_ += by; } |
| - |
| - inline void CopyRaw(byte* to, int number_of_bytes); |
| - |
| - inline int GetInt(); |
| - |
| - bool AtEOF(); |
| - |
| - int position() { return position_; } |
| - |
| - private: |
| - const byte* data_; |
| - int length_; |
| - int position_; |
| -}; |
| - |
| - |
| // The Serializer/Deserializer class is a common superclass for Serializer and |
| // Deserializer which is used to store common constants and methods used by |
| // both. |
| @@ -271,26 +229,6 @@ class SerializerDeserializer: public ObjectVisitor { |
| }; |
| -int SnapshotByteSource::GetInt() { |
| - // This way of variable-length encoding integers does not suffer from branch |
| - // mispredictions. |
| - uint32_t answer = GetUnalignedInt(); |
| - int bytes = answer & 3; |
| - Advance(bytes); |
| - uint32_t mask = 0xffffffffu; |
| - mask >>= 32 - (bytes << 3); |
| - answer &= mask; |
| - answer >>= 2; |
| - return answer; |
| -} |
| - |
| - |
| -void SnapshotByteSource::CopyRaw(byte* to, int number_of_bytes) { |
| - OS::MemCopy(to, data_ + position_, number_of_bytes); |
| - position_ += number_of_bytes; |
| -} |
| - |
| - |
| // A Deserializer reads a snapshot and reconstructs the Object graph it defines. |
| class Deserializer: public SerializerDeserializer { |
| public: |
| @@ -371,18 +309,6 @@ class Deserializer: public SerializerDeserializer { |
| }; |
| -class SnapshotByteSink { |
| - public: |
| - virtual ~SnapshotByteSink() { } |
| - virtual void Put(int byte, const char* description) = 0; |
| - virtual void PutSection(int byte, const char* description) { |
| - Put(byte, description); |
| - } |
| - void PutInt(uintptr_t integer, const char* description); |
| - virtual int Position() = 0; |
| -}; |
| - |
| - |
| // Mapping objects to their location after deserialization. |
| // This is used during building, but not at runtime by V8. |
| class SerializationAddressMapper { |