| 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());
|
| +
|
| + ThreadState::SweepForbiddenScope scope(this);
|
| + {
|
| + if (isMainThread())
|
| + ScriptForbiddenScope::enter();
|
| +
|
| + TRACE_EVENT0("blink_gc", "ThreadState::eagerSweep");
|
| + double timeStamp = WTF::currentTimeMS();
|
| +
|
| + m_heaps[EagerSweepHeapIndex]->completeSweep();
|
| +
|
| + Platform::current()->histogramCustomCounts("BlinkGC.EagerSweep", WTF::currentTimeMS() - timeStamp, 0, 10 * 1000, 50);
|
| +
|
| + if (isMainThread())
|
| + ScriptForbiddenScope::exit();
|
| + }
|
| +}
|
| +
|
| void ThreadState::completeSweep()
|
| {
|
| // If we are not in a sweeping phase, there is nothing to do here.
|
|
|