Ignore:
Timestamp:
Apr 20, 2012, 12:55:21 PM (13 years ago)
Author:
[email protected]
Message:

Heap should cancel GC timer at the start of the collection
https://bugs.webkit.org/show_bug.cgi?id=84477

Reviewed by Geoffrey Garen.

Currently the Heap cancels the GC timer at the conclusion of a collection.
We should change this to be at the beginning because something (e.g. a finalizer)
could call didAbandonObjectGraph(), which will schedule the timer, but then
we'll immediately unschedule the timer at the conclusion of the collection,
thus potentially preventing large swaths of memory from being reclaimed in a timely manner.

  • API/JSBase.cpp:

(JSGarbageCollect): Remove outdated fix-me and remove check for whether the Heap is
busy or not, since we're just scheduling a timer to run a GC in the future.

  • heap/Heap.cpp:

(JSC::Heap::collect): Rename didCollect to willCollect and move the call to the
top of Heap::collect.

  • runtime/GCActivityCallback.cpp: Renamed didCollect to willCollect.

(JSC::DefaultGCActivityCallback::willCollect):

  • runtime/GCActivityCallback.h: Ditto.

(JSC::GCActivityCallback::willCollect):
(DefaultGCActivityCallback):

  • runtime/GCActivityCallbackCF.cpp: Ditto.

(JSC::DefaultGCActivityCallback::willCollect):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSBase.cpp

    r114771 r114772  
    101101    APIEntryShim entryShim(exec, false);
    102102
    103     JSGlobalData& globalData = exec->globalData();
    104     if (!globalData.heap.isBusy())
    105         globalData.heap.activityCallback()->didAbandonObjectGraph();
    106 
    107     // FIXME: Perhaps we should trigger a second mark and sweep
    108     // once the garbage collector is done if this is called when
    109     // the collector is busy.
     103    exec->globalData().heap.activityCallback()->didAbandonObjectGraph();
    110104}
    111105
Note: See TracChangeset for help on using the changeset viewer.