Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp

Issue 2650783002: [wrapper-tracing] Fix V8GCController::getRetainerInfos (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 !m_firstScriptWrappableTraced) { 227 !m_firstScriptWrappableTraced) {
228 m_firstScriptWrappableTraced = true; 228 m_firstScriptWrappableTraced = true;
229 traceable->traceWrappers(this); 229 traceable->traceWrappers(this);
230 } 230 }
231 } 231 }
232 232
233 private: 233 private:
234 v8::HeapProfiler::RetainerChildren findV8WrappersDirectlyReachableFrom( 234 v8::HeapProfiler::RetainerChildren findV8WrappersDirectlyReachableFrom(
235 Node* traceable) { 235 Node* traceable) {
236 CHECK(m_foundV8Wrappers.empty()); 236 CHECK(m_foundV8Wrappers.empty());
237 WTF::AutoReset<bool>(&m_onlyTraceSingleLevel, true); 237 WTF::AutoReset<bool> scope(&m_onlyTraceSingleLevel, true);
238 m_firstScriptWrappableTraced = false; 238 m_firstScriptWrappableTraced = false;
239 m_currentParent = 239 m_currentParent =
240 &v8::Persistent<v8::Value>::Cast(*traceable->rawMainWorldWrapper()); 240 &v8::Persistent<v8::Value>::Cast(*traceable->rawMainWorldWrapper());
241 241
242 TracePrologue(); 242 TracePrologue();
243 traceable->wrapperTypeInfo()->traceWrappers(this, traceable); 243 traceable->wrapperTypeInfo()->traceWrappers(this, traceable);
244 AdvanceTracing( 244 AdvanceTracing(
245 0, 245 0,
246 v8::EmbedderHeapTracer::AdvanceTracingActions( 246 v8::EmbedderHeapTracer::AdvanceTracingActions(
247 v8::EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION)); 247 v8::EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION));
(...skipping 18 matching lines...) Expand all
266 }; 266 };
267 267
268 // The function |getRetainerInfos| processing all handles on the blink heap, 268 // The function |getRetainerInfos| processing all handles on the blink heap,
269 // logically grouping together DOM trees (attached and detached) and pending 269 // logically grouping together DOM trees (attached and detached) and pending
270 // activities, while at the same time finding parent to child relationships 270 // activities, while at the same time finding parent to child relationships
271 // for non-Node wrappers. Since we are processing *all* handles there is no 271 // for non-Node wrappers. Since we are processing *all* handles there is no
272 // way we miss out on a handle. V8 will figure out the liveness information 272 // way we miss out on a handle. V8 will figure out the liveness information
273 // for the provided information itself. 273 // for the provided information itself.
274 v8::HeapProfiler::RetainerInfos V8GCController::getRetainerInfos( 274 v8::HeapProfiler::RetainerInfos V8GCController::getRetainerInfos(
275 v8::Isolate* isolate) { 275 v8::Isolate* isolate) {
276 std::unique_ptr<HeapSnaphotWrapperVisitor> tracer(
277 new HeapSnaphotWrapperVisitor(isolate));
278 V8PerIsolateData::TemporaryScriptWrappableVisitorScope scope( 276 V8PerIsolateData::TemporaryScriptWrappableVisitorScope scope(
279 isolate, std::move(tracer)); 277 isolate, std::unique_ptr<HeapSnaphotWrapperVisitor>(
278 new HeapSnaphotWrapperVisitor(isolate)));
280 279
280 HeapSnaphotWrapperVisitor* tracer =
281 reinterpret_cast<HeapSnaphotWrapperVisitor*>(scope.currentVisitor());
281 tracer->collectV8Roots(); 282 tracer->collectV8Roots();
282 tracer->traceV8Roots(); 283 tracer->traceV8Roots();
283 tracer->tracePendingActivities(); 284 tracer->tracePendingActivities();
284 return v8::HeapProfiler::RetainerInfos{tracer->groups(), tracer->edges()}; 285 return v8::HeapProfiler::RetainerInfos{tracer->groups(), tracer->edges()};
285 } 286 }
286 287
287 class MajorGCWrapperVisitor : public v8::PersistentHandleVisitor { 288 class MajorGCWrapperVisitor : public v8::PersistentHandleVisitor {
288 public: 289 public:
289 explicit MajorGCWrapperVisitor(v8::Isolate* isolate, 290 explicit MajorGCWrapperVisitor(v8::Isolate* isolate,
290 bool constructRetainedObjectInfos) 291 bool constructRetainedObjectInfos)
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 double startTime = WTF::currentTimeMS(); 681 double startTime = WTF::currentTimeMS();
681 v8::HandleScope scope(isolate); 682 v8::HandleScope scope(isolate);
682 PendingActivityVisitor visitor(isolate, executionContext); 683 PendingActivityVisitor visitor(isolate, executionContext);
683 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); 684 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor);
684 scanPendingActivityHistogram.count( 685 scanPendingActivityHistogram.count(
685 static_cast<int>(WTF::currentTimeMS() - startTime)); 686 static_cast<int>(WTF::currentTimeMS() - startTime));
686 return visitor.pendingActivityFound(); 687 return visitor.pendingActivityFound();
687 } 688 }
688 689
689 } // namespace blink 690 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698