V8 Project
v8::internal::SweeperThread Class Reference

#include <sweeper-thread.h>

+ Inheritance diagram for v8::internal::SweeperThread:
+ Collaboration diagram for v8::internal::SweeperThread:

Public Member Functions

 SweeperThread (Isolate *isolate)
 
 ~SweeperThread ()
 
void Run ()
 
void Stop ()
 
void StartSweeping ()
 
void WaitForSweeperThread ()
 
bool SweepingCompleted ()
 
- Public Member Functions inherited from v8::base::Thread
 Thread (const Options &options)
 
virtual ~Thread ()
 
void Start ()
 
void StartSynchronously ()
 
void Join ()
 
const char * name () const
 
PlatformDatadata ()
 
void NotifyStartedAndRun ()
 

Static Public Member Functions

static int NumberOfThreads (int max_available)
 
- Static Public Member Functions inherited from v8::base::Thread
static LocalStorageKey CreateThreadLocalKey ()
 
static void DeleteThreadLocalKey (LocalStorageKey key)
 
static void * GetThreadLocal (LocalStorageKey key)
 
static int GetThreadLocalInt (LocalStorageKey key)
 
static void SetThreadLocal (LocalStorageKey key, void *value)
 
static void SetThreadLocalInt (LocalStorageKey key, int value)
 
static bool HasThreadLocal (LocalStorageKey key)
 
static void * GetExistingThreadLocal (LocalStorageKey key)
 
static void YieldCPU ()
 

Private Attributes

Isolateisolate_
 
Heapheap_
 
MarkCompactCollectorcollector_
 
base::Semaphore start_sweeping_semaphore_
 
base::Semaphore end_sweeping_semaphore_
 
base::Semaphore stop_semaphore_
 
volatile base::AtomicWord stop_thread_
 

Additional Inherited Members

- Public Types inherited from v8::base::Thread
typedef int32_t LocalStorageKey
 
- Static Public Attributes inherited from v8::base::Thread
static const int kMaxThreadNameLength = 16
 

Detailed Description

Definition at line 20 of file sweeper-thread.h.

Constructor & Destructor Documentation

◆ SweeperThread()

v8::internal::SweeperThread::SweeperThread ( Isolate isolate)
explicit

Definition at line 17 of file sweeper-thread.cc.

18  : Thread(Thread::Options("v8:SweeperThread", kSweeperThreadStackSize)),
19  isolate_(isolate),
20  heap_(isolate->heap()),
24  stop_semaphore_(0) {
25  DCHECK(!FLAG_job_based_sweeping);
27 }
Thread(const Options &options)
MarkCompactCollector * mark_compact_collector()
Definition: heap.h:1197
volatile base::AtomicWord stop_thread_
base::Semaphore start_sweeping_semaphore_
base::Semaphore end_sweeping_semaphore_
base::Semaphore stop_semaphore_
MarkCompactCollector * collector_
#define DCHECK(condition)
Definition: logging.h:205
intptr_t AtomicWord
Definition: atomicops.h:57
void NoBarrier_Store(volatile Atomic8 *ptr, Atomic8 value)
static const int kSweeperThreadStackSize

References DCHECK, v8::base::NoBarrier_Store(), and stop_thread_.

+ Here is the call graph for this function:

◆ ~SweeperThread()

v8::internal::SweeperThread::~SweeperThread ( )
inline

Definition at line 23 of file sweeper-thread.h.

23 {}

Member Function Documentation

◆ NumberOfThreads()

int v8::internal::SweeperThread::NumberOfThreads ( int  max_available)
static

Definition at line 74 of file sweeper-thread.cc.

74  {
75  if (!FLAG_concurrent_sweeping && !FLAG_parallel_sweeping) return 0;
76  if (FLAG_sweeper_threads > 0) return FLAG_sweeper_threads;
77  if (FLAG_concurrent_sweeping) return max_available - 1;
78  DCHECK(FLAG_parallel_sweeping);
79  return max_available;
80 }

References DCHECK.

Referenced by v8::internal::Isolate::Init().

+ Here is the caller graph for this function:

◆ Run()

void v8::internal::SweeperThread::Run ( )
virtual

Implements v8::base::Thread.

Definition at line 30 of file sweeper-thread.cc.

