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

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

Issue 2442443003: [heap] Uncommit marking deque in concurrent task. (Closed)
Patch Set: x Created 4 years, 2 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
« src/heap/mark-compact.h ('K') | « src/heap/mark-compact.h ('k') | no next file » | 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 4c12ec05dee7c0a5682f8cca8d43c6b462c39a8e..0463657eafdb83df61af9f7f8fb43c9b246a48a3 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -2115,9 +2115,13 @@ void MarkingDeque::SetUp() {
}
}
-void MarkingDeque::TearDown() { delete backing_store_; }
+void MarkingDeque::TearDown() {
+ WaitForUncommitTask();
Michael Lippautz 2016/10/24 08:43:23 Maybe for future: Afaik, background tasks provide
ulan 2016/10/24 13:14:09 I made the task cancelable.
+ 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.
@@ -2137,11 +2141,16 @@ void MarkingDeque::StartUsing() {
}
void MarkingDeque::StopUsing() {
+ base::LockGuard<base::Mutex> guard(&mutex_);
DCHECK(IsEmpty());
DCHECK(!overflowed_);
top_ = bottom_ = mask_ = 0;
- Uncommit();
in_use_ = false;
+ if (FLAG_concurrent_sweeping) {
+ StartUncommitTask();
+ } else {
+ Uncommit();
+ }
}
void MarkingDeque::Clear() {
@@ -2151,7 +2160,7 @@ void MarkingDeque::Clear() {
}
void MarkingDeque::Uncommit() {
- DCHECK(in_use_);
+ DCHECK(!in_use_);
bool success = backing_store_->Uncommit(backing_store_->address(),
backing_store_committed_size_);
backing_store_committed_size_ = 0;
@@ -2173,6 +2182,21 @@ void MarkingDeque::EnsureCommitted() {
}
}
+void MarkingDeque::StartUncommitTask() {
+ if (!uncommit_task_pending_) {
+ uncommit_task_pending_ = true;
+ V8::GetCurrentPlatform()->CallOnBackgroundThread(
+ new UncommitTask(this), v8::Platform::kShortRunningTask);
+ }
+}
+
+void MarkingDeque::WaitForUncommitTask() {
+ base::LockGuard<base::Mutex> guard(&mutex_);
+ while (uncommit_task_pending_) {
+ uncommit_task_barrier_.Wait(&mutex_);
+ }
+}
+
class MarkCompactCollector::ObjectStatsVisitor
: public MarkCompactCollector::HeapObjectVisitor {
public:
« src/heap/mark-compact.h ('K') | « src/heap/mark-compact.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698