V8 Project
v8::internal::ThreadId Class Reference

#include <isolate.h>

+ Collaboration diagram for v8::internal::ThreadId:

Public Member Functions

 ThreadId ()
 
 INLINE (bool Equals(const ThreadId &other) const)
 
 INLINE (bool IsValid() const)
 
int ToInteger () const
 

Static Public Member Functions

static ThreadId Current ()
 
static ThreadId Invalid ()
 
static ThreadId FromInteger (int id)
 

Private Member Functions

 ThreadId (int id)
 

Static Private Member Functions

static int AllocateThreadId ()
 
static int GetCurrentThreadId ()
 

Private Attributes

int id_
 

Static Private Attributes

static const int kInvalidId = -1
 
static base::Atomic32 highest_thread_id_ = 0
 

Friends

class Isolate
 

Detailed Description

Definition at line 179 of file isolate.h.

Constructor & Destructor Documentation

◆ ThreadId() [1/2]

v8::internal::ThreadId::ThreadId ( )
inline

Definition at line 182 of file isolate.h.

182 : id_(kInvalidId) {}
static const int kInvalidId
Definition: isolate.h:209

Referenced by Current(), FromInteger(), and Invalid().

+ Here is the caller graph for this function:

◆ ThreadId() [2/2]

v8::internal::ThreadId::ThreadId ( int  id)
inlineexplicitprivate

Definition at line 211 of file isolate.h.

211 : id_(id) {}

Member Function Documentation

◆ AllocateThreadId()

int v8::internal::ThreadId::AllocateThreadId ( )
staticprivate

Definition at line 45 of file isolate.cc.

45  {
47  return new_id;
48 }
static base::Atomic32 highest_thread_id_
Definition: isolate.h:219
Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32 *ptr, Atomic32 increment)

References highest_thread_id_, and v8::base::NoBarrier_AtomicIncrement().

Referenced by GetCurrentThreadId().

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

◆ Current()

static ThreadId v8::internal::ThreadId::Current ( )
inlinestatic

Definition at line 185 of file isolate.h.

185 { return ThreadId(GetCurrentThreadId()); }
static int GetCurrentThreadId()
Definition: isolate.cc:51

References GetCurrentThreadId(), and ThreadId().

Referenced by v8::internal::ThreadManager::ArchiveThread(), v8::internal::ThreadManager::CurrentId(), v8::internal::Isolate::Enter(), v8::internal::Isolate::Exit(), v8::internal::Isolate::FindOrAllocatePerThreadDataForThisThread(), v8::internal::Isolate::FindPerThreadDataForThisThread(), v8::internal::ThreadManager::IsLockedByCurrentThread(), v8::internal::ThreadManager::Lock(), v8::internal::ThreadManager::RestoreThread(), v8::internal::OptimizingCompilerThread::Run(), and v8::internal::RUNTIME_FUNCTION().

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

◆ FromInteger()

static ThreadId v8::internal::ThreadId::FromInteger ( int  id)
inlinestatic

Definition at line 206 of file isolate.h.

206 { return ThreadId(id); }

References ThreadId().

+ Here is the call graph for this function:

◆ GetCurrentThreadId()

int v8::internal::ThreadId::GetCurrentThreadId ( )
staticprivate

Definition at line 51 of file isolate.cc.

51  {
53  if (thread_id == 0) {
54  thread_id = AllocateThreadId();
56  }
57  return thread_id;
58 }
static int GetThreadLocalInt(LocalStorageKey key)
Definition: platform.h:462
static void SetThreadLocalInt(LocalStorageKey key, int value)
Definition: platform.h:466
static base::Thread::LocalStorageKey thread_id_key_
Definition: isolate.h:1179
static int AllocateThreadId()
Definition: isolate.cc:45

References AllocateThreadId(), v8::base::Thread::GetThreadLocalInt(), v8::base::Thread::SetThreadLocalInt(), and v8::internal::Isolate::thread_id_key_.

Referenced by Current().

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

◆ INLINE() [1/2]

v8::internal::ThreadId::INLINE ( bool Equals(const ThreadId &other) const  )
inline

Definition at line 191 of file isolate.h.

191  {
192  return id_ == other.id_;
193  }

References id_.

◆ INLINE() [2/2]

v8::internal::ThreadId::INLINE ( bool IsValid() const  )
inline

Definition at line 196 of file isolate.h.

196  {
197  return id_ != kInvalidId;
198  }

References id_, and kInvalidId.

◆ Invalid()

static ThreadId v8::internal::ThreadId::Invalid ( )
inlinestatic

Definition at line 188 of file isolate.h.

188 { return ThreadId(kInvalidId); }

References kInvalidId, and ThreadId().

Referenced by v8::internal::ThreadManager::ArchiveThread(), v8::internal::ThreadManager::EagerlyArchiveThread(), v8::internal::ThreadManager::RestoreThread(), and v8::internal::ThreadManager::Unlock().

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

◆ ToInteger()

int v8::internal::ThreadId::ToInteger ( ) const
inline

Definition at line 202 of file isolate.h.

202 { return id_; }

References id_.

Referenced by v8::internal::OptimizingCompilerThread::Run(), and v8::internal::RUNTIME_FUNCTION().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ Isolate

friend class Isolate
friend

Definition at line 221 of file isolate.h.

Member Data Documentation

◆ highest_thread_id_

base::Atomic32 v8::internal::ThreadId::highest_thread_id_ = 0
staticprivate

Definition at line 219 of file isolate.h.

Referenced by AllocateThreadId().

◆ id_

int v8::internal::ThreadId::id_
private

Definition at line 217 of file isolate.h.

Referenced by INLINE(), and ToInteger().

◆ kInvalidId

const int v8::internal::ThreadId::kInvalidId = -1
staticprivate

Definition at line 209 of file isolate.h.

Referenced by INLINE(), and Invalid().


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