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

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

Issue 2065343002: Lock CrossThreadPersistentRegion until end of weak processing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 6 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/platform/heap/PersistentNode.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) 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 ThreadState::NoAllocationScope noAllocationScope(state); 456 ThreadState::NoAllocationScope noAllocationScope(state);
457 457
458 preGC(); 458 preGC();
459 459
460 StackFrameDepthScope stackDepthScope; 460 StackFrameDepthScope stackDepthScope;
461 461
462 size_t totalObjectSize = Heap::heapStats().allocatedObjectSize() + Heap::hea pStats().markedObjectSize(); 462 size_t totalObjectSize = Heap::heapStats().allocatedObjectSize() + Heap::hea pStats().markedObjectSize();
463 if (gcType != BlinkGC::TakeSnapshot) 463 if (gcType != BlinkGC::TakeSnapshot)
464 Heap::resetHeapCounters(); 464 Heap::resetHeapCounters();
465 465
466 // 1. Trace persistent roots. 466 {
467 ThreadState::visitPersistentRoots(visitor.get()); 467 // Access to the CrossThreadPersistentRegion has to be prevented while
468 // marking and global weak processing is in progress. If not, threads
469 // not attached to Oilpan and participating in this GC are able
470 // to allocate & free PersistentNodes, something the marking phase isn't
471 // capable of handling.
472 CrossThreadPersistentRegion::LockScope persistentLock(ProcessHeap::cross ThreadPersistentRegion());
468 473
469 // 2. Trace objects reachable from the stack. We do this independent of the 474 // 1. Trace persistent roots.
470 // given stackState since other threads might have a different stack state. 475 ThreadState::visitPersistentRoots(visitor.get());
471 ThreadState::visitStackRoots(visitor.get());
472 476
473 // 3. Transitive closure to trace objects including ephemerons. 477 // 2. Trace objects reachable from the stack. We do this independent of the
474 processMarkingStack(visitor.get()); 478 // given stackState since other threads might have a different stack sta te.
479 ThreadState::visitStackRoots(visitor.get());
475 480
476 postMarkingProcessing(visitor.get()); 481 // 3. Transitive closure to trace objects including ephemerons.
477 globalWeakProcessing(visitor.get()); 482 processMarkingStack(visitor.get());
483
484 postMarkingProcessing(visitor.get());
485 globalWeakProcessing(visitor.get());
486 }
478 487
479 // Now we can delete all orphaned pages because there are no dangling 488 // Now we can delete all orphaned pages because there are no dangling
480 // pointers to the orphaned pages. (If we have such dangling pointers, 489 // pointers to the orphaned pages. (If we have such dangling pointers,
481 // we should have crashed during marking before getting here.) 490 // we should have crashed during marking before getting here.)
482 getOrphanedPagePool()->decommitOrphanedPages(); 491 getOrphanedPagePool()->decommitOrphanedPages();
483 492
484 double markingTimeInMilliseconds = WTF::currentTimeMS() - startTime; 493 double markingTimeInMilliseconds = WTF::currentTimeMS() - startTime;
485 Heap::heapStats().setEstimatedMarkingTimePerByte(totalObjectSize ? (markingT imeInMilliseconds / 1000 / totalObjectSize) : 0); 494 Heap::heapStats().setEstimatedMarkingTimePerByte(totalObjectSize ? (markingT imeInMilliseconds / 1000 / totalObjectSize) : 0);
486 495
487 #if PRINT_HEAP_STATS 496 #if PRINT_HEAP_STATS
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 CallbackStack* Heap::s_postMarkingCallbackStack; 720 CallbackStack* Heap::s_postMarkingCallbackStack;
712 CallbackStack* Heap::s_globalWeakCallbackStack; 721 CallbackStack* Heap::s_globalWeakCallbackStack;
713 CallbackStack* Heap::s_ephemeronStack; 722 CallbackStack* Heap::s_ephemeronStack;
714 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; 723 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache;
715 FreePagePool* Heap::s_freePagePool; 724 FreePagePool* Heap::s_freePagePool;
716 OrphanedPagePool* Heap::s_orphanedPagePool; 725 OrphanedPagePool* Heap::s_orphanedPagePool;
717 726
718 BlinkGC::GCReason Heap::s_lastGCReason = BlinkGC::NumberOfGCReason; 727 BlinkGC::GCReason Heap::s_lastGCReason = BlinkGC::NumberOfGCReason;
719 728
720 } // namespace blink 729 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/PersistentNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698