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

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

Issue 1689823003: Revert of Oilpan: Decommit backing storage of CallbackStacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 348 }
349 349
350 #if ENABLE(ASSERT) 350 #if ENABLE(ASSERT)
351 bool Heap::weakTableRegistered(const void* table) 351 bool Heap::weakTableRegistered(const void* table)
352 { 352 {
353 ASSERT(s_ephemeronStack); 353 ASSERT(s_ephemeronStack);
354 return s_ephemeronStack->hasCallbackForObject(table); 354 return s_ephemeronStack->hasCallbackForObject(table);
355 } 355 }
356 #endif 356 #endif
357 357
358 void Heap::decommitCallbackStacks()
359 {
360 s_markingStack->decommit();
361 s_postMarkingCallbackStack->decommit();
362 s_globalWeakCallbackStack->decommit();
363 s_ephemeronStack->decommit();
364 }
365
366 void Heap::preGC() 358 void Heap::preGC()
367 { 359 {
368 ASSERT(!ThreadState::current()->isInGC()); 360 ASSERT(!ThreadState::current()->isInGC());
369 for (ThreadState* state : ThreadState::attachedThreads()) 361 for (ThreadState* state : ThreadState::attachedThreads())
370 state->preGC(); 362 state->preGC();
371 } 363 }
372 364
373 void Heap::postGC(BlinkGC::GCType gcType) 365 void Heap::postGC(BlinkGC::GCType gcType)
374 { 366 {
375 ASSERT(ThreadState::current()->isInGC()); 367 ASSERT(ThreadState::current()->isInGC());
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 totalObjectSpaceHistogram.count(Heap::allocatedObjectSize() / 1024); 462 totalObjectSpaceHistogram.count(Heap::allocatedObjectSize() / 1024);
471 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, totalAllocatedSpaceHis togram, new CustomCountHistogram("BlinkGC.TotalAllocatedSpace", 0, 4 * 1024 * 10 24, 50)); 463 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, totalAllocatedSpaceHis togram, new CustomCountHistogram("BlinkGC.TotalAllocatedSpace", 0, 4 * 1024 * 10 24, 50));
472 totalAllocatedSpaceHistogram.count(Heap::allocatedSpace() / 1024); 464 totalAllocatedSpaceHistogram.count(Heap::allocatedSpace() / 1024);
473 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, gcReasonHistogram, new EnumerationHistogram("BlinkGC.GCReason", BlinkGC::NumberOfGCReason)); 465 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, gcReasonHistogram, new EnumerationHistogram("BlinkGC.GCReason", BlinkGC::NumberOfGCReason));
474 gcReasonHistogram.count(reason); 466 gcReasonHistogram.count(reason);
475 467
476 Heap::reportMemoryUsageHistogram(); 468 Heap::reportMemoryUsageHistogram();
477 WTF::Partitions::reportMemoryUsageHistogram(); 469 WTF::Partitions::reportMemoryUsageHistogram();
478 470
479 postGC(gcType); 471 postGC(gcType);
480 Heap::decommitCallbackStacks();
481 472
482 #if ENABLE(ASSERT) 473 #if ENABLE(ASSERT)
483 // 0 is used to figure non-assigned area, so avoid to use 0 in s_gcGeneratio n. 474 // 0 is used to figure non-assigned area, so avoid to use 0 in s_gcGeneratio n.
484 if (++s_gcGeneration == 0) { 475 if (++s_gcGeneration == 0) {
485 s_gcGeneration = 1; 476 s_gcGeneration = 1;
486 } 477 }
487 #endif 478 #endif
488 } 479 }
489 480
490 void Heap::collectGarbageForTerminatingThread(ThreadState* state) 481 void Heap::collectGarbageForTerminatingThread(ThreadState* state)
(...skipping 22 matching lines...) Expand all
513 state->visitPersistents(gcScope.visitor()); 504 state->visitPersistents(gcScope.visitor());
514 505
515 // 2. Trace objects reachable from the thread's persistent roots 506 // 2. Trace objects reachable from the thread's persistent roots
516 // including ephemerons. 507 // including ephemerons.
517 processMarkingStack(gcScope.visitor()); 508 processMarkingStack(gcScope.visitor());
518 509
519 postMarkingProcessing(gcScope.visitor()); 510 postMarkingProcessing(gcScope.visitor());
520 globalWeakProcessing(gcScope.visitor()); 511 globalWeakProcessing(gcScope.visitor());
521 512
522 state->postGC(BlinkGC::GCWithSweep); 513 state->postGC(BlinkGC::GCWithSweep);
523 Heap::decommitCallbackStacks();
524 } 514 }
525 state->preSweep(); 515 state->preSweep();
526 } 516 }
527 517
528 void Heap::processMarkingStack(Visitor* visitor) 518 void Heap::processMarkingStack(Visitor* visitor)
529 { 519 {
530 // Ephemeron fixed point loop. 520 // Ephemeron fixed point loop.
531 do { 521 do {
532 { 522 {
533 // Iteratively mark all objects that are reachable from the objects 523 // Iteratively mark all objects that are reachable from the objects
(...skipping 16 matching lines...) Expand all
550 void Heap::postMarkingProcessing(Visitor* visitor) 540 void Heap::postMarkingProcessing(Visitor* visitor)
551 { 541 {
552 TRACE_EVENT0("blink_gc", "Heap::postMarkingProcessing"); 542 TRACE_EVENT0("blink_gc", "Heap::postMarkingProcessing");
553 // Call post-marking callbacks including: 543 // Call post-marking callbacks including:
554 // 1. the ephemeronIterationDone callbacks on weak tables to do cleanup 544 // 1. the ephemeronIterationDone callbacks on weak tables to do cleanup
555 // (specifically to clear the queued bits for weak hash tables), and 545 // (specifically to clear the queued bits for weak hash tables), and
556 // 2. the markNoTracing callbacks on collection backings to mark them 546 // 2. the markNoTracing callbacks on collection backings to mark them
557 // if they are only reachable from their front objects. 547 // if they are only reachable from their front objects.
558 while (popAndInvokePostMarkingCallback(visitor)) { } 548 while (popAndInvokePostMarkingCallback(visitor)) { }
559 549
550 s_ephemeronStack->clear();
551
560 // Post-marking callbacks should not trace any objects and 552 // Post-marking callbacks should not trace any objects and
561 // therefore the marking stack should be empty after the 553 // therefore the marking stack should be empty after the
562 // post-marking callbacks. 554 // post-marking callbacks.
563 ASSERT(s_markingStack->isEmpty()); 555 ASSERT(s_markingStack->isEmpty());
564 } 556 }
565 557
566 void Heap::globalWeakProcessing(Visitor* visitor) 558 void Heap::globalWeakProcessing(Visitor* visitor)
567 { 559 {
568 TRACE_EVENT0("blink_gc", "Heap::globalWeakProcessing"); 560 TRACE_EVENT0("blink_gc", "Heap::globalWeakProcessing");
569 double startTime = WTF::currentTimeMS(); 561 double startTime = WTF::currentTimeMS();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 size_t Heap::s_wrapperCountAtLastGC = 0; 726 size_t Heap::s_wrapperCountAtLastGC = 0;
735 size_t Heap::s_collectedWrapperCount = 0; 727 size_t Heap::s_collectedWrapperCount = 0;
736 size_t Heap::s_partitionAllocSizeAtLastGC = 0; 728 size_t Heap::s_partitionAllocSizeAtLastGC = 0;
737 double Heap::s_estimatedMarkingTimePerByte = 0.0; 729 double Heap::s_estimatedMarkingTimePerByte = 0.0;
738 bool Heap::s_isLowEndDevice = false; 730 bool Heap::s_isLowEndDevice = false;
739 #if ENABLE(ASSERT) 731 #if ENABLE(ASSERT)
740 uint16_t Heap::s_gcGeneration = 0; 732 uint16_t Heap::s_gcGeneration = 0;
741 #endif 733 #endif
742 734
743 } // namespace blink 735 } // 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