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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 // to be not reachable during the marking phase, but it has yet to be swept | 857 // to be not reachable during the marking phase, but it has yet to be swept |
858 // and finalized. The predicate returns false in all other cases. | 858 // and finalized. The predicate returns false in all other cases. |
859 // | 859 // |
860 // Holding a reference to an already-dead object is not a valid state | 860 // Holding a reference to an already-dead object is not a valid state |
861 // to be in; willObjectBeLazilySwept() has undefined behavior if passed | 861 // to be in; willObjectBeLazilySwept() has undefined behavior if passed |
862 // such a reference. | 862 // such a reference. |
863 template<typename T> | 863 template<typename T> |
864 static bool willObjectBeLazilySwept(const T* objectPointer) | 864 static bool willObjectBeLazilySwept(const T* objectPointer) |
865 { | 865 { |
866 static_assert(IsGarbageCollectedType<T>::value, "only objects deriving f
rom GarbageCollected can be used."); | 866 static_assert(IsGarbageCollectedType<T>::value, "only objects deriving f
rom GarbageCollected can be used."); |
867 #if ENABLE(ASSERT) | |
868 ASSERT(objectPointer); | |
869 HeapObjectHeader::fromPayload(objectPointer)->checkHeader(); | |
870 #endif | |
871 #if ENABLE(OILPAN) | 867 #if ENABLE(OILPAN) |
872 BaseHeapPage* page = pageFromObject(objectPointer); | 868 BaseHeapPage* page = pageFromObject(objectPointer); |
873 if (page->hasBeenSwept()) | 869 if (page->hasBeenSwept()) |
874 return false; | 870 return false; |
875 ASSERT(page->heap()->threadState()->isSweepingInProgress()); | 871 ASSERT(page->heap()->threadState()->isSweepingInProgress()); |
876 | 872 |
877 return !ObjectAliveTrait<T>::isHeapObjectAlive(s_markingVisitor, const_c
ast<T*>(objectPointer)); | 873 return !ObjectAliveTrait<T>::isHeapObjectAlive(s_markingVisitor, const_c
ast<T*>(objectPointer)); |
878 #else | 874 #else |
879 // FIXME: remove when lazy sweeping is always on | 875 // FIXME: remove when lazy sweeping is always on |
880 // (cf. ThreadState::postGCProcessing()). | 876 // (cf. ThreadState::postGCProcessing()). |
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 template<typename T, size_t inlineCapacity> | 2428 template<typename T, size_t inlineCapacity> |
2433 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T,
inlineCapacity, HeapAllocator>> { }; | 2429 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T,
inlineCapacity, HeapAllocator>> { }; |
2434 template<typename T, size_t inlineCapacity> | 2430 template<typename T, size_t inlineCapacity> |
2435 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i
nlineCapacity, HeapAllocator>> { }; | 2431 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i
nlineCapacity, HeapAllocator>> { }; |
2436 template<typename T, typename U, typename V> | 2432 template<typename T, typename U, typename V> |
2437 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted
Set<T, U, V, HeapAllocator>> { }; | 2433 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted
Set<T, U, V, HeapAllocator>> { }; |
2438 | 2434 |
2439 } // namespace blink | 2435 } // namespace blink |
2440 | 2436 |
2441 #endif // Heap_h | 2437 #endif // Heap_h |
OLD | NEW |