2013-01-30 12:19:32 +00:00
|
|
|
// Copyright 2012 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2013-01-30 12:19:32 +00:00
|
|
|
|
|
|
|
#ifndef V8_SWEEPER_THREAD_H_
|
|
|
|
#define V8_SWEEPER_THREAD_H_
|
|
|
|
|
|
|
|
#include "atomicops.h"
|
|
|
|
#include "flags.h"
|
|
|
|
#include "platform.h"
|
2014-04-25 13:47:01 +00:00
|
|
|
#include "utils.h"
|
2013-01-30 12:19:32 +00:00
|
|
|
|
|
|
|
#include "spaces.h"
|
|
|
|
|
|
|
|
#include "heap.h"
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
class SweeperThread : public Thread {
|
|
|
|
public:
|
|
|
|
explicit SweeperThread(Isolate* isolate);
|
2013-09-02 12:26:06 +00:00
|
|
|
~SweeperThread() {}
|
2013-01-30 12:19:32 +00:00
|
|
|
|
|
|
|
void Run();
|
|
|
|
void Stop();
|
|
|
|
void StartSweeping();
|
|
|
|
void WaitForSweeperThread();
|
|
|
|
|
2013-11-19 11:52:47 +00:00
|
|
|
static int NumberOfThreads(int max_available);
|
|
|
|
|
2013-01-30 12:19:32 +00:00
|
|
|
private:
|
|
|
|
Isolate* isolate_;
|
|
|
|
Heap* heap_;
|
|
|
|
MarkCompactCollector* collector_;
|
2013-09-02 12:26:06 +00:00
|
|
|
Semaphore start_sweeping_semaphore_;
|
|
|
|
Semaphore end_sweeping_semaphore_;
|
|
|
|
Semaphore stop_semaphore_;
|
2013-01-30 12:19:32 +00:00
|
|
|
volatile AtomicWord stop_thread_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} } // namespace v8::internal
|
|
|
|
|
|
|
|
#endif // V8_SWEEPER_THREAD_H_
|