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

Side by Side Diff: third_party/WebKit/Source/platform/heap/Heap.cpp

Issue 1686943002: Oilpan: Decommit backing storage of CallbackStacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } 297 }
298 298
299 #if ENABLE(ASSERT) 299 #if ENABLE(ASSERT)
300 bool Heap::weakTableRegistered(const void* table) 300 bool Heap::weakTableRegistered(const void* table)
301 { 301 {
302 ASSERT(s_ephemeronStack); 302 ASSERT(s_ephemeronStack);
303 return s_ephemeronStack->hasCallbackForObject(table); 303 return s_ephemeronStack->hasCallbackForObject(table);
304 } 304 }
305 #endif 305 #endif
306 306
307 void Heap::decommitCallbackStacks()
308 {
309 s_markingStack->decommit();
310 s_postMarkingCallbackStack->decommit();
311 s_globalWeakCallbackStack->decommit();
312 s_ephemeronStack->decommit();
313 }
314
307 void Heap::preGC() 315 void Heap::preGC()
308 { 316 {
309 ASSERT(!ThreadState::current()->isInGC()); 317 ASSERT(!ThreadState::current()->isInGC());
310 for (ThreadState* state : ThreadState::attachedThreads()) 318 for (ThreadState* state : ThreadState::attachedThreads())
311 state->preGC(); 319 state->preGC();
312 } 320 }
313 321
314 void Heap::postGC(BlinkGC::GCType gcType) 322 void Heap::postGC(BlinkGC::GCType gcType)
315 { 323 {
316 ASSERT(ThreadState::current()->isInGC()); 324 ASSERT(ThreadState::current()->isInGC());
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 totalObjectSpaceHistogram.count(Heap::allocatedObjectSize() / 1024); 421 totalObjectSpaceHistogram.count(Heap::allocatedObjectSize() / 1024);
414 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, totalAllocatedSpaceHis togram, new CustomCountHistogram("BlinkGC.TotalAllocatedSpace", 0, 4 * 1024 * 10 24, 50)); 422 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, totalAllocatedSpaceHis togram, new CustomCountHistogram("BlinkGC.TotalAllocatedSpace", 0, 4 * 1024 * 10 24, 50));
415 totalAllocatedSpaceHistogram.count(Heap::allocatedSpace() / 1024); 423 totalAllocatedSpaceHistogram.count(Heap::allocatedSpace() / 1024);
416 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, gcReasonHistogram, new EnumerationHistogram("BlinkGC.GCReason", BlinkGC::NumberOfGCReason)); 424 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, gcReasonHistogram, new EnumerationHistogram("BlinkGC.GCReason", BlinkGC::NumberOfGCReason));
417 gcReasonHistogram.count(reason); 425 gcReasonHistogram.count(reason);
418 426
419 Heap::reportMemoryUsageHistogram(); 427 Heap::reportMemoryUsageHistogram();
420 WTF::Partitions::reportMemoryUsageHistogram(); 428 WTF::Partitions::reportMemoryUsageHistogram();
421 429
422 postGC(gcType); 430 postGC(gcType);
431 Heap::decommitCallbackStacks();
423 432
424 #if ENABLE(ASSERT) 433 #if ENABLE(ASSERT)
425 // 0 is used to figure non-assigned area, so avoid to use 0 in s_gcGeneratio n. 434 // 0 is used to figure non-assigned area, so avoid to use 0 in s_gcGeneratio n.
426 if (++s_gcGeneration == 0) { 435 if (++s_gcGeneration == 0) {
427 s_gcGeneration = 1; 436 s_gcGeneration = 1;
428 } 437 }
429 #endif 438 #endif
430 } 439 }
431 440
432 void Heap::collectGarbageForTerminatingThread(ThreadState* state) 441 void Heap::collectGarbageForTerminatingThread(ThreadState* state)
(...skipping 22 matching lines...) Expand all
455 state->visitPersistents(visitorScope.visitor()); 464 state->visitPersistents(visitorScope.visitor());
456 465
457 // 2. Trace objects reachable from the thread's persistent roots 466 // 2. Trace objects reachable from the thread's persistent roots
458 // including ephemerons. 467 // including ephemerons.
459 processMarkingStack(visitorScope.visitor()); 468 processMarkingStack(visitorScope.visitor());
460 469
461 postMarkingProcessing(visitorScope.visitor()); 470 postMarkingProcessing(visitorScope.visitor());
462 globalWeakProcessing(visitorScope.visitor()); 471 globalWeakProcessing(visitorScope.visitor());
463 472
464 state->postGC(BlinkGC::GCWithSweep); 473 state->postGC(BlinkGC::GCWithSweep);
474 Heap::decommitCallbackStacks();
465 } 475 }
466 state->preSweep(); 476 state->preSweep();
467 } 477 }
468 478
469 void Heap::processMarkingStack(Visitor* visitor) 479 void Heap::processMarkingStack(Visitor* visitor)
470 { 480 {
471 // Ephemeron fixed point loop. 481 // Ephemeron fixed point loop.
472 do { 482 do {
473 { 483 {
474 // Iteratively mark all objects that are reachable from the objects 484 // Iteratively mark all objects that are reachable from the objects
(...skipping 16 matching lines...) Expand all
491 void Heap::postMarkingProcessing(Visitor* visitor) 501 void Heap::postMarkingProcessing(Visitor* visitor)
492 { 502 {
493 TRACE_EVENT0("blink_gc", "Heap::postMarkingProcessing"); 503 TRACE_EVENT0("blink_gc", "Heap::postMarkingProcessing");
494 // Call post-marking callbacks including: 504 // Call post-marking callbacks including:
495 // 1. the ephemeronIterationDone callbacks on weak tables to do cleanup 505 // 1. the ephemeronIterationDone callbacks on weak tables to do cleanup
496 // (specifically to clear the queued bits for weak hash tables), and 506 // (specifically to clear the queued bits for weak hash tables), and
497 // 2. the markNoTracing callbacks on collection backings to mark them 507 // 2. the markNoTracing callbacks on collection backings to mark them
498 // if they are only reachable from their front objects. 508 // if they are only reachable from their front objects.
499 while (popAndInvokePostMarkingCallback(visitor)) { } 509 while (popAndInvokePostMarkingCallback(visitor)) { }
500 510
501 s_ephemeronStack->clear();
502
503 // Post-marking callbacks should not trace any objects and 511 // Post-marking callbacks should not trace any objects and
504 // therefore the marking stack should be empty after the 512 // therefore the marking stack should be empty after the
505 // post-marking callbacks. 513 // post-marking callbacks.
506 ASSERT(s_markingStack->isEmpty()); 514 ASSERT(s_markingStack->isEmpty());
507 } 515 }
508 516
509 void Heap::globalWeakProcessing(Visitor* visitor) 517 void Heap::globalWeakProcessing(Visitor* visitor)
510 { 518 {
511 TRACE_EVENT0("blink_gc", "Heap::globalWeakProcessing"); 519 TRACE_EVENT0("blink_gc", "Heap::globalWeakProcessing");
512 double startTime = WTF::currentTimeMS(); 520 double startTime = WTF::currentTimeMS();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 size_t Heap::s_wrapperCountAtLastGC = 0; 685 size_t Heap::s_wrapperCountAtLastGC = 0;
678 size_t Heap::s_collectedWrapperCount = 0; 686 size_t Heap::s_collectedWrapperCount = 0;
679 size_t Heap::s_partitionAllocSizeAtLastGC = 0; 687 size_t Heap::s_partitionAllocSizeAtLastGC = 0;
680 double Heap::s_estimatedMarkingTimePerByte = 0.0; 688 double Heap::s_estimatedMarkingTimePerByte = 0.0;
681 bool Heap::s_isLowEndDevice = false; 689 bool Heap::s_isLowEndDevice = false;
682 #if ENABLE(ASSERT) 690 #if ENABLE(ASSERT)
683 uint16_t Heap::s_gcGeneration = 0; 691 uint16_t Heap::s_gcGeneration = 0;
684 #endif 692 #endif
685 693
686 } // namespace blink 694 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.h ('k') | third_party/WebKit/Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698