Commit e12f9a11 authored by ulan's avatar ulan Committed by Commit bot

[heap] Do not wait for marking deque uncommit task on tear down.

Cancelable task already guarantees proper waiting.

BUG=

Review-Url: https://codereview.chromium.org/2462553002
Cr-Commit-Position: refs/heads/master@{#40647}
parent aff3ef21
......@@ -2119,7 +2119,6 @@ void MarkingDeque::SetUp() {
}
void MarkingDeque::TearDown() {
CancelOrWaitForUncommitTask();
delete backing_store_;
}
......@@ -2187,26 +2186,13 @@ void MarkingDeque::EnsureCommitted() {
void MarkingDeque::StartUncommitTask() {
if (!uncommit_task_pending_) {
UncommitTask* task = new UncommitTask(heap_->isolate(), this);
uncommit_task_id_ = task->id();
uncommit_task_pending_ = true;
UncommitTask* task = new UncommitTask(heap_->isolate(), this);
V8::GetCurrentPlatform()->CallOnBackgroundThread(
task, v8::Platform::kShortRunningTask);
}
}
void MarkingDeque::CancelOrWaitForUncommitTask() {
base::LockGuard<base::Mutex> guard(&mutex_);
if (!uncommit_task_pending_ ||
heap_->isolate()->cancelable_task_manager()->TryAbort(
uncommit_task_id_) != CancelableTaskManager::kTaskRunning) {
return;
}
while (uncommit_task_pending_) {
uncommit_task_barrier_.Wait(&mutex_);
}
}
class MarkCompactCollector::ObjectStatsVisitor
: public MarkCompactCollector::HeapObjectVisitor {
public:
......
......@@ -64,7 +64,6 @@ class MarkingDeque {
overflowed_(false),
in_use_(false),
uncommit_task_pending_(false),
uncommit_task_id_(0),
heap_(heap) {}
void SetUp();
......@@ -144,7 +143,6 @@ class MarkingDeque {
marking_deque_->Uncommit();
}
marking_deque_->uncommit_task_pending_ = false;
marking_deque_->uncommit_task_barrier_.NotifyOne();
}
MarkingDeque* marking_deque_;
......@@ -163,10 +161,7 @@ class MarkingDeque {
// Must be called with mutex lock.
void StartUncommitTask();
void CancelOrWaitForUncommitTask();
base::Mutex mutex_;
base::ConditionVariable uncommit_task_barrier_;
base::VirtualMemory* backing_store_;
size_t backing_store_committed_size_;
......@@ -182,7 +177,6 @@ class MarkingDeque {
// committed and will stay committed at least until in_use_ == false.
bool in_use_;
bool uncommit_task_pending_;
uint32_t uncommit_task_id_;
Heap* heap_;
DISALLOW_COPY_AND_ASSIGN(MarkingDeque);
......
......@@ -69,6 +69,7 @@ TEST(MarkingDeque) {
CHECK_EQ(original_address, current_address);
s.StopUsing();
CcTest::i_isolate()->cancelable_task_manager()->CancelAndWait();
s.TearDown();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment