Index: src/sweeper-thread.h |
diff --git a/src/platform-posix.h b/src/sweeper-thread.h |
similarity index 58% |
copy from src/platform-posix.h |
copy to src/sweeper-thread.h |
index 7a982ed2ef3080dad77860d6f46b356a9067bf3b..ba793c2043bd2724132bb7ab4dbaafcd55044468 100644 |
--- a/src/platform-posix.h |
+++ b/src/sweeper-thread.h |
@@ -25,15 +25,57 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-#ifndef V8_PLATFORM_POSIX_H_ |
-#define V8_PLATFORM_POSIX_H_ |
+#ifndef V8_SWEEPER_THREAD_H_ |
+#define V8_SWEEPER_THREAD_H_ |
+ |
+#include "atomicops.h" |
+#include "flags.h" |
+#include "platform.h" |
+#include "v8utils.h" |
+ |
+#include "spaces.h" |
+ |
+#include "heap.h" |
namespace v8 { |
namespace internal { |
-// Used by platform implementation files during OS::PostSetUp(). |
-void POSIXPostSetUp(); |
+class SweeperThread : public Thread { |
+ public: |
+ explicit SweeperThread(Isolate* isolate); |
+ |
+ void Run(); |
+ void Stop(); |
+ void StartSweeping(); |
+ void WaitForSweeperThread(); |
+ intptr_t StealMemory(PagedSpace* space); |
+ |
+ static bool sweeping_pending() { return sweeping_pending_; } |
+ static void set_sweeping_pending(bool sweeping_pending) { |
+ sweeping_pending_ = sweeping_pending; |
+ } |
+ |
+ ~SweeperThread() { |
+ delete start_sweeping_semaphore_; |
+ delete end_sweeping_semaphore_; |
+ delete stop_semaphore_; |
+ } |
+ |
+ private: |
+ Isolate* isolate_; |
+ Heap* heap_; |
+ MarkCompactCollector* collector_; |
+ Semaphore* start_sweeping_semaphore_; |
+ Semaphore* end_sweeping_semaphore_; |
+ Semaphore* stop_semaphore_; |
+ FreeList free_list_old_data_space_; |
+ FreeList free_list_old_pointer_space_; |
+ FreeList private_free_list_old_data_space_; |
+ FreeList private_free_list_old_pointer_space_; |
+ volatile AtomicWord stop_thread_; |
+ static bool sweeping_pending_; |
+}; |
} } // namespace v8::internal |
-#endif // V8_PLATFORM_POSIX_H_ |
+#endif // V8_SWEEPER_THREAD_H_ |