| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 accumulator = (accumulator | (snapshot_byte & 0x7f)) << 7; | 140 accumulator = (accumulator | (snapshot_byte & 0x7f)) << 7; |
| 141 } | 141 } |
| 142 UNREACHABLE(); | 142 UNREACHABLE(); |
| 143 return accumulator; | 143 return accumulator; |
| 144 } | 144 } |
| 145 | 145 |
| 146 bool AtEOF() { | 146 bool AtEOF() { |
| 147 return position_ == length_; | 147 return position_ == length_; |
| 148 } | 148 } |
| 149 | 149 |
| 150 const int position() { return position_; } |
| 151 |
| 150 private: | 152 private: |
| 151 const byte* data_; | 153 const byte* data_; |
| 152 int length_; | 154 int length_; |
| 153 int position_; | 155 int position_; |
| 154 }; | 156 }; |
| 155 | 157 |
| 156 | 158 |
| 157 // It is very common to have a reference to the object at word 10 in space 2, | 159 // It is very common to have a reference to the object at word 10 in space 2, |
| 158 // the object at word 5 in space 2 and the object at word 28 in space 4. This | 160 // the object at word 5 in space 2 and the object at word 28 in space 4. This |
| 159 // only works for objects in the first page of a space. | 161 // only works for objects in the first page of a space. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 289 |
| 288 | 290 |
| 289 class SnapshotByteSink { | 291 class SnapshotByteSink { |
| 290 public: | 292 public: |
| 291 virtual ~SnapshotByteSink() { } | 293 virtual ~SnapshotByteSink() { } |
| 292 virtual void Put(int byte, const char* description) = 0; | 294 virtual void Put(int byte, const char* description) = 0; |
| 293 virtual void PutSection(int byte, const char* description) { | 295 virtual void PutSection(int byte, const char* description) { |
| 294 Put(byte, description); | 296 Put(byte, description); |
| 295 } | 297 } |
| 296 void PutInt(uintptr_t integer, const char* description); | 298 void PutInt(uintptr_t integer, const char* description); |
| 299 virtual int Position() = 0; |
| 297 }; | 300 }; |
| 298 | 301 |
| 299 | 302 |
| 300 class Serializer : public SerDes { | 303 class Serializer : public SerDes { |
| 301 public: | 304 public: |
| 302 explicit Serializer(SnapshotByteSink* sink); | 305 explicit Serializer(SnapshotByteSink* sink); |
| 303 // Serialize the current state of the heap. | 306 // Serialize the current state of the heap. |
| 304 void Serialize(); | 307 void Serialize(); |
| 305 // Serialize a single object and the objects reachable from it. | 308 // Serialize a single object and the objects reachable from it. |
| 306 void SerializePartial(Object** obj); | 309 void SerializePartial(Object** obj); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 405 |
| 403 friend class ObjectSerializer; | 406 friend class ObjectSerializer; |
| 404 friend class Deserializer; | 407 friend class Deserializer; |
| 405 | 408 |
| 406 DISALLOW_COPY_AND_ASSIGN(Serializer); | 409 DISALLOW_COPY_AND_ASSIGN(Serializer); |
| 407 }; | 410 }; |
| 408 | 411 |
| 409 } } // namespace v8::internal | 412 } } // namespace v8::internal |
| 410 | 413 |
| 411 #endif // V8_SERIALIZE_H_ | 414 #endif // V8_SERIALIZE_H_ |
| OLD | NEW |