OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "platform/heap/HeapPage.h" | 36 #include "platform/heap/HeapPage.h" |
37 #include "platform/heap/ThreadState.h" | 37 #include "platform/heap/ThreadState.h" |
38 #include "platform/heap/Visitor.h" | 38 #include "platform/heap/Visitor.h" |
39 #include "wtf/AddressSanitizer.h" | 39 #include "wtf/AddressSanitizer.h" |
40 #include "wtf/Assertions.h" | 40 #include "wtf/Assertions.h" |
41 #include "wtf/Atomics.h" | 41 #include "wtf/Atomics.h" |
42 #include "wtf/Forward.h" | 42 #include "wtf/Forward.h" |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
| 46 template<typename T> class Member; |
| 47 template<typename T> class WeakMember; |
| 48 template<typename T> class UntracedMember; |
| 49 |
46 template<typename T, bool = NeedsAdjustAndMark<T>::value> class ObjectAliveTrait
; | 50 template<typename T, bool = NeedsAdjustAndMark<T>::value> class ObjectAliveTrait
; |
47 | 51 |
48 template<typename T> | 52 template<typename T> |
49 class ObjectAliveTrait<T, false> { | 53 class ObjectAliveTrait<T, false> { |
50 public: | 54 public: |
51 static bool isHeapObjectAlive(T* object) | 55 static bool isHeapObjectAlive(T* object) |
52 { | 56 { |
53 static_assert(sizeof(T), "T must be fully defined"); | 57 static_assert(sizeof(T), "T must be fully defined"); |
54 return HeapObjectHeader::fromPayload(object)->isMarked(); | 58 return HeapObjectHeader::fromPayload(object)->isMarked(); |
55 } | 59 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 static inline bool isHeapObjectAlive(const Member<T>& member) | 97 static inline bool isHeapObjectAlive(const Member<T>& member) |
94 { | 98 { |
95 return isHeapObjectAlive(member.get()); | 99 return isHeapObjectAlive(member.get()); |
96 } | 100 } |
97 template<typename T> | 101 template<typename T> |
98 static inline bool isHeapObjectAlive(const WeakMember<T>& member) | 102 static inline bool isHeapObjectAlive(const WeakMember<T>& member) |
99 { | 103 { |
100 return isHeapObjectAlive(member.get()); | 104 return isHeapObjectAlive(member.get()); |
101 } | 105 } |
102 template<typename T> | 106 template<typename T> |
| 107 static inline bool isHeapObjectAlive(const UntracedMember<T>& member) |
| 108 { |
| 109 return isHeapObjectAlive(member.get()); |
| 110 } |
| 111 template<typename T> |
103 static inline bool isHeapObjectAlive(const RawPtr<T>& ptr) | 112 static inline bool isHeapObjectAlive(const RawPtr<T>& ptr) |
104 { | 113 { |
105 return isHeapObjectAlive(ptr.get()); | 114 return isHeapObjectAlive(ptr.get()); |
106 } | 115 } |
107 | 116 |
108 // Is the finalizable GC object still alive, but slated for lazy sweeping? | 117 // Is the finalizable GC object still alive, but slated for lazy sweeping? |
109 // If a lazy sweep is in progress, returns true if the object was found | 118 // If a lazy sweep is in progress, returns true if the object was found |
110 // to be not reachable during the marking phase, but it has yet to be swept | 119 // to be not reachable during the marking phase, but it has yet to be swept |
111 // and finalized. The predicate returns false in all other cases. | 120 // and finalized. The predicate returns false in all other cases. |
112 // | 121 // |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) | 517 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) |
509 { | 518 { |
510 T** cell = reinterpret_cast<T**>(object); | 519 T** cell = reinterpret_cast<T**>(object); |
511 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) | 520 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) |
512 *cell = nullptr; | 521 *cell = nullptr; |
513 } | 522 } |
514 | 523 |
515 } // namespace blink | 524 } // namespace blink |
516 | 525 |
517 #endif // Heap_h | 526 #endif // Heap_h |
OLD | NEW |