| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_SERIALIZE_H_ | 5 #ifndef V8_SERIALIZE_H_ |
| 6 #define V8_SERIALIZE_H_ | 6 #define V8_SERIALIZE_H_ |
| 7 | 7 |
| 8 #include "src/hashmap.h" | 8 #include "src/hashmap.h" |
| 9 #include "src/heap-profiler.h" | 9 #include "src/heap-profiler.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // The Serializer/Deserializer class is a common superclass for Serializer and | 292 // The Serializer/Deserializer class is a common superclass for Serializer and |
| 293 // Deserializer which is used to store common constants and methods used by | 293 // Deserializer which is used to store common constants and methods used by |
| 294 // both. | 294 // both. |
| 295 class SerializerDeserializer: public ObjectVisitor { | 295 class SerializerDeserializer: public ObjectVisitor { |
| 296 public: | 296 public: |
| 297 static void Iterate(Isolate* isolate, ObjectVisitor* visitor); | 297 static void Iterate(Isolate* isolate, ObjectVisitor* visitor); |
| 298 | 298 |
| 299 static int nop() { return kNop; } | 299 static int nop() { return kNop; } |
| 300 | 300 |
| 301 // No reservation for large object space necessary. | 301 // No reservation for large object space necessary. |
| 302 static const int kNumberOfPreallocatedSpaces = LAST_PAGED_SPACE + 1; | 302 static const int kNumberOfPreallocatedSpaces = LO_SPACE; |
| 303 static const int kNumberOfSpaces = LAST_SPACE + 1; | 303 static const int kNumberOfSpaces = LAST_SPACE + 1; |
| 304 | 304 |
| 305 protected: | 305 protected: |
| 306 // ---------- byte code range 0x00..0x7f ---------- | 306 // ---------- byte code range 0x00..0x7f ---------- |
| 307 // Byte codes in this range represent Where, HowToCode and WhereToPoint. | 307 // Byte codes in this range represent Where, HowToCode and WhereToPoint. |
| 308 // Where the pointed-to object can be found: | 308 // Where the pointed-to object can be found: |
| 309 // The static assert below will trigger when the number of preallocated spaces | |
| 310 // changed. If that happens, update the bytecode ranges in the comments below. | |
| 311 STATIC_ASSERT(5 == kNumberOfSpaces); | |
| 312 enum Where { | 309 enum Where { |
| 313 // 0x00..0x04 Allocate new object, in specified space. | 310 // 0x00..0x05 Allocate new object, in specified space. |
| 314 kNewObject = 0, | 311 kNewObject = 0, |
| 315 // 0x05 Unused (including 0x25, 0x45, 0x65). | |
| 316 // 0x06 Unused (including 0x26, 0x46, 0x66). | 312 // 0x06 Unused (including 0x26, 0x46, 0x66). |
| 317 // 0x07 Unused (including 0x27, 0x47, 0x67). | 313 // 0x07 Unused (including 0x27, 0x47, 0x67). |
| 318 // 0x08..0x0c Reference to previous object from space. | 314 // 0x08..0x0d Reference to previous object from space. |
| 319 kBackref = 0x08, | 315 kBackref = 0x08, |
| 320 // 0x0e Unused (including 0x2e, 0x4e, 0x6e). | 316 // 0x0e Unused (including 0x2e, 0x4e, 0x6e). |
| 321 // 0x0f Unused (including 0x2f, 0x4f, 0x6f). | 317 // 0x0f Unused (including 0x2f, 0x4f, 0x6f). |
| 322 // 0x10..0x14 Reference to previous object from space after skip. | 318 // 0x10..0x15 Reference to previous object from space after skip. |
| 323 kBackrefWithSkip = 0x10, | 319 kBackrefWithSkip = 0x10, |
| 324 // 0x16 Unused (including 0x36, 0x56, 0x76). | 320 // 0x16 Unused (including 0x36, 0x56, 0x76). |
| 325 // 0x17 Unused (including 0x37, 0x57, 0x77). | 321 // 0x17 Unused (including 0x37, 0x57, 0x77). |
| 326 // 0x18 Root array item. | 322 // 0x18 Root array item. |
| 327 kRootArray = 0x18, | 323 kRootArray = 0x18, |
| 328 // 0x19 Object in the partial snapshot cache. | 324 // 0x19 Object in the partial snapshot cache. |
| 329 kPartialSnapshotCache = 0x19, | 325 kPartialSnapshotCache = 0x19, |
| 330 // 0x1a External reference referenced by id. | 326 // 0x1a External reference referenced by id. |
| 331 kExternalReference = 0x1a, | 327 kExternalReference = 0x1a, |
| 332 // 0x1b Object provided in the attached list. | 328 // 0x1b Object provided in the attached list. |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 kNumInternalizedStringsOffset + kInt32Size; | 971 kNumInternalizedStringsOffset + kInt32Size; |
| 976 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; | 972 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; |
| 977 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; | 973 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; |
| 978 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; | 974 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; |
| 979 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; | 975 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; |
| 980 static const int kHeaderSize = kChecksum2Offset + kInt32Size; | 976 static const int kHeaderSize = kChecksum2Offset + kInt32Size; |
| 981 }; | 977 }; |
| 982 } } // namespace v8::internal | 978 } } // namespace v8::internal |
| 983 | 979 |
| 984 #endif // V8_SERIALIZE_H_ | 980 #endif // V8_SERIALIZE_H_ |
| OLD | NEW |