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

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

Issue 1944363002: Use a new type of weak phantom handle for ScriptWrappable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unindent Created 4 years, 7 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 | « third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h ('k') | 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 gcPrologueForMajorGC(isolate, flags & v8::kGCCallbackFlagConstructRetain edObjectInfos); 308 gcPrologueForMajorGC(isolate, flags & v8::kGCCallbackFlagConstructRetain edObjectInfos);
309 break; 309 break;
310 case v8::kGCTypeProcessWeakCallbacks: 310 case v8::kGCTypeProcessWeakCallbacks:
311 TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefor e", usedHeapSize(isolate), "type", "weak processing"); 311 TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefor e", usedHeapSize(isolate), "type", "weak processing");
312 break; 312 break;
313 default: 313 default:
314 ASSERT_NOT_REACHED(); 314 ASSERT_NOT_REACHED();
315 } 315 }
316 } 316 }
317 317
318 namespace {
319
320 void UpdateCollectedPhantomHandles(v8::Isolate* isolate)
321 {
322 ThreadHeapStats& heapStats = ThreadState::current()->heap().heapStats();
323 size_t count = isolate->NumberOfPhantomHandleResetsSinceLastCall();
324 heapStats.decreaseWrapperCount(count);
dominicc (has gone to gerrit) 2016/05/11 03:38:30 Does this mean that phantom handles should *only*
haraken 2016/05/11 03:48:38 Not really. heapStats.decreaseWrapperCount is just
325 heapStats.increaseCollectedWrapperCount(count);
326 }
327
328 } // namespace
329
318 void V8GCController::gcEpilogue(v8::Isolate* isolate, v8::GCType type, v8::GCCal lbackFlags flags) 330 void V8GCController::gcEpilogue(v8::Isolate* isolate, v8::GCType type, v8::GCCal lbackFlags flags)
319 { 331 {
332 UpdateCollectedPhantomHandles(isolate);
320 switch (type) { 333 switch (type) {
321 case v8::kGCTypeScavenge: 334 case v8::kGCTypeScavenge:
322 TRACE_EVENT_END1("devtools.timeline,v8", "MinorGC", "usedHeapSizeAfter", usedHeapSize(isolate)); 335 TRACE_EVENT_END1("devtools.timeline,v8", "MinorGC", "usedHeapSizeAfter", usedHeapSize(isolate));
323 // TODO(haraken): Remove this. See the comment in gcPrologue. 336 // TODO(haraken): Remove this. See the comment in gcPrologue.
324 if (ThreadState::current()) 337 if (ThreadState::current())
325 ThreadState::current()->scheduleV8FollowupGCIfNeeded(BlinkGC::V8Mino rGC); 338 ThreadState::current()->scheduleV8FollowupGCIfNeeded(BlinkGC::V8Mino rGC);
326 break; 339 break;
327 case v8::kGCTypeMarkSweepCompact: 340 case v8::kGCTypeMarkSweepCompact:
328 TRACE_EVENT_END1("devtools.timeline,v8", "MajorGC", "usedHeapSizeAfter", usedHeapSize(isolate)); 341 TRACE_EVENT_END1("devtools.timeline,v8", "MajorGC", "usedHeapSizeAfter", usedHeapSize(isolate));
329 if (ThreadState::current()) 342 if (ThreadState::current())
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scanPendingActivityHis togram, new CustomCountHistogram("Blink.ScanPendingActivityDuration", 1, 1000, 5 0)); 497 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scanPendingActivityHis togram, new CustomCountHistogram("Blink.ScanPendingActivityDuration", 1, 1000, 5 0));
485 double startTime = WTF::currentTimeMS(); 498 double startTime = WTF::currentTimeMS();
486 v8::HandleScope scope(isolate); 499 v8::HandleScope scope(isolate);
487 PendingActivityVisitor visitor(isolate, executionContext); 500 PendingActivityVisitor visitor(isolate, executionContext);
488 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); 501 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor);
489 scanPendingActivityHistogram.count(static_cast<int>(WTF::currentTimeMS() - s tartTime)); 502 scanPendingActivityHistogram.count(static_cast<int>(WTF::currentTimeMS() - s tartTime));
490 return visitor.pendingActivityFound(); 503 return visitor.pendingActivityFound();
491 } 504 }
492 505
493 } // namespace blink 506 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698