void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags) { // FIXME: It would be nice if the GC callbacks passed the Isolate directly.... v8::Isolate* isolate = v8::Isolate::GetCurrent(); TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "GCEvent", "usedHeapSizeBefore", usedHeapSize(isolate)); if (type == v8::kGCTypeScavenge) minorGCPrologue(isolate); else if (type == v8::kGCTypeMarkSweepCompact) majorGCPrologue(isolate, flags & v8::kGCCallbackFlagConstructRetainedObjectInfos); }
void V8GCController::gcPrologue(v8::Isolate* isolate, v8::GCType type, v8::GCCallbackFlags flags) { if (isMainThread()) ScriptForbiddenScope::enter(); // TODO(haraken): A GC callback is not allowed to re-enter V8. This means // that it's unsafe to run Oilpan's GC in the GC callback because it may // run finalizers that call into V8. To avoid the risk, we should post // a task to schedule the Oilpan's GC. // (In practice, there is no finalizer that calls into V8 and thus is safe.) v8::HandleScope scope(isolate); switch (type) { case v8::kGCTypeScavenge: if (ThreadState::current()) ThreadState::current()->willStartV8GC(BlinkGC::V8MinorGC); TRACE_EVENT_BEGIN1("devtools.timeline,v8", "MinorGC", "usedHeapSizeBefore", usedHeapSize(isolate)); visitWeakHandlesForMinorGC(isolate); break; case v8::kGCTypeMarkSweepCompact: if (ThreadState::current()) ThreadState::current()->willStartV8GC(BlinkGC::V8MajorGC); TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefore", usedHeapSize(isolate), "type", "atomic pause"); gcPrologueForMajorGC(isolate, flags & v8::kGCCallbackFlagConstructRetainedObjectInfos); break; case v8::kGCTypeIncrementalMarking: if (ThreadState::current()) ThreadState::current()->willStartV8GC(BlinkGC::V8MajorGC); TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefore", usedHeapSize(isolate), "type", "incremental marking"); gcPrologueForMajorGC(isolate, flags & v8::kGCCallbackFlagConstructRetainedObjectInfos); break; case v8::kGCTypeProcessWeakCallbacks: TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefore", usedHeapSize(isolate), "type", "weak processing"); break; default: ASSERT_NOT_REACHED(); } }
void WebDevToolsAgentImpl::willComposite() { TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "CompositeLayers", "layerTreeId", m_layerTreeId); if (InspectorController* ic = inspectorController()) ic->willComposite(); }