Ignore:
Timestamp:
Mar 19, 2014, 6:56:19 PM (11 years ago)
Author:
[email protected]
Message:

GC timer should intelligently choose between EdenCollections and FullCollections
https://bugs.webkit.org/show_bug.cgi?id=128261

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Most of the GCs while browsing the web are due to the GC timer. Currently the GC timer
always does FullCollections. To reduce the impact of the GC timer on the system this patch
changes Heap so that it has two timers, one for each type of collection. The FullCollection
timer is notified at the end of EdenCollections how much the Heap has grown since the last
FullCollection and when somebody notifies the Heap of abandoned memory (which usually wouldn't
be detected by an EdenCollection).

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • heap/EdenGCActivityCallback.cpp: Added.

(JSC::EdenGCActivityCallback::EdenGCActivityCallback):
(JSC::EdenGCActivityCallback::doCollection):
(JSC::EdenGCActivityCallback::lastGCLength):
(JSC::EdenGCActivityCallback::deathRate):
(JSC::EdenGCActivityCallback::gcTimeSlice):

  • heap/EdenGCActivityCallback.h: Added.

(JSC::GCActivityCallback::createEdenTimer):

  • heap/FullGCActivityCallback.cpp: Added.

(JSC::FullGCActivityCallback::FullGCActivityCallback):
(JSC::FullGCActivityCallback::doCollection):
(JSC::FullGCActivityCallback::lastGCLength):
(JSC::FullGCActivityCallback::deathRate):
(JSC::FullGCActivityCallback::gcTimeSlice):

  • heap/FullGCActivityCallback.h: Added.

(JSC::GCActivityCallback::createFullTimer):

  • heap/GCActivityCallback.cpp:

(JSC::GCActivityCallback::GCActivityCallback):
(JSC::GCActivityCallback::doWork):
(JSC::GCActivityCallback::scheduleTimer):
(JSC::GCActivityCallback::cancelTimer):
(JSC::GCActivityCallback::didAllocate):
(JSC::GCActivityCallback::willCollect):
(JSC::GCActivityCallback::cancel):

  • heap/GCActivityCallback.h:
  • heap/Heap.cpp:

(JSC::Heap::Heap):
(JSC::Heap::reportAbandonedObjectGraph):
(JSC::Heap::didAbandon):
(JSC::Heap::collectAllGarbage):
(JSC::Heap::collect):
(JSC::Heap::willStartCollection):
(JSC::Heap::updateAllocationLimits):
(JSC::Heap::didFinishCollection):
(JSC::Heap::setFullActivityCallback):
(JSC::Heap::setEdenActivityCallback):
(JSC::Heap::fullActivityCallback):
(JSC::Heap::edenActivityCallback):
(JSC::Heap::setGarbageCollectionTimerEnabled):
(JSC::Heap::didAllocate):
(JSC::Heap::shouldDoFullCollection):

  • heap/Heap.h:

(JSC::Heap::lastFullGCLength):
(JSC::Heap::lastEdenGCLength):
(JSC::Heap::increaseLastFullGCLength):
(JSC::Heap::sizeBeforeLastEdenCollection):
(JSC::Heap::sizeAfterLastEdenCollection):
(JSC::Heap::sizeBeforeLastFullCollection):
(JSC::Heap::sizeAfterLastFullCollection):

  • heap/HeapOperation.h:
  • heap/HeapStatistics.cpp:

(JSC::HeapStatistics::showObjectStatistics):

  • heap/HeapTimer.cpp:

(JSC::HeapTimer::timerDidFire):

  • jsc.cpp:

(functionFullGC):
(functionEdenGC):

  • runtime/Options.h:

Source/WebCore:

No new tests.

Updated WebSafeGCActivityCallbacks for both Eden and Full timers.

  • bindings/js/JSDOMWindowBase.cpp:

(WebCore::JSDOMWindowBase::commonVM):

  • platform/ios/WebSafeGCActivityCallbackIOS.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r165933 r165940  
    578578{
    579579    JSLockHolder lock(exec);
    580     Heap* heap = exec->heap();
    581     heap->setShouldDoFullCollection(true);
    582     exec->heap()->collect();
     580    exec->heap()->collect(FullCollection);
    583581    return JSValue::encode(jsUndefined());
    584582}
     
    587585{
    588586    JSLockHolder lock(exec);
    589     Heap* heap = exec->heap();
    590     heap->setShouldDoFullCollection(false);
    591     heap->collect();
     587    exec->heap()->collect(EdenCollection);
    592588    return JSValue::encode(jsUndefined());
    593589}
Note: See TracChangeset for help on using the changeset viewer.