V8 Project
|
#include <optimizing-compiler-thread.h>
Public Member Functions | |
OptimizingCompilerThread (Isolate *isolate) | |
~OptimizingCompilerThread () | |
void | Run () |
void | Stop () |
void | Flush () |
void | QueueForOptimization (OptimizedCompileJob *optimizing_compiler) |
void | Unblock () |
void | InstallOptimizedFunctions () |
OptimizedCompileJob * | FindReadyOSRCandidate (Handle< JSFunction > function, BailoutId osr_ast_id) |
bool | IsQueuedForOSR (Handle< JSFunction > function, BailoutId osr_ast_id) |
bool | IsQueuedForOSR (JSFunction *function) |
bool | IsQueueAvailable () |
void | AgeBufferedOsrJobs () |
![]() | |
Thread (const Options &options) | |
virtual | ~Thread () |
void | Start () |
void | StartSynchronously () |
void | Join () |
const char * | name () const |
PlatformData * | data () |
void | NotifyStartedAndRun () |
Static Public Member Functions | |
static bool | Enabled (int max_available) |
![]() | |
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 Types | |
enum | StopFlag { CONTINUE , STOP , FLUSH } |
Private Member Functions | |
void | FlushInputQueue (bool restore_function_code) |
void | FlushOutputQueue (bool restore_function_code) |
void | FlushOsrBuffer (bool restore_function_code) |
void | CompileNext () |
OptimizedCompileJob * | NextInput () |
void | AddToOsrBuffer (OptimizedCompileJob *compiler) |
int | InputQueueIndex (int i) |
Private Attributes | |
Isolate * | isolate_ |
base::Semaphore | stop_semaphore_ |
base::Semaphore | input_queue_semaphore_ |
OptimizedCompileJob ** | input_queue_ |
int | input_queue_capacity_ |
int | input_queue_length_ |
int | input_queue_shift_ |
base::Mutex | input_queue_mutex_ |
UnboundQueue< OptimizedCompileJob * > | output_queue_ |
OptimizedCompileJob ** | osr_buffer_ |
int | osr_buffer_capacity_ |
int | osr_buffer_cursor_ |
volatile base::AtomicWord | stop_thread_ |
base::TimeDelta | time_spent_compiling_ |
base::TimeDelta | time_spent_total_ |
int | osr_hits_ |
int | osr_attempts_ |
int | blocked_jobs_ |
Additional Inherited Members | |
![]() | |
typedef int32_t | LocalStorageKey |
![]() | |
static const int | kMaxThreadNameLength = 16 |
Definition at line 23 of file optimizing-compiler-thread.h.
|
private |
Enumerator | |
---|---|
CONTINUE | |
STOP | |
FLUSH |
Definition at line 87 of file optimizing-compiler-thread.h.
|
inlineexplicit |
Definition at line 25 of file optimizing-compiler-thread.h.
References CONTINUE, input_queue_, input_queue_capacity_, v8::base::NoBarrier_Store(), NULL, osr_buffer_, osr_buffer_capacity_, and stop_thread_.
v8::internal::OptimizingCompilerThread::~OptimizingCompilerThread | ( | ) |
Definition at line 18 of file optimizing-compiler-thread.cc.
References CHECK_EQ, DCHECK_EQ, v8::internal::DeleteArray(), input_queue_, input_queue_length_, NULL, osr_buffer_, and osr_buffer_capacity_.
|
private |
Definition at line 337 of file optimizing-compiler-thread.cc.
References v8::internal::CompilationInfo::closure(), DCHECK, v8::internal::DisposeOptimizedCompileJob(), v8::internal::OptimizedCompileJob::info(), v8::internal::OptimizedCompileJob::IsWaitingForInstall(), NULL, v8::internal::CompilationInfo::osr_ast_id(), osr_buffer_, osr_buffer_capacity_, osr_buffer_cursor_, v8::internal::PrintF(), and v8::internal::BailoutId::ToInt().
Referenced by AgeBufferedOsrJobs(), and QueueForOptimization().
|
inline |
Definition at line 70 of file optimizing-compiler-thread.h.
References AddToOsrBuffer(), and NULL.
Referenced by v8::internal::Heap::GarbageCollectionPrologue().
|
private |
Definition at line 98 of file optimizing-compiler-thread.cc.
References DCHECK, DCHECK_NE, v8::internal::OptimizedCompileJob::FAILED, isolate_, NextInput(), NULL, v8::internal::OptimizedCompileJob::OptimizeGraph(), output_queue_, v8::internal::Isolate::stack_guard(), and USE().
Referenced by Run(), and Stop().
Definition at line 77 of file optimizing-compiler-thread.h.
Referenced by v8::internal::Isolate::Init().
OptimizedCompileJob * v8::internal::OptimizingCompilerThread::FindReadyOSRCandidate | ( | Handle< JSFunction > | function, |
BailoutId | osr_ast_id | ||
) |
Definition at line 294 of file optimizing-compiler-thread.cc.
References DCHECK, v8::internal::CompilationInfo::HasSameOsrEntry(), v8::internal::OptimizedCompileJob::info(), v8::internal::OptimizedCompileJob::IsWaitingForInstall(), NULL, osr_buffer_, osr_buffer_capacity_, and osr_hits_.
Referenced by v8::internal::RUNTIME_FUNCTION().
void v8::internal::OptimizingCompilerThread::Flush | ( | ) |
Definition at line 171 of file optimizing-compiler-thread.cc.
References DCHECK, FLUSH, FlushOsrBuffer(), FlushOutputQueue(), input_queue_semaphore_, v8::internal::PrintF(), v8::base::Release_Store(), stop_semaphore_, stop_thread_, and Unblock().
Referenced by v8::internal::Heap::CollectAllAvailableGarbage(), v8::internal::Heap::NotifyContextDisposed(), and v8::internal::Debug::PrepareForBreakPoints().
|
private |
Definition at line 136 of file optimizing-compiler-thread.cc.
References v8::internal::DisposeOptimizedCompileJob(), v8::internal::OptimizedCompileJob::info(), input_queue_semaphore_, v8::internal::CompilationInfo::is_osr(), and NextInput().
Referenced by Run(), and Stop().
|
private |
Definition at line 161 of file optimizing-compiler-thread.cc.
References v8::internal::DisposeOptimizedCompileJob(), NULL, osr_buffer_, and osr_buffer_capacity_.
Referenced by Flush(), and Stop().
|
private |
Definition at line 150 of file optimizing-compiler-thread.cc.
References v8::internal::DisposeOptimizedCompileJob(), v8::internal::OptimizedCompileJob::info(), v8::internal::CompilationInfo::is_osr(), and output_queue_.
Referenced by Flush(), and Stop().
Definition at line 99 of file optimizing-compiler-thread.h.
References DCHECK_LE, DCHECK_LT, input_queue_capacity_, and input_queue_shift_.
Referenced by NextInput(), and QueueForOptimization().
void v8::internal::OptimizingCompilerThread::InstallOptimizedFunctions | ( | ) |
Definition at line 218 of file optimizing-compiler-thread.cc.
References v8::internal::CompilationInfo::closure(), DCHECK, v8::internal::DisposeOptimizedCompileJob(), v8::internal::Compiler::GetConcurrentlyOptimizedCode(), v8::internal::OptimizedCompileJob::info(), v8::internal::Handle< T >::is_null(), v8::internal::CompilationInfo::is_osr(), isolate_, v8::internal::CompilationInfo::osr_ast_id(), output_queue_, v8::internal::PrintF(), v8::internal::BackEdgeTable::RemoveStackCheck(), v8::internal::BailoutId::ToInt(), v8::internal::CompilationInfo::unoptimized_code(), and v8::internal::OptimizedCompileJob::WaitForInstall().
Referenced by Stop().
|
inline |
Definition at line 65 of file optimizing-compiler-thread.h.
References input_queue_capacity_, input_queue_length_, and input_queue_mutex_.
Referenced by v8::internal::GetOptimizedCodeLater(), and QueueForOptimization().
bool v8::internal::OptimizingCompilerThread::IsQueuedForOSR | ( | Handle< JSFunction > | function, |
BailoutId | osr_ast_id | ||
) |
Definition at line 311 of file optimizing-compiler-thread.cc.
References DCHECK, v8::internal::CompilationInfo::HasSameOsrEntry(), v8::internal::OptimizedCompileJob::info(), v8::internal::OptimizedCompileJob::IsWaitingForInstall(), NULL, osr_buffer_, and osr_buffer_capacity_.
Referenced by v8::internal::RuntimeProfiler::Optimize(), and v8::internal::RUNTIME_FUNCTION().
bool v8::internal::OptimizingCompilerThread::IsQueuedForOSR | ( | JSFunction * | function | ) |
Definition at line 325 of file optimizing-compiler-thread.cc.
References v8::internal::CompilationInfo::closure(), DCHECK, v8::internal::OptimizedCompileJob::info(), v8::internal::OptimizedCompileJob::IsWaitingForInstall(), NULL, osr_buffer_, and osr_buffer_capacity_.
|
private |
Definition at line 87 of file optimizing-compiler-thread.cc.
References DCHECK_NE, input_queue_, input_queue_length_, input_queue_mutex_, input_queue_shift_, InputQueueIndex(), and NULL.
Referenced by CompileNext(), and FlushInputQueue().
void v8::internal::OptimizingCompilerThread::QueueForOptimization | ( | OptimizedCompileJob * | optimizing_compiler | ) |
Definition at line 256 of file optimizing-compiler-thread.cc.
References AddToOsrBuffer(), blocked_jobs_, DCHECK, DCHECK_LT, v8::internal::OptimizedCompileJob::info(), input_queue_, input_queue_capacity_, input_queue_length_, input_queue_mutex_, input_queue_semaphore_, input_queue_shift_, InputQueueIndex(), v8::internal::CompilationInfo::is_osr(), IsQueueAvailable(), and osr_attempts_.
Referenced by v8::internal::GetOptimizedCodeLater().
|
virtual |
Implements v8::base::Thread.
Definition at line 32 of file optimizing-compiler-thread.cc.
References v8::base::Acquire_Load(), CompileNext(), CONTINUE, v8::internal::ThreadId::Current(), FLUSH, FlushInputQueue(), input_queue_semaphore_, isolate_, NULL, v8::base::Release_Store(), v8::internal::Isolate::SetIsolateThreadLocals(), v8::base::OS::Sleep(), STOP, stop_semaphore_, stop_thread_, time_spent_compiling_, time_spent_total_, and v8::internal::ThreadId::ToInteger().
void v8::internal::OptimizingCompilerThread::Stop | ( | ) |
Definition at line 185 of file optimizing-compiler-thread.cc.
References CompileNext(), DCHECK, FlushInputQueue(), FlushOsrBuffer(), FlushOutputQueue(), input_queue_length_, input_queue_semaphore_, InstallOptimizedFunctions(), v8::base::Thread::Join(), osr_attempts_, osr_hits_, v8::internal::PrintF(), v8::base::Release_Store(), STOP, stop_semaphore_, stop_thread_, time_spent_compiling_, time_spent_total_, and Unblock().
Referenced by v8::internal::Isolate::Deinit().
void v8::internal::OptimizingCompilerThread::Unblock | ( | ) |
Definition at line 285 of file optimizing-compiler-thread.cc.
References blocked_jobs_, DCHECK, and input_queue_semaphore_.
Referenced by Flush(), and Stop().
|
private |
Definition at line 137 of file optimizing-compiler-thread.h.
Referenced by QueueForOptimization(), and Unblock().
|
private |
Definition at line 116 of file optimizing-compiler-thread.h.
Referenced by NextInput(), OptimizingCompilerThread(), QueueForOptimization(), and ~OptimizingCompilerThread().
|
private |
Definition at line 117 of file optimizing-compiler-thread.h.
Referenced by InputQueueIndex(), IsQueueAvailable(), OptimizingCompilerThread(), and QueueForOptimization().
|
private |
Definition at line 118 of file optimizing-compiler-thread.h.
Referenced by IsQueueAvailable(), NextInput(), QueueForOptimization(), Stop(), and ~OptimizingCompilerThread().
|
private |
Definition at line 120 of file optimizing-compiler-thread.h.
Referenced by IsQueueAvailable(), NextInput(), and QueueForOptimization().
|
private |
Definition at line 113 of file optimizing-compiler-thread.h.
Referenced by Flush(), FlushInputQueue(), QueueForOptimization(), Run(), Stop(), and Unblock().
|
private |
Definition at line 119 of file optimizing-compiler-thread.h.
Referenced by InputQueueIndex(), NextInput(), and QueueForOptimization().
|
private |
Definition at line 111 of file optimizing-compiler-thread.h.
Referenced by CompileNext(), InstallOptimizedFunctions(), and Run().
|
private |
Definition at line 135 of file optimizing-compiler-thread.h.
Referenced by QueueForOptimization(), and Stop().
|
private |
Definition at line 126 of file optimizing-compiler-thread.h.
Referenced by AddToOsrBuffer(), FindReadyOSRCandidate(), FlushOsrBuffer(), IsQueuedForOSR(), OptimizingCompilerThread(), and ~OptimizingCompilerThread().
|
private |
Definition at line 127 of file optimizing-compiler-thread.h.
Referenced by AddToOsrBuffer(), FindReadyOSRCandidate(), FlushOsrBuffer(), IsQueuedForOSR(), OptimizingCompilerThread(), and ~OptimizingCompilerThread().
|
private |
Definition at line 128 of file optimizing-compiler-thread.h.
Referenced by AddToOsrBuffer().
|
private |
Definition at line 134 of file optimizing-compiler-thread.h.
Referenced by FindReadyOSRCandidate(), and Stop().
|
private |
Definition at line 123 of file optimizing-compiler-thread.h.
Referenced by CompileNext(), FlushOutputQueue(), and InstallOptimizedFunctions().
|
private |
Definition at line 112 of file optimizing-compiler-thread.h.
|
private |
Definition at line 130 of file optimizing-compiler-thread.h.
Referenced by Flush(), OptimizingCompilerThread(), Run(), and Stop().
|
private |
Definition at line 131 of file optimizing-compiler-thread.h.
|
private |
Definition at line 132 of file optimizing-compiler-thread.h.