Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp |
| index ba550a28e76deadff04231bc8ef97f5af452c36b..4a18f5f36f2f619450cafe6d96cecb15378d6a1d 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp |
| @@ -151,11 +151,16 @@ class MinorGCUnmodifiedWrapperVisitor : public v8::PersistentHandleVisitor { |
| class MajorGCWrapperVisitor : public v8::PersistentHandleVisitor { |
| public: |
| explicit MajorGCWrapperVisitor(v8::Isolate* isolate, |
| - bool constructRetainedObjectInfos) |
| + bool constructRetainedObjectInfos, |
| + bool constructImplicitReferenceGroups) |
| : m_isolate(isolate), |
| m_domObjectsWithPendingActivity(0), |
| m_liveRootGroupIdSet(false), |
| - m_constructRetainedObjectInfos(constructRetainedObjectInfos) {} |
| + m_constructRetainedObjectInfos(constructRetainedObjectInfos), |
| + m_constructImplicitReferenceGroups(constructImplicitReferenceGroups) { |
| + DCHECK(m_constructRetainedObjectInfos || |
| + m_constructImplicitReferenceGroups); |
| + } |
| void VisitPersistentHandle(v8::Persistent<v8::Value>* value, |
| uint16_t classId) override { |
| @@ -202,8 +207,10 @@ class MajorGCWrapperVisitor : public v8::PersistentHandleVisitor { |
| if (m_constructRetainedObjectInfos) |
| m_groupsWhichNeedRetainerInfo.append(root); |
| } else if (classId == WrapperTypeInfo::ObjectClassId) { |
| - type->visitDOMWrapper(m_isolate, toScriptWrappable(wrapper), |
| - v8::Persistent<v8::Object>::Cast(*value)); |
| + if (m_constructImplicitReferenceGroups) { |
|
haraken
2016/10/04 11:24:48
I'd directly use !RuntimeEnabledFeatures::traceWra
Michael Lippautz
2016/10/04 11:31:02
Done.
|
| + type->visitDOMWrapper(m_isolate, toScriptWrappable(wrapper), |
| + v8::Persistent<v8::Object>::Cast(*value)); |
| + } |
| } else { |
| NOTREACHED(); |
| } |
| @@ -253,6 +260,7 @@ class MajorGCWrapperVisitor : public v8::PersistentHandleVisitor { |
| int m_domObjectsWithPendingActivity; |
| bool m_liveRootGroupIdSet; |
| bool m_constructRetainedObjectInfos; |
| + bool m_constructImplicitReferenceGroups; |
| }; |
| static unsigned long long usedHeapSize(v8::Isolate* isolate) { |
| @@ -269,17 +277,21 @@ void visitWeakHandlesForMinorGC(v8::Isolate* isolate) { |
| } |
| void objectGroupingForMajorGC(v8::Isolate* isolate, |
| - bool constructRetainedObjectInfos) { |
| - MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); |
| + bool constructRetainedObjectInfos, |
| + bool constructImplicitReferenceGroups) { |
|
haraken
2016/10/04 11:24:48
constructImplicitReferenceGroups is unused.
Michael Lippautz
2016/10/04 11:31:02
Done.
|
| + MajorGCWrapperVisitor visitor( |
| + isolate, constructRetainedObjectInfos, |
| + !RuntimeEnabledFeatures::traceWrappablesEnabled()); |
| isolate->VisitHandlesWithClassIds(&visitor); |
| visitor.notifyFinished(); |
| } |
| void gcPrologueForMajorGC(v8::Isolate* isolate, |
| bool constructRetainedObjectInfos) { |
| - // TODO(hlopko): Collect retained object infos for heap profiler |
| - if (!RuntimeEnabledFeatures::traceWrappablesEnabled()) { |
| - objectGroupingForMajorGC(isolate, constructRetainedObjectInfos); |
| + const bool objectGrouping = !RuntimeEnabledFeatures::traceWrappablesEnabled(); |
| + if (objectGrouping || constructRetainedObjectInfos) { |
| + objectGroupingForMajorGC(isolate, constructRetainedObjectInfos, |
| + objectGrouping); |
| } |
| } |