OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TraceTraits_h | 5 #ifndef TraceTraits_h |
6 #define TraceTraits_h | 6 #define TraceTraits_h |
7 | 7 |
8 #include "platform/heap/GCInfo.h" | 8 #include "platform/heap/GCInfo.h" |
9 #include "platform/heap/Heap.h" | 9 #include "platform/heap/Heap.h" |
10 #include "platform/heap/InlinedGlobalMarkingVisitor.h" | 10 #include "platform/heap/InlinedGlobalMarkingVisitor.h" |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 // This is fine because the fact that the object can be initialized | 463 // This is fine because the fact that the object can be initialized |
464 // with memset indicates that it is safe to treat the zerod slot | 464 // with memset indicates that it is safe to treat the zerod slot |
465 // as a valid object. | 465 // as a valid object. |
466 static_assert(!IsTraceableInCollectionTrait<Traits>::value || | 466 static_assert(!IsTraceableInCollectionTrait<Traits>::value || |
467 Traits::canClearUnusedSlotsWithMemset || | 467 Traits::canClearUnusedSlotsWithMemset || |
468 std::is_polymorphic<T>::value, | 468 std::is_polymorphic<T>::value, |
469 "HeapVectorBacking doesn't support objects that cannot be " | 469 "HeapVectorBacking doesn't support objects that cannot be " |
470 "cleared as unused with memset."); | 470 "cleared as unused with memset."); |
471 | 471 |
472 // This trace method is instantiated for vectors where | 472 // This trace method is instantiated for vectors where |
473 // IsTraceableInCollectionTrait<Traits>::value is false, but the trace metho
d | 473 // IsTraceableInCollectionTrait<Traits>::value is false, but the trace |
474 // should not be called. Thus we cannot static-assert | 474 // method should not be called. Thus we cannot static-assert |
475 // IsTraceableInCollectionTrait<Traits>::value but should runtime-assert it. | 475 // IsTraceableInCollectionTrait<Traits>::value but should runtime-assert it. |
476 DCHECK(IsTraceableInCollectionTrait<Traits>::value); | 476 DCHECK(IsTraceableInCollectionTrait<Traits>::value); |
477 | 477 |
478 T* array = reinterpret_cast<T*>(self); | 478 T* array = reinterpret_cast<T*>(self); |
479 blink::HeapObjectHeader* header = | 479 blink::HeapObjectHeader* header = |
480 blink::HeapObjectHeader::fromPayload(self); | 480 blink::HeapObjectHeader::fromPayload(self); |
481 ASSERT(header->checkHeader()); | 481 ASSERT(header->checkHeader()); |
482 // Use the payload size as recorded by the heap to determine how many | 482 // Use the payload size as recorded by the heap to determine how many |
483 // elements to trace. | 483 // elements to trace. |
484 size_t length = header->payloadSize() / sizeof(T); | 484 size_t length = header->payloadSize() / sizeof(T); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 // since iterating over the hash table backing will find the whole | 748 // since iterating over the hash table backing will find the whole |
749 // chain. | 749 // chain. |
750 visitor->markNoTracing(node); | 750 visitor->markNoTracing(node); |
751 return false; | 751 return false; |
752 } | 752 } |
753 }; | 753 }; |
754 | 754 |
755 } // namespace WTF | 755 } // namespace WTF |
756 | 756 |
757 #endif | 757 #endif |
OLD | NEW |