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

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

Issue 2178393002: Fix BlinkGC triggering so it is more sensitive to PartitionAlloc only allocations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« 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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 double growingRate = estimatedSize > 0 ? 1.0 * currentSize / estimatedSize : 100; 496 double growingRate = estimatedSize > 0 ? 1.0 * currentSize / estimatedSize : 100;
497 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), "ThreadState::partitio nAllocEstimatedSizeKB", std::min(estimatedSize / 1024, static_cast<size_t>(INT_M AX))); 497 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), "ThreadState::partitio nAllocEstimatedSizeKB", std::min(estimatedSize / 1024, static_cast<size_t>(INT_M AX)));
498 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), "ThreadState::partitio nAllocGrowingRate", static_cast<int>(100 * growingRate)); 498 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), "ThreadState::partitio nAllocGrowingRate", static_cast<int>(100 * growingRate));
499 return growingRate; 499 return growingRate;
500 } 500 }
501 501
502 // TODO(haraken): We should improve the GC heuristics. The heuristics affect 502 // TODO(haraken): We should improve the GC heuristics. The heuristics affect
503 // performance significantly. 503 // performance significantly.
504 bool ThreadState::judgeGCThreshold(size_t totalMemorySizeThreshold, double heapG rowingRateThreshold) 504 bool ThreadState::judgeGCThreshold(size_t totalMemorySizeThreshold, double heapG rowingRateThreshold)
505 { 505 {
506 // If the allocated object size or the total memory size is small, don't tri gger a GC. 506 // If the total memory size is small, don't trigger a GC.
507 if (m_heap->heapStats().allocatedObjectSize() < 100 * 1024 || totalMemorySiz e() < totalMemorySizeThreshold) 507 if (totalMemorySize() < totalMemorySizeThreshold)
508 return false; 508 return false;
509 // If the growing rate of Oilpan's heap or PartitionAlloc is high enough, 509
510 // trigger a GC. 510 // If the growing rate of PartitionAlloc is high enough, trigger a GC.
511 #if PRINT_HEAP_STATS 511 if (partitionAllocGrowingRate() >= heapGrowingRateThreshold)
haraken 2016/07/26 14:40:51 Shall we keep this line?
haraken 2016/07/26 14:40:51 I'm a bit afraid of this change. After this change
keishi 2016/07/26 15:46:13 Yeah. I'm running the perf tests right now but it
512 dataLogF("heapGrowingRate=%.1lf, partitionAllocGrowingRate=%.1lf\n", heapGro wingRate(), partitionAllocGrowingRate()); 512 return true;
513 #endif 513
514 return heapGrowingRate() >= heapGrowingRateThreshold || partitionAllocGrowin gRate() >= heapGrowingRateThreshold; 514 // If the allocated object size is small, don't trigger a GC.
515 if (m_heap->heapStats().allocatedObjectSize() < 100 * 1024)
516 return false;
517 // If the growing rate of Oilpan's heap is high enough, trigger a GC.
518 return heapGrowingRate() >= heapGrowingRateThreshold;
515 } 519 }
516 520
517 bool ThreadState::shouldScheduleIdleGC() 521 bool ThreadState::shouldScheduleIdleGC()
518 { 522 {
519 if (gcState() != NoGCScheduled) 523 if (gcState() != NoGCScheduled)
520 return false; 524 return false;
521 return judgeGCThreshold(1024 * 1024, 1.5); 525 return judgeGCThreshold(1024 * 1024, 1.5);
522 } 526 }
523 527
524 bool ThreadState::shouldScheduleV8FollowupGC() 528 bool ThreadState::shouldScheduleV8FollowupGC()
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 threadDump->AddScalar("dead_count", "objects", totalDeadCount); 1532 threadDump->AddScalar("dead_count", "objects", totalDeadCount);
1529 threadDump->AddScalar("live_size", "bytes", totalLiveSize); 1533 threadDump->AddScalar("live_size", "bytes", totalLiveSize);
1530 threadDump->AddScalar("dead_size", "bytes", totalDeadSize); 1534 threadDump->AddScalar("dead_size", "bytes", totalDeadSize);
1531 1535
1532 base::trace_event::MemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvide r::instance()->createMemoryAllocatorDumpForCurrentGC(heapsDumpName); 1536 base::trace_event::MemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvide r::instance()->createMemoryAllocatorDumpForCurrentGC(heapsDumpName);
1533 base::trace_event::MemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvi der::instance()->createMemoryAllocatorDumpForCurrentGC(classesDumpName); 1537 base::trace_event::MemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvi der::instance()->createMemoryAllocatorDumpForCurrentGC(classesDumpName);
1534 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->AddOwners hipEdge(classesDump->guid(), heapsDump->guid()); 1538 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->AddOwners hipEdge(classesDump->guid(), heapsDump->guid());
1535 } 1539 }
1536 1540
1537 } // namespace blink 1541 } // 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