Chromium Code Reviews| Index: Source/platform/heap/Heap.h |
| diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h |
| index 6dec9e0a89de94e8247627cfcd06d3dfaa54415a..434b7b345f7c55e67e5adf759a14fdc0672b5654 100644 |
| --- a/Source/platform/heap/Heap.h |
| +++ b/Source/platform/heap/Heap.h |
| @@ -852,29 +852,29 @@ public: |
| static bool containedInHeapOrOrphanedPage(void*); |
| #endif |
| - // Is the finalizable GC object still alive? If no GC is in progress, |
| - // it must be true. If a lazy sweep is in progress, it will be true if |
| - // the object hasn't been swept yet and it is marked, or it has |
| - // been swept and it is still alive. |
| - // |
| - // isFinalizedObjectAlive() must not be used with already-finalized object |
| - // references. |
| + // Is the finalizable GC object still alive, but slated for lazy sweeping? |
| + // If a lazy sweep is in progress, returns true if the object was found |
| + // to be not reachable during the marking phase, but it has yet to be swept |
| + // and finalized. The predicate returns false in all other cases. |
| // |
| + // Holding a reference to an already-dead object is not a valid state |
| + // to be in; willObjectBeLazilySwept() has undefined behavior if passed |
|
haraken
2015/01/22 09:29:29
Can we assert this by checking header->checkHeader
sof
2015/01/22 09:56:23
That would be helpful, added.
|
| + // such a reference. |
| template<typename T> |
| - static bool isFinalizedObjectAlive(const T* objectPointer) |
| + static bool willObjectBeLazilySwept(const T* objectPointer) |
| { |
| static_assert(IsGarbageCollectedType<T>::value, "only objects deriving from GarbageCollected can be used."); |
| #if ENABLE(OILPAN) |
| BaseHeapPage* page = pageFromObject(objectPointer); |
| if (page->hasBeenSwept()) |
| - return true; |
| + return false; |
| ASSERT(page->heap()->threadState()->isSweepingInProgress()); |
| - return ObjectAliveTrait<T>::isHeapObjectAlive(s_markingVisitor, const_cast<T*>(objectPointer)); |
| + return !ObjectAliveTrait<T>::isHeapObjectAlive(s_markingVisitor, const_cast<T*>(objectPointer)); |
| #else |
| // FIXME: remove when lazy sweeping is always on |
| // (cf. ThreadState::postGCProcessing()). |
| - return true; |
| + return false; |
| #endif |
| } |