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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 static inline bool isHeapObjectAlive(const WeakMember<T>& member) | 204 static inline bool isHeapObjectAlive(const WeakMember<T>& member) |
205 { | 205 { |
206 return isHeapObjectAlive(member.get()); | 206 return isHeapObjectAlive(member.get()); |
207 } | 207 } |
208 template<typename T> | 208 template<typename T> |
209 static inline bool isHeapObjectAlive(const UntracedMember<T>& member) | 209 static inline bool isHeapObjectAlive(const UntracedMember<T>& member) |
210 { | 210 { |
211 return isHeapObjectAlive(member.get()); | 211 return isHeapObjectAlive(member.get()); |
212 } | 212 } |
213 template<typename T> | 213 template<typename T> |
214 static inline bool isHeapObjectAlive(const RawPtr<T>& ptr) | 214 static inline bool isHeapObjectAlive(const T*& ptr) |
215 { | 215 { |
216 return isHeapObjectAlive(ptr.get()); | 216 return isHeapObjectAlive(ptr); |
217 } | 217 } |
218 | 218 |
219 // Is the finalizable GC object still alive, but slated for lazy sweeping? | 219 // Is the finalizable GC object still alive, but slated for lazy sweeping? |
220 // If a lazy sweep is in progress, returns true if the object was found | 220 // If a lazy sweep is in progress, returns true if the object was found |
221 // to be not reachable during the marking phase, but it has yet to be swept | 221 // to be not reachable during the marking phase, but it has yet to be swept |
222 // and finalized. The predicate returns false in all other cases. | 222 // and finalized. The predicate returns false in all other cases. |
223 // | 223 // |
224 // Holding a reference to an already-dead object is not a valid state | 224 // Holding a reference to an already-dead object is not a valid state |
225 // to be in; willObjectBeLazilySwept() has undefined behavior if passed | 225 // to be in; willObjectBeLazilySwept() has undefined behavior if passed |
226 // such a reference. | 226 // such a reference. |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) | 554 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) |
555 { | 555 { |
556 T** cell = reinterpret_cast<T**>(object); | 556 T** cell = reinterpret_cast<T**>(object); |
557 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) | 557 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) |
558 *cell = nullptr; | 558 *cell = nullptr; |
559 } | 559 } |
560 | 560 |
561 } // namespace blink | 561 } // namespace blink |
562 | 562 |
563 #endif // Heap_h | 563 #endif // Heap_h |
OLD | NEW |