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 2013173002: Lock CrossThreadPersistentRegion until end of weak processing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile fix 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 ThreadState::NoAllocationScope noAllocationScope(state); 509 ThreadState::NoAllocationScope noAllocationScope(state);
510 510
511 state->heap().preGC(); 511 state->heap().preGC();
512 512
513 StackFrameDepthScope stackDepthScope; 513 StackFrameDepthScope stackDepthScope;
514 514
515 size_t totalObjectSize = state->heap().heapStats().allocatedObjectSize() + s tate->heap().heapStats().markedObjectSize(); 515 size_t totalObjectSize = state->heap().heapStats().allocatedObjectSize() + s tate->heap().heapStats().markedObjectSize();
516 if (gcType != BlinkGC::TakeSnapshot) 516 if (gcType != BlinkGC::TakeSnapshot)
517 state->heap().resetHeapCounters(); 517 state->heap().resetHeapCounters();
518 518
519 // 1. Trace persistent roots. 519 {
520 state->heap().visitPersistentRoots(visitor.get()); 520 // Access to the CrossThreadPersistentRegion has to be prevented while
521 // marking and global weak processing is in progress. If not, threads
522 // not attached to Oilpan and participating in this GC are able
523 // to allocate & free PersistentNodes, something the marking phase isn't
524 // capable of handling.
525 CrossThreadPersistentRegion::LockScope persistentLock(ProcessHeap::cross ThreadPersistentRegion());
521 526
522 // 2. Trace objects reachable from the stack. We do this independent of the 527 // 1. Trace persistent roots.
523 // given stackState since other threads might have a different stack state. 528 state->heap().visitPersistentRoots(visitor.get());
524 state->heap().visitStackRoots(visitor.get());
525 529
526 // 3. Transitive closure to trace objects including ephemerons. 530 // 2. Trace objects reachable from the stack. We do this independent of the
527 state->heap().processMarkingStack(visitor.get()); 531 // given stackState since other threads might have a different stack sta te.
532 state->heap().visitStackRoots(visitor.get());
528 533
529 state->heap().postMarkingProcessing(visitor.get()); 534 // 3. Transitive closure to trace objects including ephemerons.
530 state->heap().globalWeakProcessing(visitor.get()); 535 state->heap().processMarkingStack(visitor.get());
536
537 state->heap().postMarkingProcessing(visitor.get());
538 state->heap().globalWeakProcessing(visitor.get());
539 }
531 540
532 // Now we can delete all orphaned pages because there are no dangling 541 // Now we can delete all orphaned pages because there are no dangling
533 // pointers to the orphaned pages. (If we have such dangling pointers, 542 // pointers to the orphaned pages. (If we have such dangling pointers,
534 // we should have crashed during marking before getting here.) 543 // we should have crashed during marking before getting here.)
535 state->heap().getOrphanedPagePool()->decommitOrphanedPages(); 544 state->heap().getOrphanedPagePool()->decommitOrphanedPages();
536 545
537 double markingTimeInMilliseconds = WTF::currentTimeMS() - startTime; 546 double markingTimeInMilliseconds = WTF::currentTimeMS() - startTime;
538 state->heap().heapStats().setEstimatedMarkingTimePerByte(totalObjectSize ? ( markingTimeInMilliseconds / 1000 / totalObjectSize) : 0); 547 state->heap().heapStats().setEstimatedMarkingTimePerByte(totalObjectSize ? ( markingTimeInMilliseconds / 1000 / totalObjectSize) : 0);
539 548
540 #if PRINT_HEAP_STATS 549 #if PRINT_HEAP_STATS
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); 792 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize());
784 793
785 m_stats.reset(); 794 m_stats.reset();
786 for (ThreadState* state : m_threads) 795 for (ThreadState* state : m_threads)
787 state->resetHeapCounters(); 796 state->resetHeapCounters();
788 } 797 }
789 798
790 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; 799 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr;
791 800
792 } // namespace blink 801 } // 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