| 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 #include "platform/heap/PersistentNode.h" | 5 #include "platform/heap/PersistentNode.h" |
| 6 | 6 |
| 7 #include "platform/heap/Handle.h" | 7 #include "platform/heap/Handle.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if (freeListLast) { | 110 if (freeListLast) { |
| 111 ASSERT(freeListNext); | 111 ASSERT(freeListNext); |
| 112 ASSERT(!freeListLast->freeListNext()); | 112 ASSERT(!freeListLast->freeListNext()); |
| 113 freeListLast->setFreeListNext(m_freeListHead); | 113 freeListLast->setFreeListNext(m_freeListHead); |
| 114 m_freeListHead = freeListNext; | 114 m_freeListHead = freeListNext; |
| 115 } | 115 } |
| 116 prevNext = &slots->m_next; | 116 prevNext = &slots->m_next; |
| 117 slots = slots->m_next; | 117 slots = slots->m_next; |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 ASSERT(persistentCount == m_persistentCount); | 120 #if DCHECK_IS_ON() |
| 121 DCHECK_EQ(persistentCount, m_persistentCount); |
| 122 #endif |
| 121 } | 123 } |
| 122 | 124 |
| 123 bool CrossThreadPersistentRegion::shouldTracePersistentNode( | 125 bool CrossThreadPersistentRegion::shouldTracePersistentNode( |
| 124 Visitor* visitor, | 126 Visitor* visitor, |
| 125 PersistentNode* node) { | 127 PersistentNode* node) { |
| 126 CrossThreadPersistent<DummyGCBase>* persistent = | 128 CrossThreadPersistent<DummyGCBase>* persistent = |
| 127 reinterpret_cast<CrossThreadPersistent<DummyGCBase>*>(node->self()); | 129 reinterpret_cast<CrossThreadPersistent<DummyGCBase>*>(node->self()); |
| 128 DCHECK(persistent); | 130 DCHECK(persistent); |
| 129 DCHECK(!persistent->isHashTableDeletedValue()); | 131 DCHECK(!persistent->isHashTableDeletedValue()); |
| 130 Address rawObject = reinterpret_cast<Address>(persistent->get()); | 132 Address rawObject = reinterpret_cast<Address>(persistent->get()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 continue; | 168 continue; |
| 167 if (page->arena()->getThreadState() == threadState) { | 169 if (page->arena()->getThreadState() == threadState) { |
| 168 persistent->clear(); | 170 persistent->clear(); |
| 169 ASSERT(slots->m_slot[i].isUnused()); | 171 ASSERT(slots->m_slot[i].isUnused()); |
| 170 } | 172 } |
| 171 } | 173 } |
| 172 slots = slots->m_next; | 174 slots = slots->m_next; |
| 173 } | 175 } |
| 174 } | 176 } |
| 175 | 177 |
| 178 #if defined(ADDRESS_SANITIZER) |
| 179 void CrossThreadPersistentRegion::unpoisonCrossThreadPersistents() { |
| 180 MutexLocker lock(m_mutex); |
| 181 int persistentCount = 0; |
| 182 for (PersistentNodeSlots* slots = m_persistentRegion->m_slots; slots; |
| 183 slots = slots->m_next) { |
| 184 for (int i = 0; i < PersistentNodeSlots::slotCount; ++i) { |
| 185 const PersistentNode& node = slots->m_slot[i]; |
| 186 if (!node.isUnused()) { |
| 187 ASAN_UNPOISON_MEMORY_REGION(node.self(), |
| 188 sizeof(CrossThreadPersistent<void*>)); |
| 189 ++persistentCount; |
| 190 } |
| 191 } |
| 192 } |
| 193 #if DCHECK_IS_ON() |
| 194 DCHECK_EQ(persistentCount, m_persistentRegion->m_persistentCount); |
| 195 #endif |
| 196 } |
| 197 #endif |
| 198 |
| 176 } // namespace blink | 199 } // namespace blink |
| OLD | NEW |