Ignore:
Timestamp:
Apr 25, 2012, 10:08:06 PM (13 years ago)
Author:
[email protected]
Message:

WebCore shouldn't call collectAllGarbage directly
https://bugs.webkit.org/show_bug.cgi?id=84897

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Exported symbol

for reportAbanondedObjectGraph so WebCore can use it.

  • heap/Heap.h: Ditto.

Source/WebCore:

No new tests.

Currently, GCController calls Heap::collectAllGarbage directly, which leads
to an overload of collections as the timer in GCController and the timer in
GCActivityCallback compete for collection time and fire independently. As a
result, we end up doing almost 600 full collections during an in-browser run
of SunSpider, or 20 full collections on a single load of TechCrunch.

We can do better by preventing WebCore from calling collectAllGarbage directly
and instead going through Heap::reportAbandonedObjectGraph, since that is what
WebCore is trying to do--notify the Heap that a lot of garbage may have just
been generated when we left a page.

  • WebCore.exp.in:
  • bindings/js/GCController.cpp: Removed all timer stuff.

(WebCore::GCController::GCController):
(WebCore::GCController::garbageCollectSoon): Changed to call Heap::reportAbandonedObjectGraph.
(WebCore::GCController::garbageCollectNow): Changed to still directly call collectAllGarbage.
We will deprecate this function soon hopefully.

  • bindings/js/GCController.h: Removed timer stuff.

(GCController):

  • bindings/js/ScriptProfiler.cpp:

(WebCore::ScriptProfiler::collectGarbage): Changed to call garbageCollectSoon.

Source/WebKit2:

  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::didClose): Changed to call garbageCollectSoon. This is the
function that causes us to do so much collection on page navigation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r115156 r115288  
    120120
    121121        void reportExtraMemoryCost(size_t cost);
    122         void reportAbandonedObjectGraph();
     122        JS_EXPORT_PRIVATE void reportAbandonedObjectGraph();
    123123
    124124        JS_EXPORT_PRIVATE void protect(JSValue);
Note: See TracChangeset for help on using the changeset viewer.