Beispiel #1
0
// Create object groups for DOM tree nodes.
void V8GCController::gcPrologue()
{
    v8::HandleScope scope;

#ifndef NDEBUG
    DOMObjectVisitor domObjectVisitor;
    visitDOMObjects(&domObjectVisitor);
#endif

    // Run through all objects with possible pending activity making their
    // wrappers non weak if there is pending activity.
    GCPrologueVisitor<void, SpecialCasePrologueObjectHandler> prologueObjectVisitor;
    visitActiveDOMObjects(&prologueObjectVisitor);
    GCPrologueVisitor<Node, SpecialCasePrologueNodeHandler> prologueNodeVisitor;
    visitActiveDOMNodes(&prologueNodeVisitor);

    // Create object groups.
    GrouperVisitor grouperVisitor;
    visitDOMNodes(&grouperVisitor);
    visitActiveDOMNodes(&grouperVisitor);
    visitDOMObjects(&grouperVisitor);
    grouperVisitor.applyGrouping();

    // Clean single element cache for string conversions.
    V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
    data->stringCache()->clearOnGC();
}
Beispiel #2
0
void V8GCController::gcEpilogue()
{
    v8::HandleScope scope;

    // Run through all objects with pending activity making their wrappers weak
    // again.
    GCEpilogueVisitor epilogueVisitor;
    visitActiveDOMObjects(&epilogueVisitor);

    workingSetEstimateMB = getActualMemoryUsageInMB();

#ifndef NDEBUG
    // Check all survivals are weak.
    DOMObjectVisitor domObjectVisitor;
    visitDOMObjects(&domObjectVisitor);

    EnsureWeakDOMNodeVisitor weakDOMNodeVisitor;
    visitDOMNodes(&weakDOMNodeVisitor);

    enumerateGlobalHandles();
#endif
}