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 = LO_SPACE; | 302 static const int kNumberOfPreallocatedSpaces = LAST_PAGED_SPACE + 1; |
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(4 == kNumberOfPreallocatedSpaces); | |
309 enum Where { | 312 enum Where { |
310 // 0x00..0x05 Allocate new object, in specified space. | 313 // 0x00..0x03 Allocate new object, in specified space. |
Yang
2015/04/08 09:11:53
That's 0x04. We still have LO_SPACE.
| |
311 kNewObject = 0, | 314 kNewObject = 0, |
315 // 0x04 Unused (including 0x24, 0x44, 0x64). | |
316 // 0x05 Unused (including 0x25, 0x45, 0x65). | |
312 // 0x06 Unused (including 0x26, 0x46, 0x66). | 317 // 0x06 Unused (including 0x26, 0x46, 0x66). |
313 // 0x07 Unused (including 0x27, 0x47, 0x67). | 318 // 0x07 Unused (including 0x27, 0x47, 0x67). |
314 // 0x08..0x0d Reference to previous object from space. | 319 // 0x08..0x0b Reference to previous object from space. |
Yang
2015/04/08 09:11:53
Ditto
| |
315 kBackref = 0x08, | 320 kBackref = 0x08, |
316 // 0x0e Unused (including 0x2e, 0x4e, 0x6e). | 321 // 0x0e Unused (including 0x2e, 0x4e, 0x6e). |
317 // 0x0f Unused (including 0x2f, 0x4f, 0x6f). | 322 // 0x0f Unused (including 0x2f, 0x4f, 0x6f). |
318 // 0x10..0x15 Reference to previous object from space after skip. | 323 // 0x10..0x13 Reference to previous object from space after skip. |
Yang
2015/04/08 09:11:53
And here.
| |
319 kBackrefWithSkip = 0x10, | 324 kBackrefWithSkip = 0x10, |
320 // 0x16 Unused (including 0x36, 0x56, 0x76). | 325 // 0x16 Unused (including 0x36, 0x56, 0x76). |
321 // 0x17 Unused (including 0x37, 0x57, 0x77). | 326 // 0x17 Unused (including 0x37, 0x57, 0x77). |
322 // 0x18 Root array item. | 327 // 0x18 Root array item. |
323 kRootArray = 0x18, | 328 kRootArray = 0x18, |
324 // 0x19 Object in the partial snapshot cache. | 329 // 0x19 Object in the partial snapshot cache. |
325 kPartialSnapshotCache = 0x19, | 330 kPartialSnapshotCache = 0x19, |
326 // 0x1a External reference referenced by id. | 331 // 0x1a External reference referenced by id. |
327 kExternalReference = 0x1a, | 332 kExternalReference = 0x1a, |
328 // 0x1b Object provided in the attached list. | 333 // 0x1b Object provided in the attached list. |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
971 kNumInternalizedStringsOffset + kInt32Size; | 976 kNumInternalizedStringsOffset + kInt32Size; |
972 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; | 977 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; |
973 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; | 978 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; |
974 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; | 979 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; |
975 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; | 980 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; |
976 static const int kHeaderSize = kChecksum2Offset + kInt32Size; | 981 static const int kHeaderSize = kChecksum2Offset + kInt32Size; |
977 }; | 982 }; |
978 } } // namespace v8::internal | 983 } } // namespace v8::internal |
979 | 984 |
980 #endif // V8_SERIALIZE_H_ | 985 #endif // V8_SERIALIZE_H_ |
OLD | NEW |