V8 Project
v8::platform::TaskQueue Class Reference

#include <task-queue.h>

+ Collaboration diagram for v8::platform::TaskQueue:

Public Member Functions

 TaskQueue ()
 
 ~TaskQueue ()
 
void Append (Task *task)
 
TaskGetNext ()
 
void Terminate ()
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (TaskQueue)
 

Private Attributes

base::Mutex lock_
 
base::Semaphore process_queue_semaphore_
 
std::queue< Task * > task_queue_
 
bool terminated_
 

Detailed Description

Definition at line 20 of file task-queue.h.

Constructor & Destructor Documentation

◆ TaskQueue()

v8::platform::TaskQueue::TaskQueue ( )

Definition at line 12 of file task-queue.cc.

base::Semaphore process_queue_semaphore_
Definition: task-queue.h:37

◆ ~TaskQueue()

v8::platform::TaskQueue::~TaskQueue ( )

Definition at line 15 of file task-queue.cc.

15  {
16  base::LockGuard<base::Mutex> guard(&lock_);
18  DCHECK(task_queue_.empty());
19 }
std::queue< Task * > task_queue_
Definition: task-queue.h:38
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, lock_, task_queue_, and terminated_.

Member Function Documentation

◆ Append()

void v8::platform::TaskQueue::Append ( Task task)

Definition at line 22 of file task-queue.cc.

22  {
23  base::LockGuard<base::Mutex> guard(&lock_);
25  task_queue_.push(task);
26  process_queue_semaphore_.Signal();
27 }

References DCHECK, lock_, process_queue_semaphore_, task_queue_, and terminated_.

Referenced by v8::platform::DefaultPlatform::CallOnBackgroundThread(), and v8::platform::TEST().

+ Here is the caller graph for this function:

◆ DISALLOW_COPY_AND_ASSIGN()

v8::platform::TaskQueue::DISALLOW_COPY_AND_ASSIGN ( TaskQueue  )
private

◆ GetNext()

Task * v8::platform::TaskQueue::GetNext ( )

Definition at line 30 of file task-queue.cc.

30  {
31  for (;;) {
32  {
33  base::LockGuard<base::Mutex> guard(&lock_);
34  if (!task_queue_.empty()) {
35  Task* result = task_queue_.front();
36  task_queue_.pop();
37  return result;
38  }
39  if (terminated_) {
40  process_queue_semaphore_.Signal();
41  return NULL;
42  }
43  }
45  }
46 }
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

References lock_, NULL, process_queue_semaphore_, task_queue_, and terminated_.

Referenced by v8::platform::WorkerThread::Run(), and v8::platform::TEST().

+ Here is the caller graph for this function:

◆ Terminate()

void v8::platform::TaskQueue::Terminate ( )

Definition at line 49 of file task-queue.cc.

49  {
50  base::LockGuard<base::Mutex> guard(&lock_);
52  terminated_ = true;
53  process_queue_semaphore_.Signal();
54 }

References DCHECK, lock_, process_queue_semaphore_, and terminated_.

Referenced by v8::platform::TEST(), and v8::platform::DefaultPlatform::~DefaultPlatform().

+ Here is the caller graph for this function:

Member Data Documentation

◆ lock_

base::Mutex v8::platform::TaskQueue::lock_
private

Definition at line 36 of file task-queue.h.

Referenced by Append(), GetNext(), Terminate(), and ~TaskQueue().

◆ process_queue_semaphore_

base::Semaphore v8::platform::TaskQueue::process_queue_semaphore_
private

Definition at line 37 of file task-queue.h.

Referenced by Append(), GetNext(), and Terminate().

◆ task_queue_

std::queue<Task*> v8::platform::TaskQueue::task_queue_
private

Definition at line 38 of file task-queue.h.

Referenced by Append(), GetNext(), and ~TaskQueue().

◆ terminated_

bool v8::platform::TaskQueue::terminated_
private

Definition at line 39 of file task-queue.h.

Referenced by Append(), GetNext(), Terminate(), and ~TaskQueue().


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