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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 kPartialSnapshotCache = 0xa, // Object is in the cache. | 221 kPartialSnapshotCache = 0xa, // Object is in the cache. |
222 kExternalReference = 0xb, // Pointer to an external reference. | 222 kExternalReference = 0xb, // Pointer to an external reference. |
223 kSkip = 0xc, // Skip a pointer sized cell. | 223 kSkip = 0xc, // Skip a pointer sized cell. |
224 // 0xd-0xf Free. | 224 // 0xd-0xf Free. |
225 kBackref = 0x10, // Object is described relative to end. | 225 kBackref = 0x10, // Object is described relative to end. |
226 // 0x11-0x18 One per space. | 226 // 0x11-0x18 One per space. |
227 // 0x19-0x1f Free. | 227 // 0x19-0x1f Free. |
228 kFromStart = 0x20, // Object is described relative to start. | 228 kFromStart = 0x20, // Object is described relative to start. |
229 // 0x21-0x28 One per space. | 229 // 0x21-0x28 One per space. |
230 // 0x29-0x2f Free. | 230 // 0x29-0x2f Free. |
231 // 0x30-0x3f Used by misc tags below. | 231 // 0x30-0x3f Used by misc. tags below. |
232 kPointedToMask = 0x3f | 232 kPointedToMask = 0x3f |
233 }; | 233 }; |
234 | 234 |
235 // How to code the pointer to the object. | 235 // How to code the pointer to the object. |
236 enum HowToCode { | 236 enum HowToCode { |
237 kPlain = 0, // Straight pointer. | 237 kPlain = 0, // Straight pointer. |
238 // What this means depends on the architecture: | 238 // What this means depends on the architecture: |
239 kFromCode = 0x40, // A pointer inlined in code. | 239 kFromCode = 0x40, // A pointer inlined in code. |
240 kHowToCodeMask = 0x40 | 240 kHowToCodeMask = 0x40 |
241 }; | 241 }; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 UNREACHABLE(); | 352 UNREACHABLE(); |
353 } | 353 } |
354 | 354 |
355 virtual void VisitRuntimeEntry(RelocInfo* rinfo) { | 355 virtual void VisitRuntimeEntry(RelocInfo* rinfo) { |
356 UNREACHABLE(); | 356 UNREACHABLE(); |
357 } | 357 } |
358 | 358 |
359 // Fills in some heap data in an area from start to end (non-inclusive). The | 359 // Fills in some heap data in an area from start to end (non-inclusive). The |
360 // space id is used for the write barrier. The object_address is the address | 360 // space id is used for the write barrier. The object_address is the address |
361 // of the object we are writing into, or NULL if we are not writing into an | 361 // of the object we are writing into, or NULL if we are not writing into an |
362 // object, ie if we are writing a series of tagged values that are not on the | 362 // object, i.e. if we are writing a series of tagged values that are not on |
363 // heap. | 363 // the heap. |
364 void ReadChunk( | 364 void ReadChunk( |
365 Object** start, Object** end, int space, Address object_address); | 365 Object** start, Object** end, int space, Address object_address); |
366 HeapObject* GetAddressFromStart(int space); | 366 HeapObject* GetAddressFromStart(int space); |
367 inline HeapObject* GetAddressFromEnd(int space); | 367 inline HeapObject* GetAddressFromEnd(int space); |
368 Address Allocate(int space_number, Space* space, int size); | 368 Address Allocate(int space_number, Space* space, int size); |
369 void ReadObject(int space_number, Space* space, Object** write_back); | 369 void ReadObject(int space_number, Space* space, Object** write_back); |
370 | 370 |
371 // Cached current isolate. | 371 // Cached current isolate. |
372 Isolate* isolate_; | 372 Isolate* isolate_; |
373 | 373 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 explicit StartupSerializer(SnapshotByteSink* sink) : Serializer(sink) { | 625 explicit StartupSerializer(SnapshotByteSink* sink) : Serializer(sink) { |
626 // Clear the cache of objects used by the partial snapshot. After the | 626 // Clear the cache of objects used by the partial snapshot. After the |
627 // strong roots have been serialized we can create a partial snapshot | 627 // strong roots have been serialized we can create a partial snapshot |
628 // which will repopulate the cache with objects needed by that partial | 628 // which will repopulate the cache with objects needed by that partial |
629 // snapshot. | 629 // snapshot. |
630 Isolate::Current()->set_serialize_partial_snapshot_cache_length(0); | 630 Isolate::Current()->set_serialize_partial_snapshot_cache_length(0); |
631 } | 631 } |
632 // Serialize the current state of the heap. The order is: | 632 // Serialize the current state of the heap. The order is: |
633 // 1) Strong references. | 633 // 1) Strong references. |
634 // 2) Partial snapshot cache. | 634 // 2) Partial snapshot cache. |
635 // 3) Weak references (eg the symbol table). | 635 // 3) Weak references (e.g. the symbol table). |
636 virtual void SerializeStrongReferences(); | 636 virtual void SerializeStrongReferences(); |
637 virtual void SerializeObject(Object* o, | 637 virtual void SerializeObject(Object* o, |
638 HowToCode how_to_code, | 638 HowToCode how_to_code, |
639 WhereToPoint where_to_point); | 639 WhereToPoint where_to_point); |
640 void SerializeWeakReferences(); | 640 void SerializeWeakReferences(); |
641 void Serialize() { | 641 void Serialize() { |
642 SerializeStrongReferences(); | 642 SerializeStrongReferences(); |
643 SerializeWeakReferences(); | 643 SerializeWeakReferences(); |
644 } | 644 } |
645 | 645 |
646 private: | 646 private: |
647 virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) { | 647 virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) { |
648 return false; | 648 return false; |
649 } | 649 } |
650 }; | 650 }; |
651 | 651 |
652 | 652 |
653 } } // namespace v8::internal | 653 } } // namespace v8::internal |
654 | 654 |
655 #endif // V8_SERIALIZE_H_ | 655 #endif // V8_SERIALIZE_H_ |
OLD | NEW |