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

Unified Diff: src/heap/mark-compact.cc

Issue 2852953004: [heap] Extract marking deque to separate file. (Closed)
Patch Set: fix build.gn Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/sequential-marking-deque.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 55f4d75e1056a3dc8682704bd19398ee1b0b9f94..5c11183b00eaefdeae5134435a4ddbe8b2bc08e2 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -2245,90 +2245,6 @@ void MarkCompactCollector::ProcessTopOptimizedFrame(
}
}
-void MarkingDeque::SetUp() {
- backing_store_ = new base::VirtualMemory(kMaxSize);
- backing_store_committed_size_ = 0;
- if (backing_store_ == nullptr) {
- V8::FatalProcessOutOfMemory("MarkingDeque::SetUp");
- }
-}
-
-void MarkingDeque::TearDown() {
- delete backing_store_;
-}
-
-void MarkingDeque::StartUsing() {
- base::LockGuard<base::Mutex> guard(&mutex_);
- if (in_use_) {
- // This can happen in mark-compact GC if the incremental marker already
- // started using the marking deque.
- return;
- }
- in_use_ = true;
- EnsureCommitted();
- array_ = reinterpret_cast<HeapObject**>(backing_store_->address());
- size_t size = FLAG_force_marking_deque_overflows
- ? 64 * kPointerSize
- : backing_store_committed_size_;
- DCHECK(
- base::bits::IsPowerOfTwo32(static_cast<uint32_t>(size / kPointerSize)));
- mask_ = static_cast<int>((size / kPointerSize) - 1);
- top_ = bottom_ = 0;
- overflowed_ = false;
-}
-
-void MarkingDeque::StopUsing() {
- base::LockGuard<base::Mutex> guard(&mutex_);
- if (!in_use_) return;
- DCHECK(IsEmpty());
- DCHECK(!overflowed_);
- top_ = bottom_ = mask_ = 0;
- in_use_ = false;
- if (FLAG_concurrent_sweeping) {
- StartUncommitTask();
- } else {
- Uncommit();
- }
-}
-
-void MarkingDeque::Clear() {
- DCHECK(in_use_);
- top_ = bottom_ = 0;
- overflowed_ = false;
-}
-
-void MarkingDeque::Uncommit() {
- DCHECK(!in_use_);
- bool success = backing_store_->Uncommit(backing_store_->address(),
- backing_store_committed_size_);
- backing_store_committed_size_ = 0;
- CHECK(success);
-}
-
-void MarkingDeque::EnsureCommitted() {
- DCHECK(in_use_);
- if (backing_store_committed_size_ > 0) return;
-
- for (size_t size = kMaxSize; size >= kMinSize; size /= 2) {
- if (backing_store_->Commit(backing_store_->address(), size, false)) {
- backing_store_committed_size_ = size;
- break;
- }
- }
- if (backing_store_committed_size_ == 0) {
- V8::FatalProcessOutOfMemory("MarkingDeque::EnsureCommitted");
- }
-}
-
-void MarkingDeque::StartUncommitTask() {
- if (!uncommit_task_pending_) {
- uncommit_task_pending_ = true;
- UncommitTask* task = new UncommitTask(heap_->isolate(), this);
- V8::GetCurrentPlatform()->CallOnBackgroundThread(
- task, v8::Platform::kShortRunningTask);
- }
-}
-
class ObjectStatsVisitor : public HeapObjectVisitor {
public:
ObjectStatsVisitor(Heap* heap, ObjectStats* live_stats,
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/sequential-marking-deque.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698