30  {
32  DisallowHeapAllocation no_allocation;
33  DisallowHandleAllocation no_handles;
35 
36  while (true) {
38 
40  stop_semaphore_.Signal();
41  return;
42  }
43 
46  end_sweeping_semaphore_.Signal();
47  }
48 }
OldSpace * old_pointer_space()
Definition: heap.h:594
OldSpace * old_data_space()
Definition: heap.h:595
static void SetIsolateThreadLocals(Isolate *isolate, PerIsolateThreadData *data)
Definition: isolate.cc:1676
int SweepInParallel(PagedSpace *space, int required_freed_bytes)
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
Atomic32 Acquire_Load(volatile const Atomic32 *ptr)
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
Definition: assert-scope.h:110
PerThreadAssertScopeDebugOnly< HANDLE_DEREFERENCE_ASSERT, false > DisallowHandleDereference
Definition: assert-scope.h:118
PerThreadAssertScopeDebugOnly< HANDLE_ALLOCATION_ASSERT, false > DisallowHandleAllocation
Definition: assert-scope.h:102

References v8::base::Acquire_Load(), collector_, end_sweeping_semaphore_, heap_, isolate_, NULL, v8::internal::Heap::old_data_space(), v8::internal::Heap::old_pointer_space(), v8::internal::Isolate::SetIsolateThreadLocals(), start_sweeping_semaphore_, stop_semaphore_, stop_thread_, and v8::internal::MarkCompactCollector::SweepInParallel().

+ Here is the call graph for this function:

◆ StartSweeping()

void v8::internal::SweeperThread::StartSweeping ( )

Definition at line 59 of file sweeper-thread.cc.

59 { start_sweeping_semaphore_.Signal(); }

References start_sweeping_semaphore_.

Referenced by v8::internal::MarkCompactCollector::StartSweeperThreads().

+ Here is the caller graph for this function:

◆ Stop()

void v8::internal::SweeperThread::Stop ( )

Definition at line 51 of file sweeper-thread.cc.

51  {
54  stop_semaphore_.Wait();
55  Join();
56 }
void Release_Store(volatile Atomic32 *ptr, Atomic32 value)

References v8::base::Thread::Join(), v8::base::Release_Store(), start_sweeping_semaphore_, stop_semaphore_, and stop_thread_.

Referenced by v8::internal::Isolate::Deinit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SweepingCompleted()

bool v8::internal::SweeperThread::SweepingCompleted ( )

Definition at line 65 of file sweeper-thread.cc.

65  {
66  bool value = end_sweeping_semaphore_.WaitFor(base::TimeDelta::FromSeconds(0));
67  if (value) {
68  end_sweeping_semaphore_.Signal();
69  }
70  return value;
71 }

References end_sweeping_semaphore_.

Referenced by v8::internal::MarkCompactCollector::IsSweepingCompleted().

+ Here is the caller graph for this function:

◆ WaitForSweeperThread()

void v8::internal::SweeperThread::WaitForSweeperThread ( )

Definition at line 62 of file sweeper-thread.cc.

62 { end_sweeping_semaphore_.Wait(); }

References end_sweeping_semaphore_.

Referenced by v8::internal::MarkCompactCollector::EnsureSweepingCompleted().

+ Here is the caller graph for this function:

Member Data Documentation

◆ collector_

MarkCompactCollector* v8::internal::SweeperThread::collector_
private

Definition at line 36 of file sweeper-thread.h.

Referenced by Run().

◆ end_sweeping_semaphore_

base::Semaphore v8::internal::SweeperThread::end_sweeping_semaphore_
private

Definition at line 38 of file sweeper-thread.h.

Referenced by Run(), SweepingCompleted(), and WaitForSweeperThread().

◆ heap_

Heap* v8::internal::SweeperThread::heap_
private

Definition at line 35 of file sweeper-thread.h.

Referenced by Run().

◆ isolate_

Isolate* v8::internal::SweeperThread::isolate_
private

Definition at line 34 of file sweeper-thread.h.

Referenced by Run().

◆ start_sweeping_semaphore_

base::Semaphore v8::internal::SweeperThread::start_sweeping_semaphore_
private

Definition at line 37 of file sweeper-thread.h.

Referenced by Run(), StartSweeping(), and Stop().

◆ stop_semaphore_

base::Semaphore v8::internal::SweeperThread::stop_semaphore_
private

Definition at line 39 of file sweeper-thread.h.

Referenced by Run(), and Stop().

◆ stop_thread_

volatile base::AtomicWord v8::internal::SweeperThread::stop_thread_
private

Definition at line 40 of file sweeper-thread.h.

Referenced by Run(), Stop(), and SweeperThread().


The documentation for this class was generated from the following files: