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

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

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
« no previous file with comments | « no previous file | src/heap/mark-compact.cc » ('j') | src/heap/mark-compact.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.h
diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h
index 7203ad05c0eda3e9afb309149d725cc066930191..a13fb9f73e0de3b814f9b27f330d11e5fa57154b 100644
--- a/src/heap/mark-compact.h
+++ b/src/heap/mark-compact.h
@@ -8,6 +8,7 @@
#include <deque>
#include "src/base/bits.h"
+#include "src/base/platform/condition-variable.h"
#include "src/heap/marking.h"
#include "src/heap/spaces.h"
#include "src/heap/store-buffer.h"
@@ -60,7 +61,8 @@ class MarkingDeque {
bottom_(0),
mask_(0),
overflowed_(false),
- in_use_(false) {}
+ in_use_(false),
+ uncommit_task_pending_(false) {}
void SetUp();
void TearDown();
@@ -122,12 +124,43 @@ class MarkingDeque {
void set_top(int top) { top_ = top; }
private:
+ class UncommitTask : public v8::Task {
+ public:
+ explicit UncommitTask(MarkingDeque* marking_deque)
+ : marking_deque_(marking_deque) {}
+
+ private:
+ // v8::Task overrides.
+ void Run() override {
+ base::LockGuard<base::Mutex> guard(&marking_deque_->mutex_);
+ if (!marking_deque_->in_use_) {
Michael Lippautz 2016/10/24 08:43:23 Can you somewhere document with a comment that in_
ulan 2016/10/24 13:14:09 Done.
+ marking_deque_->Uncommit();
+ }
+ marking_deque_->uncommit_task_pending_ = false;
+ marking_deque_->uncommit_task_barrier_.NotifyOne();
+ }
+
+ MarkingDeque* marking_deque_;
+ DISALLOW_COPY_AND_ASSIGN(UncommitTask);
+ };
+
static const size_t kMaxSize = 4 * MB;
static const size_t kMinSize = 256 * KB;
+ // Must be called with mutex lock.
void EnsureCommitted();
+
+ // Must be called with mutex lock.
void Uncommit();
+ // Must be called with mutex lock.
+ void StartUncommitTask();
+
+ void WaitForUncommitTask();
+
+ base::Mutex mutex_;
+ base::ConditionVariable uncommit_task_barrier_;
+
base::VirtualMemory* backing_store_;
size_t backing_store_committed_size_;
HeapObject** array_;
@@ -139,6 +172,7 @@ class MarkingDeque {
int mask_;
bool overflowed_;
bool in_use_;
+ bool uncommit_task_pending_;
DISALLOW_COPY_AND_ASSIGN(MarkingDeque);
};
« no previous file with comments | « no previous file | src/heap/mark-compact.cc » ('j') | src/heap/mark-compact.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698