Chromium Code Reviews| Index: Source/platform/heap/Heap.h |
| diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h |
| index 629efc43eba2132accc62c286262c5c21599c549..146691916d522d2c1617d5c3409f139e38d20bc6 100644 |
| --- a/Source/platform/heap/Heap.h |
| +++ b/Source/platform/heap/Heap.h |
| @@ -1922,12 +1922,7 @@ struct TraceInCollectionTrait<NoWeakHandlingInCollections, strongify, blink::Hea |
| template<typename VisitorDispatcher> |
| static bool trace(VisitorDispatcher visitor, void* self) |
| { |
| - // The allocator can oversize the allocation a little, according to |
| - // the allocation granularity. The extra size is included in the |
| - // payloadSize call below, since there is nowhere to store the |
| - // originally allocated memory. This assert ensures that visiting the |
| - // last bit of memory can't cause trouble. |
| - static_assert(!ShouldBeTraced<Traits>::value || sizeof(T) > blink::allocationGranularity || Traits::canInitializeWithMemset, "heap overallocation can cause spurious visits"); |
| + static_assert(!ShouldBeTraced<Traits>::value || Traits::canInitializeWithMemset, "HeapVector doesn't support objects that cannot be initialized with memset."); |
| T* array = reinterpret_cast<T*>(self); |
| blink::HeapObjectHeader* header = blink::HeapObjectHeader::fromPayload(self); |
| @@ -2218,6 +2213,9 @@ struct TraceTrait<HeapHashTableBacking<Table>> { |
| template<typename T, typename Traits> |
| void HeapVectorBacking<T, Traits>::finalize(void* pointer) |
| { |
| + static_assert(Traits::needsDestruction, "HeapVectors that don't require destructors should not reach here."); |
|
sof
2015/04/24 12:26:09
"Only vector buffers with items requiring destruct
|
| + static_assert(Traits::canInitializeWithMemset, "HeapVector doesn't support objects that cannot be initialized with memset."); |
| + |
| ASSERT(!WTF::IsTriviallyDestructible<T>::value); |
| HeapObjectHeader* header = HeapObjectHeader::fromPayload(pointer); |
| // Use the payload size as recorded by the heap to determine how many |