Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 1 | // Copyright 2006-2009 the V8 project authors. All rights reserved. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #ifndef V8_SERIALIZE_H_ |
| 29 | #define V8_SERIALIZE_H_ |
| 30 | |
| 31 | #include "hashmap.h" |
| 32 | |
| 33 | namespace v8 { |
| 34 | namespace internal { |
| 35 | |
| 36 | // A TypeCode is used to distinguish different kinds of external reference. |
| 37 | // It is a single bit to make testing for types easy. |
| 38 | enum TypeCode { |
| 39 | UNCLASSIFIED, // One-of-a-kind references. |
| 40 | BUILTIN, |
| 41 | RUNTIME_FUNCTION, |
| 42 | IC_UTILITY, |
| 43 | DEBUG_ADDRESS, |
| 44 | STATS_COUNTER, |
| 45 | TOP_ADDRESS, |
| 46 | C_BUILTIN, |
| 47 | EXTENSION, |
| 48 | ACCESSOR, |
| 49 | RUNTIME_ENTRY, |
| 50 | STUB_CACHE_TABLE |
| 51 | }; |
| 52 | |
| 53 | const int kTypeCodeCount = STUB_CACHE_TABLE + 1; |
| 54 | const int kFirstTypeCode = UNCLASSIFIED; |
| 55 | |
| 56 | const int kReferenceIdBits = 16; |
| 57 | const int kReferenceIdMask = (1 << kReferenceIdBits) - 1; |
| 58 | const int kReferenceTypeShift = kReferenceIdBits; |
| 59 | const int kDebugRegisterBits = 4; |
| 60 | const int kDebugIdShift = kDebugRegisterBits; |
| 61 | |
| 62 | |
| 63 | class ExternalReferenceEncoder { |
| 64 | public: |
| 65 | ExternalReferenceEncoder(); |
| 66 | |
| 67 | uint32_t Encode(Address key) const; |
| 68 | |
| 69 | const char* NameOfAddress(Address key) const; |
| 70 | |
| 71 | private: |
| 72 | HashMap encodings_; |
| 73 | static uint32_t Hash(Address key) { |
| 74 | return static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key) >> 2); |
| 75 | } |
| 76 | |
| 77 | int IndexOf(Address key) const; |
| 78 | |
| 79 | static bool Match(void* key1, void* key2) { return key1 == key2; } |
| 80 | |
| 81 | void Put(Address key, int index); |
| 82 | }; |
| 83 | |
| 84 | |
| 85 | class ExternalReferenceDecoder { |
| 86 | public: |
| 87 | ExternalReferenceDecoder(); |
| 88 | ~ExternalReferenceDecoder(); |
| 89 | |
| 90 | Address Decode(uint32_t key) const { |
| 91 | if (key == 0) return NULL; |
| 92 | return *Lookup(key); |
| 93 | } |
| 94 | |
| 95 | private: |
| 96 | Address** encodings_; |
| 97 | |
| 98 | Address* Lookup(uint32_t key) const { |
| 99 | int type = key >> kReferenceTypeShift; |
| 100 | ASSERT(kFirstTypeCode <= type && type < kTypeCodeCount); |
| 101 | int id = key & kReferenceIdMask; |
| 102 | return &encodings_[type][id]; |
| 103 | } |
| 104 | |
| 105 | void Put(uint32_t key, Address value) { |
| 106 | *Lookup(key) = value; |
| 107 | } |
| 108 | }; |
| 109 | |
| 110 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 111 | class SnapshotByteSource { |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 112 | public: |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 113 | SnapshotByteSource(const byte* array, int length) |
| 114 | : data_(array), length_(length), position_(0) { } |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 115 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 116 | bool HasMore() { return position_ < length_; } |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 117 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 118 | int Get() { |
| 119 | ASSERT(position_ < length_); |
| 120 | return data_[position_++]; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 121 | } |
| 122 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 123 | void CopyRaw(byte* to, int number_of_bytes) { |
| 124 | memcpy(to, data_ + position_, number_of_bytes); |
| 125 | position_ += number_of_bytes; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | int GetInt() { |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 129 | // A little unwind to catch the really small ints. |
| 130 | int snapshot_byte = Get(); |
| 131 | if ((snapshot_byte & 0x80) == 0) { |
| 132 | return snapshot_byte; |
| 133 | } |
| 134 | int accumulator = (snapshot_byte & 0x7f) << 7; |
| 135 | while (true) { |
| 136 | snapshot_byte = Get(); |
| 137 | if ((snapshot_byte & 0x80) == 0) { |
| 138 | return accumulator | snapshot_byte; |
| 139 | } |
| 140 | accumulator = (accumulator | (snapshot_byte & 0x7f)) << 7; |
| 141 | } |
| 142 | UNREACHABLE(); |
| 143 | return accumulator; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 144 | } |
| 145 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 146 | bool AtEOF() { |
| 147 | return position_ == length_; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 148 | } |
| 149 | |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame^] | 150 | const int position() { return position_; } |
| 151 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 152 | private: |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 153 | const byte* data_; |
| 154 | int length_; |
| 155 | int position_; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 156 | }; |
| 157 | |
| 158 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 159 | // It is very common to have a reference to the object at word 10 in space 2, |
| 160 | // the object at word 5 in space 2 and the object at word 28 in space 4. This |
| 161 | // only works for objects in the first page of a space. |
| 162 | #define COMMON_REFERENCE_PATTERNS(f) \ |
| 163 | f(kNumberOfSpaces, 2, 10) \ |
| 164 | f(kNumberOfSpaces + 1, 2, 5) \ |
| 165 | f(kNumberOfSpaces + 2, 4, 28) \ |
| 166 | f(kNumberOfSpaces + 3, 2, 21) \ |
| 167 | f(kNumberOfSpaces + 4, 2, 98) \ |
| 168 | f(kNumberOfSpaces + 5, 2, 67) \ |
| 169 | f(kNumberOfSpaces + 6, 4, 132) |
| 170 | |
| 171 | #define COMMON_RAW_LENGTHS(f) \ |
| 172 | f(1, 1) \ |
| 173 | f(2, 2) \ |
| 174 | f(3, 3) \ |
| 175 | f(4, 4) \ |
| 176 | f(5, 5) \ |
| 177 | f(6, 6) \ |
| 178 | f(7, 7) \ |
| 179 | f(8, 8) \ |
| 180 | f(9, 12) \ |
| 181 | f(10, 16) \ |
| 182 | f(11, 20) \ |
| 183 | f(12, 24) \ |
| 184 | f(13, 28) \ |
| 185 | f(14, 32) \ |
| 186 | f(15, 36) |
| 187 | |
| 188 | // The SerDes class is a common superclass for Serializer and Deserializer |
| 189 | // which is used to store common constants and methods used by both. |
| 190 | class SerDes: public ObjectVisitor { |
| 191 | protected: |
| 192 | enum DataType { |
| 193 | RAW_DATA_SERIALIZATION = 0, |
| 194 | // And 15 common raw lengths. |
| 195 | OBJECT_SERIALIZATION = 16, |
| 196 | // One variant per space. |
| 197 | CODE_OBJECT_SERIALIZATION = 25, |
| 198 | // One per space (only code spaces in use). |
| 199 | EXTERNAL_REFERENCE_SERIALIZATION = 34, |
| 200 | EXTERNAL_BRANCH_TARGET_SERIALIZATION = 35, |
| 201 | SYNCHRONIZE = 36, |
| 202 | START_NEW_PAGE_SERIALIZATION = 37, |
| 203 | NATIVES_STRING_RESOURCE = 38, |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame^] | 204 | ROOT_SERIALIZATION = 39, |
| 205 | // Free: 40-47. |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 206 | BACKREF_SERIALIZATION = 48, |
| 207 | // One per space, must be kSpaceMask aligned. |
| 208 | // Free: 57-63. |
| 209 | REFERENCE_SERIALIZATION = 64, |
| 210 | // One per space and common references. Must be kSpaceMask aligned. |
| 211 | CODE_BACKREF_SERIALIZATION = 80, |
| 212 | // One per space, must be kSpaceMask aligned. |
| 213 | // Free: 89-95. |
| 214 | CODE_REFERENCE_SERIALIZATION = 96 |
| 215 | // One per space, must be kSpaceMask aligned. |
| 216 | // Free: 105-255. |
| 217 | }; |
| 218 | static const int kLargeData = LAST_SPACE; |
| 219 | static const int kLargeCode = kLargeData + 1; |
| 220 | static const int kLargeFixedArray = kLargeCode + 1; |
| 221 | static const int kNumberOfSpaces = kLargeFixedArray + 1; |
| 222 | |
| 223 | // A bitmask for getting the space out of an instruction. |
| 224 | static const int kSpaceMask = 15; |
| 225 | |
| 226 | static inline bool SpaceIsLarge(int space) { return space >= kLargeData; } |
| 227 | static inline bool SpaceIsPaged(int space) { |
| 228 | return space >= FIRST_PAGED_SPACE && space <= LAST_PAGED_SPACE; |
| 229 | } |
| 230 | }; |
| 231 | |
| 232 | |
| 233 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 234 | // A Deserializer reads a snapshot and reconstructs the Object graph it defines. |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 235 | class Deserializer: public SerDes { |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 236 | public: |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 237 | // Create a deserializer from a snapshot byte source. |
| 238 | explicit Deserializer(SnapshotByteSource* source); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 239 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 240 | virtual ~Deserializer() { } |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 241 | |
| 242 | // Deserialize the snapshot into an empty heap. |
| 243 | void Deserialize(); |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame^] | 244 | |
| 245 | // Deserialize a single object and the objects reachable from it. |
| 246 | void DeserializePartial(Object** root); |
| 247 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 248 | #ifdef DEBUG |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 249 | virtual void Synchronize(const char* tag); |
| 250 | #endif |
| 251 | |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame^] | 252 | static void TearDown(); |
| 253 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 254 | private: |
| 255 | virtual void VisitPointers(Object** start, Object** end); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 256 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 257 | virtual void VisitExternalReferences(Address* start, Address* end) { |
| 258 | UNREACHABLE(); |
| 259 | } |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 260 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 261 | virtual void VisitRuntimeEntry(RelocInfo* rinfo) { |
| 262 | UNREACHABLE(); |
| 263 | } |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 264 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 265 | void ReadChunk(Object** start, Object** end, int space, Address address); |
| 266 | HeapObject* GetAddressFromStart(int space); |
| 267 | inline HeapObject* GetAddressFromEnd(int space); |
| 268 | Address Allocate(int space_number, Space* space, int size); |
| 269 | void ReadObject(int space_number, Space* space, Object** write_back); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 270 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 271 | // Keep track of the pages in the paged spaces. |
| 272 | // (In large object space we are keeping track of individual objects |
| 273 | // rather than pages.) In new space we just need the address of the |
| 274 | // first object and the others will flow from that. |
| 275 | List<Address> pages_[SerDes::kNumberOfSpaces]; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 276 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 277 | SnapshotByteSource* source_; |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame^] | 278 | static ExternalReferenceDecoder* external_reference_decoder_; |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 279 | // This is the address of the next object that will be allocated in each |
| 280 | // space. It is used to calculate the addresses of back-references. |
| 281 | Address high_water_[LAST_SPACE + 1]; |
| 282 | // This is the address of the most recent object that was allocated. It |
| 283 | // is used to set the location of the new page when we encounter a |
| 284 | // START_NEW_PAGE_SERIALIZATION tag. |
| 285 | Address last_object_address_; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 286 | |
| 287 | DISALLOW_COPY_AND_ASSIGN(Deserializer); |
| 288 | }; |
| 289 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 290 | |
| 291 | class SnapshotByteSink { |
| 292 | public: |
| 293 | virtual ~SnapshotByteSink() { } |
| 294 | virtual void Put(int byte, const char* description) = 0; |
| 295 | virtual void PutSection(int byte, const char* description) { |
| 296 | Put(byte, description); |
| 297 | } |
| 298 | void PutInt(uintptr_t integer, const char* description); |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame^] | 299 | virtual int Position() = 0; |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 300 | }; |
| 301 | |
| 302 | |
| 303 | class Serializer : public SerDes { |
| 304 | public: |
| 305 | explicit Serializer(SnapshotByteSink* sink); |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame^] | 306 | // Serialize the current state of the heap. |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 307 | void Serialize(); |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame^] | 308 | // Serialize a single object and the objects reachable from it. |
| 309 | void SerializePartial(Object** obj); |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 310 | void VisitPointers(Object** start, Object** end); |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame^] | 311 | // You can call this after serialization to find out how much space was used |
| 312 | // in each space. |
| 313 | int CurrentAllocationAddress(int space) { |
| 314 | if (SpaceIsLarge(space)) return large_object_total_; |
| 315 | return fullness_[space]; |
| 316 | } |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 317 | |
| 318 | static void Enable() { |
| 319 | if (!serialization_enabled_) { |
| 320 | ASSERT(!too_late_to_enable_now_); |
| 321 | } |
| 322 | serialization_enabled_ = true; |
| 323 | } |
| 324 | |
| 325 | static void Disable() { serialization_enabled_ = false; } |
| 326 | // Call this when you have made use of the fact that there is no serialization |
| 327 | // going on. |
| 328 | static void TooLateToEnableNow() { too_late_to_enable_now_ = true; } |
| 329 | static bool enabled() { return serialization_enabled_; } |
| 330 | #ifdef DEBUG |
| 331 | virtual void Synchronize(const char* tag); |
| 332 | #endif |
| 333 | |
| 334 | private: |
| 335 | enum ReferenceRepresentation { |
| 336 | TAGGED_REPRESENTATION, // A tagged object reference. |
| 337 | CODE_TARGET_REPRESENTATION // A reference to first instruction in target. |
| 338 | }; |
| 339 | class ObjectSerializer : public ObjectVisitor { |
| 340 | public: |
| 341 | ObjectSerializer(Serializer* serializer, |
| 342 | Object* o, |
| 343 | SnapshotByteSink* sink, |
| 344 | ReferenceRepresentation representation) |
| 345 | : serializer_(serializer), |
| 346 | object_(HeapObject::cast(o)), |
| 347 | sink_(sink), |
| 348 | reference_representation_(representation), |
| 349 | bytes_processed_so_far_(0) { } |
| 350 | void Serialize(); |
| 351 | void VisitPointers(Object** start, Object** end); |
| 352 | void VisitExternalReferences(Address* start, Address* end); |
| 353 | void VisitCodeTarget(RelocInfo* target); |
| 354 | void VisitRuntimeEntry(RelocInfo* reloc); |
| 355 | // Used for seralizing the external strings that hold the natives source. |
| 356 | void VisitExternalAsciiString( |
| 357 | v8::String::ExternalAsciiStringResource** resource); |
| 358 | // We can't serialize a heap with external two byte strings. |
| 359 | void VisitExternalTwoByteString( |
| 360 | v8::String::ExternalStringResource** resource) { |
| 361 | UNREACHABLE(); |
| 362 | } |
| 363 | |
| 364 | private: |
| 365 | void OutputRawData(Address up_to); |
| 366 | |
| 367 | Serializer* serializer_; |
| 368 | HeapObject* object_; |
| 369 | SnapshotByteSink* sink_; |
| 370 | ReferenceRepresentation reference_representation_; |
| 371 | int bytes_processed_so_far_; |
| 372 | }; |
| 373 | |
| 374 | void SerializeObject(Object* o, ReferenceRepresentation representation); |
| 375 | void InitializeAllocators(); |
| 376 | // This will return the space for an object. If the object is in large |
| 377 | // object space it may return kLargeCode or kLargeFixedArray in order |
| 378 | // to indicate to the deserializer what kind of large object allocation |
| 379 | // to make. |
| 380 | static int SpaceOfObject(HeapObject* object); |
| 381 | // This just returns the space of the object. It will return LO_SPACE |
| 382 | // for all large objects since you can't check the type of the object |
| 383 | // once the map has been used for the serialization address. |
| 384 | static int SpaceOfAlreadySerializedObject(HeapObject* object); |
| 385 | int Allocate(int space, int size, bool* new_page_started); |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 386 | int EncodeExternalReference(Address addr) { |
| 387 | return external_reference_encoder_->Encode(addr); |
| 388 | } |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame^] | 389 | int RootIndex(HeapObject* heap_object); |
| 390 | static const int kInvalidRootIndex = -1; |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 391 | |
| 392 | // Keep track of the fullness of each space in order to generate |
| 393 | // relative addresses for back references. Large objects are |
| 394 | // just numbered sequentially since relative addresses make no |
| 395 | // sense in large object space. |
| 396 | int fullness_[LAST_SPACE + 1]; |
| 397 | SnapshotByteSink* sink_; |
| 398 | int current_root_index_; |
| 399 | ExternalReferenceEncoder* external_reference_encoder_; |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame^] | 400 | bool partial_; |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 401 | static bool serialization_enabled_; |
| 402 | // Did we already make use of the fact that serialization was not enabled? |
| 403 | static bool too_late_to_enable_now_; |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame^] | 404 | int large_object_total_; |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 405 | |
| 406 | friend class ObjectSerializer; |
| 407 | friend class Deserializer; |
| 408 | |
| 409 | DISALLOW_COPY_AND_ASSIGN(Serializer); |
| 410 | }; |
| 411 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 412 | } } // namespace v8::internal |
| 413 | |
| 414 | #endif // V8_SERIALIZE_H_ |