| Index: third_party/WebKit/Source/platform/heap/ThreadState.cpp
|
| diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
|
| index c7a798884f0095e4f71af5433040b9c8a543db31..241f999170d704b6acff939046b86e515cf0138e 100644
|
| --- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp
|
| +++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
|
| @@ -76,6 +76,8 @@ uintptr_t ThreadState::s_mainThreadStackStart = 0;
|
| uintptr_t ThreadState::s_mainThreadUnderestimatedStackSize = 0;
|
| uint8_t ThreadState::s_mainThreadStateStorage[sizeof(ThreadState)];
|
|
|
| +const size_t defaultAllocatedObjectSizeThreshold = 100 * 1024;
|
| +
|
| ThreadState::ThreadState(bool perThreadHeapEnabled)
|
| : m_thread(currentThread())
|
| , m_persistentRegion(wrapUnique(new PersistentRegion()))
|
| @@ -501,10 +503,10 @@ double ThreadState::partitionAllocGrowingRate()
|
|
|
| // TODO(haraken): We should improve the GC heuristics. The heuristics affect
|
| // performance significantly.
|
| -bool ThreadState::judgeGCThreshold(size_t totalMemorySizeThreshold, double heapGrowingRateThreshold)
|
| +bool ThreadState::judgeGCThreshold(size_t allocatedObjectSizeThreshold, size_t totalMemorySizeThreshold, double heapGrowingRateThreshold)
|
| {
|
| // If the allocated object size or the total memory size is small, don't trigger a GC.
|
| - if (m_heap->heapStats().allocatedObjectSize() < 100 * 1024 || totalMemorySize() < totalMemorySizeThreshold)
|
| + if (m_heap->heapStats().allocatedObjectSize() < allocatedObjectSizeThreshold || totalMemorySize() < totalMemorySizeThreshold)
|
| return false;
|
| // If the growing rate of Oilpan's heap or PartitionAlloc is high enough,
|
| // trigger a GC.
|
| @@ -518,12 +520,12 @@ bool ThreadState::shouldScheduleIdleGC()
|
| {
|
| if (gcState() != NoGCScheduled)
|
| return false;
|
| - return judgeGCThreshold(1024 * 1024, 1.5);
|
| + return judgeGCThreshold(defaultAllocatedObjectSizeThreshold, 1024 * 1024, 1.5);
|
| }
|
|
|
| bool ThreadState::shouldScheduleV8FollowupGC()
|
| {
|
| - return judgeGCThreshold(32 * 1024 * 1024, 1.5);
|
| + return judgeGCThreshold(defaultAllocatedObjectSizeThreshold, 32 * 1024 * 1024, 1.5);
|
| }
|
|
|
| bool ThreadState::shouldSchedulePageNavigationGC(float estimatedRemovalRatio)
|
| @@ -531,13 +533,13 @@ bool ThreadState::shouldSchedulePageNavigationGC(float estimatedRemovalRatio)
|
| // If estimatedRemovalRatio is low we should let IdleGC handle this.
|
| if (estimatedRemovalRatio < 0.01)
|
| return false;
|
| - return judgeGCThreshold(32 * 1024 * 1024, 1.5 * (1 - estimatedRemovalRatio));
|
| + return judgeGCThreshold(defaultAllocatedObjectSizeThreshold, 32 * 1024 * 1024, 1.5 * (1 - estimatedRemovalRatio));
|
| }
|
|
|
| bool ThreadState::shouldForceConservativeGC()
|
| {
|
| // TODO(haraken): 400% is too large. Lower the heap growing factor.
|
| - return judgeGCThreshold(32 * 1024 * 1024, 5.0);
|
| + return judgeGCThreshold(defaultAllocatedObjectSizeThreshold, 32 * 1024 * 1024, 5.0);
|
| }
|
|
|
| // If we're consuming too much memory, trigger a conservative GC
|
| @@ -546,7 +548,7 @@ bool ThreadState::shouldForceMemoryPressureGC()
|
| {
|
| if (totalMemorySize() < 300 * 1024 * 1024)
|
| return false;
|
| - return judgeGCThreshold(0, 1.5);
|
| + return judgeGCThreshold(0, 0, 1.5);
|
| }
|
|
|
| void ThreadState::scheduleV8FollowupGCIfNeeded(BlinkGC::V8GCType gcType)
|
|
|