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

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

Issue 2471023004: Lock CrossThreadPersistentRegion while poisoning HeapPages (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 // Eager sweeping should happen only in testing. 1130 // Eager sweeping should happen only in testing.
1131 completeSweep(); 1131 completeSweep();
1132 } else { 1132 } else {
1133 // The default behavior is lazy sweeping. 1133 // The default behavior is lazy sweeping.
1134 scheduleIdleLazySweep(); 1134 scheduleIdleLazySweep();
1135 } 1135 }
1136 } 1136 }
1137 1137
1138 #if defined(ADDRESS_SANITIZER) 1138 #if defined(ADDRESS_SANITIZER)
1139 void ThreadState::poisonAllHeaps() { 1139 void ThreadState::poisonAllHeaps() {
1140 CrossThreadPersistentRegion::LockScope persistentLock(
1141 ProcessHeap::crossThreadPersistentRegion());
1140 // Poisoning all unmarked objects in the other arenas. 1142 // Poisoning all unmarked objects in the other arenas.
1141 for (int i = 1; i < BlinkGC::NumberOfArenas; i++) 1143 for (int i = 1; i < BlinkGC::NumberOfArenas; i++)
1142 m_arenas[i]->poisonArena(); 1144 m_arenas[i]->poisonArena();
1143 // CrossThreadPersistents in unmarked objects may be accessed from other 1145 // CrossThreadPersistents in unmarked objects may be accessed from other
1144 // threads (e.g. in CrossThreadPersistentRegion::shouldTracePersistent) and 1146 // threads (e.g. in CrossThreadPersistentRegion::shouldTracePersistent) and
1145 // that would be fine. 1147 // that would be fine.
1146 ProcessHeap::crossThreadPersistentRegion().unpoisonCrossThreadPersistents(); 1148 ProcessHeap::crossThreadPersistentRegion().unpoisonCrossThreadPersistents();
1147 } 1149 }
1148 1150
1149 void ThreadState::poisonEagerArena() { 1151 void ThreadState::poisonEagerArena() {
1152 CrossThreadPersistentRegion::LockScope persistentLock(
1153 ProcessHeap::crossThreadPersistentRegion());
1150 m_arenas[BlinkGC::EagerSweepArenaIndex]->poisonArena(); 1154 m_arenas[BlinkGC::EagerSweepArenaIndex]->poisonArena();
1151 // CrossThreadPersistents in unmarked objects may be accessed from other 1155 // CrossThreadPersistents in unmarked objects may be accessed from other
1152 // threads (e.g. in CrossThreadPersistentRegion::shouldTracePersistent) and 1156 // threads (e.g. in CrossThreadPersistentRegion::shouldTracePersistent) and
1153 // that would be fine. 1157 // that would be fine.
1154 ProcessHeap::crossThreadPersistentRegion().unpoisonCrossThreadPersistents(); 1158 ProcessHeap::crossThreadPersistentRegion().unpoisonCrossThreadPersistents();
1155 } 1159 }
1156 #endif 1160 #endif
1157 1161
1158 void ThreadState::eagerSweep() { 1162 void ThreadState::eagerSweep() {
1159 #if defined(ADDRESS_SANITIZER) 1163 #if defined(ADDRESS_SANITIZER)
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, 1825 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep,
1822 BlinkGC::ForcedGC); 1826 BlinkGC::ForcedGC);
1823 size_t liveObjects = heap().heapStats().markedObjectSize(); 1827 size_t liveObjects = heap().heapStats().markedObjectSize();
1824 if (liveObjects == previousLiveObjects) 1828 if (liveObjects == previousLiveObjects)
1825 break; 1829 break;
1826 previousLiveObjects = liveObjects; 1830 previousLiveObjects = liveObjects;
1827 } 1831 }
1828 } 1832 }
1829 1833
1830 } // namespace blink 1834 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698