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

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

Issue 1467493002: We mustn't finalize sweeping when V8 started collecting garbage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 5 years, 1 month 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
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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 } 623 }
624 if (gcType == BlinkGC::V8MajorGC) { 624 if (gcType == BlinkGC::V8MajorGC) {
625 #if PRINT_HEAP_STATS 625 #if PRINT_HEAP_STATS
626 dataLogF("Scheduled IdleGC\n"); 626 dataLogF("Scheduled IdleGC\n");
627 #endif 627 #endif
628 scheduleIdleGC(); 628 scheduleIdleGC();
629 return; 629 return;
630 } 630 }
631 } 631 }
632 632
633 void ThreadState::willStartV8GC()
haraken 2015/11/20 15:11:35 And don't remove this code :) I'll prepare a CL to
634 {
635 // Finish Oilpan's complete sweeping before running a V8 GC.
636 // This will let the GC collect more V8 objects.
637 //
638 // TODO(haraken): It's a bit too late for a major GC to schedule
639 // completeSweep() here, because gcPrologue for a major GC is called
640 // not at the point where the major GC started but at the point where
641 // the major GC requests object grouping.
642 completeSweep();
643
644 // The fact that the PageNavigation GC is scheduled means that there is
645 // a dead frame. In common cases, a sequence of Oilpan's GC => V8 GC =>
646 // Oilpan's GC is needed to collect the dead frame. So we force the
647 // PageNavigation GC before running the V8 GC.
648 if (gcState() == PageNavigationGCScheduled) {
649 #if PRINT_HEAP_STATS
650 dataLogF("Scheduled PageNavigationGC\n");
651 #endif
652 Heap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GCWithSweep, BlinkGC::PageNavigationGC);
653 }
654 }
655
656 void ThreadState::schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio) 633 void ThreadState::schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio)
657 { 634 {
658 ASSERT(checkThread()); 635 ASSERT(checkThread());
659 Heap::reportMemoryUsageForTracing(); 636 Heap::reportMemoryUsageForTracing();
660 637
661 #if PRINT_HEAP_STATS 638 #if PRINT_HEAP_STATS
662 dataLogF("ThreadState::schedulePageNavigationGCIfNeeded (estimatedRemovalRat io=%.2lf)\n", estimatedRemovalRatio); 639 dataLogF("ThreadState::schedulePageNavigationGCIfNeeded (estimatedRemovalRat io=%.2lf)\n", estimatedRemovalRatio);
663 #endif 640 #endif
664 641
665 if (isGCForbidden()) 642 if (isGCForbidden())
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 threadDump->addScalar("dead_count", "objects", totalDeadCount); 1460 threadDump->addScalar("dead_count", "objects", totalDeadCount);
1484 threadDump->addScalar("live_size", "bytes", totalLiveSize); 1461 threadDump->addScalar("live_size", "bytes", totalLiveSize);
1485 threadDump->addScalar("dead_size", "bytes", totalDeadSize); 1462 threadDump->addScalar("dead_size", "bytes", totalDeadSize);
1486 1463
1487 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); 1464 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c reateMemoryAllocatorDumpForCurrentGC(heapsDumpName);
1488 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()- >createMemoryAllocatorDumpForCurrentGC(classesDumpName); 1465 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()- >createMemoryAllocatorDumpForCurrentGC(classesDumpName);
1489 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners hipEdge(classesDump->guid(), heapsDump->guid()); 1466 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners hipEdge(classesDump->guid(), heapsDump->guid());
1490 } 1467 }
1491 1468
1492 } // namespace blink 1469 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698