OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 // that piggy-back on marking can use the parity to ensure that they only | 298 // that piggy-back on marking can use the parity to ensure that they only |
299 // perform an operation on an object once per marking phase: they record the | 299 // perform an operation on an object once per marking phase: they record the |
300 // MarkingParity when they visit an object, and only re-visit the object when it | 300 // MarkingParity when they visit an object, and only re-visit the object when it |
301 // is marked again and the MarkingParity changes. | 301 // is marked again and the MarkingParity changes. |
302 enum MarkingParity { | 302 enum MarkingParity { |
303 NO_MARKING_PARITY, | 303 NO_MARKING_PARITY, |
304 ODD_MARKING_PARITY, | 304 ODD_MARKING_PARITY, |
305 EVEN_MARKING_PARITY | 305 EVEN_MARKING_PARITY |
306 }; | 306 }; |
307 | 307 |
308 | |
308 // ICs store extra state in a Code object. The default extra state is | 309 // ICs store extra state in a Code object. The default extra state is |
309 // kNoExtraICState. | 310 // kNoExtraICState. |
310 typedef int ExtraICState; | 311 typedef int ExtraICState; |
311 static const ExtraICState kNoExtraICState = 0; | 312 static const ExtraICState kNoExtraICState = 0; |
312 | 313 |
313 // Instance size sentinel for objects of variable size. | 314 // Instance size sentinel for objects of variable size. |
314 const int kVariableSizeSentinel = 0; | 315 const int kVariableSizeSentinel = 0; |
315 | 316 |
316 const int kStubMajorKeyBits = 7; | 317 const int kStubMajorKeyBits = 7; |
317 const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; | 318 const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; |
(...skipping 10360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10678 enum SyncTag { | 10679 enum SyncTag { |
10679 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_ENUM) | 10680 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_ENUM) |
10680 kNumberOfSyncTags | 10681 kNumberOfSyncTags |
10681 }; | 10682 }; |
10682 #undef DECLARE_ENUM | 10683 #undef DECLARE_ENUM |
10683 | 10684 |
10684 static const char* const kTags[kNumberOfSyncTags]; | 10685 static const char* const kTags[kNumberOfSyncTags]; |
10685 static const char* const kTagNames[kNumberOfSyncTags]; | 10686 static const char* const kTagNames[kNumberOfSyncTags]; |
10686 }; | 10687 }; |
10687 | 10688 |
10689 | |
10690 enum WeakPointerMode { | |
Michael Starzinger
2014/03/04 12:31:12
As discussed offline: I am not a particular fan of
ulan
2014/03/06 11:13:32
Done. Thanks for suggestion, it is cleaner indeed.
| |
10691 VISIT_WEAK_POINTERS, | |
10692 SKIP_WEAK_POINTERS | |
10693 }; | |
10694 | |
10695 | |
10688 // Abstract base class for visiting, and optionally modifying, the | 10696 // Abstract base class for visiting, and optionally modifying, the |
10689 // pointers contained in Objects. Used in GC and serialization/deserialization. | 10697 // pointers contained in Objects. Used in GC and serialization/deserialization. |
10690 class ObjectVisitor BASE_EMBEDDED { | 10698 class ObjectVisitor BASE_EMBEDDED { |
10691 public: | 10699 public: |
10692 virtual ~ObjectVisitor() {} | 10700 virtual ~ObjectVisitor() {} |
10693 | 10701 |
10694 // Visits a contiguous arrays of pointers in the half-open range | 10702 // Visits a contiguous arrays of pointers in the half-open range |
10695 // [start, end). Any or all of the values may be modified on return. | 10703 // [start, end). Any or all of the values may be modified on return. |
10696 virtual void VisitPointers(Object** start, Object** end) = 0; | 10704 virtual void VisitPointers(Object** start, Object** end) = 0; |
10697 | 10705 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10735 // Visits an external reference. The value may be modified on return. | 10743 // Visits an external reference. The value may be modified on return. |
10736 virtual void VisitExternalReference(Address* p) {} | 10744 virtual void VisitExternalReference(Address* p) {} |
10737 | 10745 |
10738 // Visits a handle that has an embedder-assigned class ID. | 10746 // Visits a handle that has an embedder-assigned class ID. |
10739 virtual void VisitEmbedderReference(Object** p, uint16_t class_id) {} | 10747 virtual void VisitEmbedderReference(Object** p, uint16_t class_id) {} |
10740 | 10748 |
10741 // Intended for serialization/deserialization checking: insert, or | 10749 // Intended for serialization/deserialization checking: insert, or |
10742 // check for the presence of, a tag at this position in the stream. | 10750 // check for the presence of, a tag at this position in the stream. |
10743 // Also used for marking up GC roots in heap snapshots. | 10751 // Also used for marking up GC roots in heap snapshots. |
10744 virtual void Synchronize(VisitorSynchronization::SyncTag tag) {} | 10752 virtual void Synchronize(VisitorSynchronization::SyncTag tag) {} |
10753 | |
10754 virtual WeakPointerMode weak_pointer_mode() { return VISIT_WEAK_POINTERS; } | |
10745 }; | 10755 }; |
10746 | 10756 |
10747 | 10757 |
10748 class StructBodyDescriptor : public | 10758 class StructBodyDescriptor : public |
10749 FlexibleBodyDescriptor<HeapObject::kHeaderSize> { | 10759 FlexibleBodyDescriptor<HeapObject::kHeaderSize> { |
10750 public: | 10760 public: |
10751 static inline int SizeOf(Map* map, HeapObject* object) { | 10761 static inline int SizeOf(Map* map, HeapObject* object) { |
10752 return map->instance_size(); | 10762 return map->instance_size(); |
10753 } | 10763 } |
10754 }; | 10764 }; |
(...skipping 21 matching lines...) Expand all Loading... | |
10776 } else { | 10786 } else { |
10777 value &= ~(1 << bit_position); | 10787 value &= ~(1 << bit_position); |
10778 } | 10788 } |
10779 return value; | 10789 return value; |
10780 } | 10790 } |
10781 }; | 10791 }; |
10782 | 10792 |
10783 } } // namespace v8::internal | 10793 } } // namespace v8::internal |
10784 | 10794 |
10785 #endif // V8_OBJECTS_H_ | 10795 #endif // V8_OBJECTS_H_ |
OLD | NEW |