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

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

Issue 2387373002: Create retainment infos from handles, even for tracing (Closed)
Patch Set: Comments Created 4 years, 2 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 | no next file » | 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 Node* node = V8Node::toImpl(wrapper); 195 Node* node = V8Node::toImpl(wrapper);
196 if (node->hasEventListeners()) 196 if (node->hasEventListeners())
197 addReferencesForNodeWithEventListeners( 197 addReferencesForNodeWithEventListeners(
198 m_isolate, node, v8::Persistent<v8::Object>::Cast(*value)); 198 m_isolate, node, v8::Persistent<v8::Object>::Cast(*value));
199 Node* root = V8GCController::opaqueRootForGC(m_isolate, node); 199 Node* root = V8GCController::opaqueRootForGC(m_isolate, node);
200 m_isolate->SetObjectGroupId( 200 m_isolate->SetObjectGroupId(
201 *value, v8::UniqueId(reinterpret_cast<intptr_t>(root))); 201 *value, v8::UniqueId(reinterpret_cast<intptr_t>(root)));
202 if (m_constructRetainedObjectInfos) 202 if (m_constructRetainedObjectInfos)
203 m_groupsWhichNeedRetainerInfo.append(root); 203 m_groupsWhichNeedRetainerInfo.append(root);
204 } else if (classId == WrapperTypeInfo::ObjectClassId) { 204 } else if (classId == WrapperTypeInfo::ObjectClassId) {
205 type->visitDOMWrapper(m_isolate, toScriptWrappable(wrapper), 205 if (!RuntimeEnabledFeatures::traceWrappablesEnabled()) {
206 v8::Persistent<v8::Object>::Cast(*value)); 206 type->visitDOMWrapper(m_isolate, toScriptWrappable(wrapper),
207 v8::Persistent<v8::Object>::Cast(*value));
208 }
207 } else { 209 } else {
208 NOTREACHED(); 210 NOTREACHED();
209 } 211 }
210 } 212 }
211 213
212 void notifyFinished() { 214 void notifyFinished() {
213 if (!m_constructRetainedObjectInfos) 215 if (!m_constructRetainedObjectInfos)
214 return; 216 return;
215 std::sort(m_groupsWhichNeedRetainerInfo.begin(), 217 std::sort(m_groupsWhichNeedRetainerInfo.begin(),
216 m_groupsWhichNeedRetainerInfo.end()); 218 m_groupsWhichNeedRetainerInfo.end());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 272
271 void objectGroupingForMajorGC(v8::Isolate* isolate, 273 void objectGroupingForMajorGC(v8::Isolate* isolate,
272 bool constructRetainedObjectInfos) { 274 bool constructRetainedObjectInfos) {
273 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); 275 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos);
274 isolate->VisitHandlesWithClassIds(&visitor); 276 isolate->VisitHandlesWithClassIds(&visitor);
275 visitor.notifyFinished(); 277 visitor.notifyFinished();
276 } 278 }
277 279
278 void gcPrologueForMajorGC(v8::Isolate* isolate, 280 void gcPrologueForMajorGC(v8::Isolate* isolate,
279 bool constructRetainedObjectInfos) { 281 bool constructRetainedObjectInfos) {
280 // TODO(hlopko): Collect retained object infos for heap profiler 282 if (!RuntimeEnabledFeatures::traceWrappablesEnabled() ||
281 if (!RuntimeEnabledFeatures::traceWrappablesEnabled()) { 283 constructRetainedObjectInfos) {
282 objectGroupingForMajorGC(isolate, constructRetainedObjectInfos); 284 objectGroupingForMajorGC(isolate, constructRetainedObjectInfos);
283 } 285 }
284 } 286 }
285 287
286 } // namespace 288 } // namespace
287 289
288 void V8GCController::gcPrologue(v8::Isolate* isolate, 290 void V8GCController::gcPrologue(v8::Isolate* isolate,
289 v8::GCType type, 291 v8::GCType type,
290 v8::GCCallbackFlags flags) { 292 v8::GCCallbackFlags flags) {
291 if (isMainThread()) 293 if (isMainThread())
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 double startTime = WTF::currentTimeMS(); 539 double startTime = WTF::currentTimeMS();
538 v8::HandleScope scope(isolate); 540 v8::HandleScope scope(isolate);
539 PendingActivityVisitor visitor(isolate, executionContext); 541 PendingActivityVisitor visitor(isolate, executionContext);
540 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); 542 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor);
541 scanPendingActivityHistogram.count( 543 scanPendingActivityHistogram.count(
542 static_cast<int>(WTF::currentTimeMS() - startTime)); 544 static_cast<int>(WTF::currentTimeMS() - startTime));
543 return visitor.pendingActivityFound(); 545 return visitor.pendingActivityFound();
544 } 546 }
545 547
546 } // namespace blink 548 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698