 Chromium Code Reviews
 Chromium Code Reviews Issue 1138663002:
  Oilpan: support eager finalization/sweeping.  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk
    
  
    Issue 1138663002:
  Oilpan: support eager finalization/sweeping.  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk| Index: Source/platform/heap/ThreadState.cpp | 
| diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp | 
| index 699866a4516830374b32646ac8351c86a8c97e33..b9213bd5321fe46ef6f308ec4d52ec93387a05f6 100644 | 
| --- a/Source/platform/heap/ThreadState.cpp | 
| +++ b/Source/platform/heap/ThreadState.cpp | 
| @@ -912,6 +912,7 @@ void ThreadState::preSweep() | 
| } else { | 
| // The default behavior is lazy sweeping. | 
| setGCState(Sweeping); | 
| + eagerSweep(); | 
| scheduleIdleLazySweep(); | 
| } | 
| #else | 
| @@ -926,6 +927,31 @@ void ThreadState::preSweep() | 
| #endif | 
| } | 
| +void ThreadState::eagerSweep() | 
| +{ | 
| + // Some objects need to be finalized promptly and cannot be handled | 
| + // by lazy sweeping. Keep those in a designated heap and sweep it | 
| + // eagerly. | 
| + ASSERT(isSweepingInProgress()); | 
| + ASSERT(!sweepForbidden()); | 
| 
haraken
2015/05/19 23:23:37
I think this should be:
  if (sweepForbidden())
 
sof
2015/05/20 09:43:01
Done + xref'ed the comment.
 | 
| + | 
| + ThreadState::SweepForbiddenScope scope(this); | 
| + { | 
| + if (isMainThread()) | 
| + ScriptForbiddenScope::enter(); | 
| + | 
| + TRACE_EVENT0("blink_gc", "ThreadState::eagerSweep"); | 
| + double timeStamp = WTF::currentTimeMS(); | 
| 
haraken
2015/05/19 23:23:37
Remove this (see below).
 
sof
2015/05/20 09:43:01
Removed.
 | 
| + | 
| + m_heaps[EagerSweepHeapIndex]->completeSweep(); | 
| + | 
| + Platform::current()->histogramCustomCounts("BlinkGC.EagerSweep", WTF::currentTimeMS() - timeStamp, 0, 10 * 1000, 50); | 
| 
haraken
2015/05/19 23:23:37
This UMA doesn't exist (and wouldn't be worth addi
 | 
| + | 
| + if (isMainThread()) | 
| + ScriptForbiddenScope::exit(); | 
| + } | 
| +} | 
| + | 
| void ThreadState::completeSweep() | 
| { | 
| // If we are not in a sweeping phase, there is nothing to do here. |