Revision: 21058
Author: [email protected]
Date: Tue Apr 29 14:17:42 2014 UTC
Log: Wait for sweeper threads in incremental marking step when sweeper
threads are done sweeping.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/252123006
http://code.google.com/p/v8/source/detail?r=21058
Modified:
/branches/bleeding_edge/src/incremental-marking.cc
/branches/bleeding_edge/src/mark-compact.cc
/branches/bleeding_edge/src/mark-compact.h
/branches/bleeding_edge/src/sweeper-thread.cc
/branches/bleeding_edge/src/sweeper-thread.h
=======================================
--- /branches/bleeding_edge/src/incremental-marking.cc Tue Apr 29 06:42:26
2014 UTC
+++ /branches/bleeding_edge/src/incremental-marking.cc Tue Apr 29 14:17:42
2014 UTC
@@ -886,6 +886,10 @@
}
if (state_ == SWEEPING) {
+ if (heap_->mark_compact_collector()->IsConcurrentSweepingInProgress()
&&
+ heap_->mark_compact_collector()->IsSweepingCompleted()) {
+ heap_->mark_compact_collector()->WaitUntilSweepingCompleted();
+ }
if
(!heap_->mark_compact_collector()->IsConcurrentSweepingInProgress()) {
bytes_scanned_ = 0;
StartMarking(PREVENT_COMPACTION);
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Tue Apr 29 11:01:42 2014 UTC
+++ /branches/bleeding_edge/src/mark-compact.cc Tue Apr 29 14:17:42 2014 UTC
@@ -606,6 +606,22 @@
heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes();
heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes();
}
+
+
+bool MarkCompactCollector::IsSweepingCompleted() {
+ for (int i = 0; i < isolate()->num_sweeper_threads(); i++) {
+ if (!isolate()->sweeper_threads()[i]->SweepingCompleted()) {
+ return false;
+ }
+ }
+ if (FLAG_job_based_sweeping) {
+ if
(!pending_sweeper_jobs_semaphore_.WaitFor(TimeDelta::FromSeconds(0))) {
+ return false;
+ }
+ pending_sweeper_jobs_semaphore_.Signal();
+ }
+ return true;
+}
void MarkCompactCollector::RefillFreeList(PagedSpace* space) {
=======================================
--- /branches/bleeding_edge/src/mark-compact.h Tue Apr 29 11:01:42 2014 UTC
+++ /branches/bleeding_edge/src/mark-compact.h Tue Apr 29 14:17:42 2014 UTC
@@ -671,6 +671,8 @@
void WaitUntilSweepingCompleted();
+ bool IsSweepingCompleted();
+
void RefillFreeList(PagedSpace* space);
bool AreSweeperThreadsActivated();
=======================================
--- /branches/bleeding_edge/src/sweeper-thread.cc Tue Apr 29 06:42:26 2014
UTC
+++ /branches/bleeding_edge/src/sweeper-thread.cc Tue Apr 29 14:17:42 2014
UTC
@@ -64,6 +64,15 @@
void SweeperThread::WaitForSweeperThread() {
end_sweeping_semaphore_.Wait();
}
+
+
+bool SweeperThread::SweepingCompleted() {
+ bool value = end_sweeping_semaphore_.WaitFor(TimeDelta::FromSeconds(0));
+ if (value) {
+ end_sweeping_semaphore_.Signal();
+ }
+ return value;
+}
int SweeperThread::NumberOfThreads(int max_available) {
=======================================
--- /branches/bleeding_edge/src/sweeper-thread.h Tue Apr 29 06:42:26 2014
UTC
+++ /branches/bleeding_edge/src/sweeper-thread.h Tue Apr 29 14:17:42 2014
UTC
@@ -26,6 +26,7 @@
void Stop();
void StartSweeping();
void WaitForSweeperThread();
+ bool SweepingCompleted();
static int NumberOfThreads(int max_available);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.