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

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

Issue 1265103003: Invalidate cross-thread persistents on heap termination. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: clarify comments + style tweaks Created 5 years, 4 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 | Annotate | Revision Log
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Finish sweeping. 234 // Finish sweeping.
235 completeSweep(); 235 completeSweep();
236 236
237 // From here on ignore all conservatively discovered 237 // From here on ignore all conservatively discovered
238 // pointers into the heap owned by this thread. 238 // pointers into the heap owned by this thread.
239 m_isTerminating = true; 239 m_isTerminating = true;
240 240
241 // Set the terminate flag on all heap pages of this thread. This is used to 241 // Set the terminate flag on all heap pages of this thread. This is used to
242 // ensure we don't trace pages on other threads that are not part of the 242 // ensure we don't trace pages on other threads that are not part of the
243 // thread local GC. 243 // thread local GC.
244 prepareHeapForTermination(); 244 prepareHeapForTermination();
haraken 2015/08/03 00:45:25 Nit: I'd rename this to prepareForThreadStateTermi
sof 2015/08/03 08:30:04 Done.
245 245
246 ThreadState::crossThreadPersistentRegion().prepareForThreadStateTerminat ion(this);
247
246 // Do thread local GC's as long as the count of thread local Persistents 248 // Do thread local GC's as long as the count of thread local Persistents
247 // changes and is above zero. 249 // changes and is above zero.
248 int oldCount = -1; 250 int oldCount = -1;
249 int currentCount = persistentRegion()->numberOfPersistents(); 251 int currentCount = persistentRegion()->numberOfPersistents();
250 ASSERT(currentCount >= 0); 252 ASSERT(currentCount >= 0);
251 while (currentCount != oldCount) { 253 while (currentCount != oldCount) {
252 Heap::collectGarbageForTerminatingThread(this); 254 Heap::collectGarbageForTerminatingThread(this);
253 oldCount = currentCount; 255 oldCount = currentCount;
254 currentCount = persistentRegion()->numberOfPersistents(); 256 currentCount = persistentRegion()->numberOfPersistents();
255 } 257 }
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 json->beginArray(it->key.ascii().data()); 1531 json->beginArray(it->key.ascii().data());
1530 for (size_t age = 0; age <= maxHeapObjectAge; ++age) 1532 for (size_t age = 0; age <= maxHeapObjectAge; ++age)
1531 json->pushInteger(it->value.ages[age]); 1533 json->pushInteger(it->value.ages[age]);
1532 json->endArray(); 1534 json->endArray();
1533 } 1535 }
1534 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release()); 1536 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release());
1535 } 1537 }
1536 #endif 1538 #endif
1537 1539
1538 } // namespace blink 1540 } // namespace blink
OLDNEW
« Source/platform/heap/PersistentNode.cpp ('K') | « Source/platform/heap/PersistentNode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698