Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: third_party/WebKit/Source/platform/heap/PersistentNode.cpp

Issue 2415363002: Unpoison CrossThreadPersistents (Closed)
Patch Set: fix Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 DCHECK_EQ(persistentCount, m_persistentCount);
121 } 121 }
122 122
123 bool CrossThreadPersistentRegion::shouldTracePersistentNode( 123 bool CrossThreadPersistentRegion::shouldTracePersistentNode(
124 Visitor* visitor, 124 Visitor* visitor,
125 PersistentNode* node) { 125 PersistentNode* node) {
126 CrossThreadPersistent<DummyGCBase>* persistent = 126 CrossThreadPersistent<DummyGCBase>* persistent =
127 reinterpret_cast<CrossThreadPersistent<DummyGCBase>*>(node->self()); 127 reinterpret_cast<CrossThreadPersistent<DummyGCBase>*>(node->self());
128 DCHECK(persistent); 128 DCHECK(persistent);
129 DCHECK(!persistent->isHashTableDeletedValue()); 129 DCHECK(!persistent->isHashTableDeletedValue());
130 Address rawObject = reinterpret_cast<Address>(persistent->get()); 130 Address rawObject = reinterpret_cast<Address>(persistent->get());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 continue; 166 continue;
167 if (page->arena()->getThreadState() == threadState) { 167 if (page->arena()->getThreadState() == threadState) {
168 persistent->clear(); 168 persistent->clear();
169 ASSERT(slots->m_slot[i].isUnused()); 169 ASSERT(slots->m_slot[i].isUnused());
170 } 170 }
171 } 171 }
172 slots = slots->m_next; 172 slots = slots->m_next;
173 } 173 }
174 } 174 }
175 175
176 #if defined(ADDRESS_SANITIZER)
177 void CrossThreadPersistentRegion::unpoisonCrossThreadPersistents() {
178 MutexLocker lock(m_mutex);
179 int persistentCount = 0;
180 for (PersistentNodeSlots* slots = m_persistentRegion->m_slots; slots;
181 slots = slots->m_next) {
182 for (int i = 0; i < PersistentNodeSlots::slotCount; ++i) {
haraken 2016/10/17 07:32:40 Maybe can you simply unpoison m_slot[0 : slotCount
keishi 2016/10/17 07:43:00 We are unpoisoning the persistents, not the persis
haraken 2016/10/17 07:49:04 Ah, thanks, makes sense.
183 const PersistentNode& node = slots->m_slot[i];
184 if (!node.isUnused()) {
185 ASAN_UNPOISON_MEMORY_REGION(node.self(),
186 sizeof(CrossThreadPersistent<void*>));
187 ++persistentCount;
188 }
189 }
190 }
191 DCHECK_EQ(persistentCount, m_persistentRegion->m_persistentCount);
192 }
193 #endif
194
176 } // namespace blink 195 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698