V8 Project
v8::internal::ContextSlotCache Class Reference

#include <scopeinfo.h>

+ Collaboration diagram for v8::internal::ContextSlotCache:

Classes

struct  Key
 
struct  Value
 

Public Member Functions

int Lookup (Object *data, String *name, VariableMode *mode, InitializationFlag *init_flag, MaybeAssignedFlag *maybe_assigned_flag)
 
void Update (Handle< Object > data, Handle< String > name, VariableMode mode, InitializationFlag init_flag, MaybeAssignedFlag maybe_assigned_flag, int slot_index)
 
void Clear ()
 

Static Public Attributes

static const int kNotFound = -2
 

Private Member Functions

 ContextSlotCache ()
 
 DISALLOW_COPY_AND_ASSIGN (ContextSlotCache)
 

Static Private Member Functions

static int Hash (Object *data, String *name)
 

Private Attributes

Key keys_ [kLength]
 
uint32_t values_ [kLength]
 

Static Private Attributes

static const int kLength = 256
 

Friends

class Isolate
 

Detailed Description

Definition at line 19 of file scopeinfo.h.

Constructor & Destructor Documentation

◆ ContextSlotCache()

v8::internal::ContextSlotCache::ContextSlotCache ( )
inlineprivate

Definition at line 38 of file scopeinfo.h.

38  {
39  for (int i = 0; i < kLength; ++i) {
40  keys_[i].data = NULL;
41  keys_[i].name = NULL;
42  values_[i] = kNotFound;
43  }
44  }
static const int kNotFound
Definition: scopeinfo.h:35
static const int kLength
Definition: scopeinfo.h:54
uint32_t values_[kLength]
Definition: scopeinfo.h:104
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 v8::internal::ContextSlotCache::Key::data, keys_, kLength, kNotFound, v8::internal::ContextSlotCache::Key::name, NULL, and values_.

Member Function Documentation

◆ Clear()

void v8::internal::ContextSlotCache::Clear ( )

Definition at line 470 of file scopeinfo.cc.

470  {
471  for (int index = 0; index < kLength; index++) keys_[index].data = NULL;
472 }

References keys_, kLength, and NULL.

Referenced by v8::internal::Heap::CreateInitialObjects(), and v8::internal::Heap::MarkCompactPrologue().

+ Here is the caller graph for this function:

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::ContextSlotCache::DISALLOW_COPY_AND_ASSIGN ( ContextSlotCache  )
private

◆ Hash()

int v8::internal::ContextSlotCache::Hash ( Object data,
String name 
)
inlinestaticprivate

Definition at line 422 of file scopeinfo.cc.

422  {
423  // Uses only lower 32 bits if pointers are larger.
424  uintptr_t addr_hash =
425  static_cast<uint32_t>(reinterpret_cast<uintptr_t>(data)) >> 2;
426  return static_cast<int>((addr_hash ^ name->Hash()) % kLength);
427 }
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 expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name

References kLength, and name.

Referenced by Lookup(), and Update().

+ Here is the caller graph for this function:

◆ Lookup()

int v8::internal::ContextSlotCache::Lookup ( Object data,
String name,
VariableMode mode,
InitializationFlag init_flag,
MaybeAssignedFlag maybe_assigned_flag 
)

Definition at line 430 of file scopeinfo.cc.

432  {
433  int index = Hash(data, name);
434  Key& key = keys_[index];
435  if ((key.data == data) && key.name->Equals(name)) {
436  Value result(values_[index]);
437  if (mode != NULL) *mode = result.mode();
438  if (init_flag != NULL) *init_flag = result.initialization_flag();
439  if (maybe_assigned_flag != NULL)
440  *maybe_assigned_flag = result.maybe_assigned_flag();
441  return result.index() + kNotFound;
442  }
443  return kNotFound;
444 }
static int Hash(Object *data, String *name)
Definition: scopeinfo.cc:422
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 mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp

References v8::internal::ContextSlotCache::Key::data, v8::internal::String::Equals(), Hash(), v8::internal::ContextSlotCache::Value::index(), v8::internal::ContextSlotCache::Value::initialization_flag(), keys_, kNotFound, v8::internal::ContextSlotCache::Value::maybe_assigned_flag(), v8::internal::ContextSlotCache::Value::mode(), mode(), name, v8::internal::ContextSlotCache::Key::name, NULL, and values_.

Referenced by v8::internal::ScopeInfo::ContextSlotIndex().

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

◆ Update()

void v8::internal::ContextSlotCache::Update ( Handle< Object data,
Handle< String name,
VariableMode  mode,
InitializationFlag  init_flag,
MaybeAssignedFlag  maybe_assigned_flag,
int  slot_index 
)

Definition at line 447 of file scopeinfo.cc.

450  {
452  Handle<String> internalized_name;
453  DCHECK(slot_index > kNotFound);
455  ToHandle(&internalized_name)) {
456  int index = Hash(*data, *internalized_name);
457  Key& key = keys_[index];
458  key.data = *data;
459  key.name = *internalized_name;
460  // Please note value only takes a uint as index.
461  values_[index] = Value(mode, init_flag, maybe_assigned_flag,
462  slot_index - kNotFound).raw();
463 #ifdef DEBUG
464  ValidateEntry(data, name, mode, init_flag, maybe_assigned_flag, slot_index);
465 #endif
466  }
467 }
static MUST_USE_RESULT MaybeHandle< String > InternalizeStringIfExists(Isolate *isolate, Handle< String > string)
Definition: objects.cc:14663
#define DCHECK(condition)
Definition: logging.h:205
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
Definition: assert-scope.h:110

References v8::internal::ContextSlotCache::Key::data, DCHECK, Hash(), v8::internal::StringTable::InternalizeStringIfExists(), keys_, kNotFound, mode(), name, v8::internal::ContextSlotCache::Key::name, v8::internal::ContextSlotCache::Value::raw(), and values_.

Referenced by v8::internal::ScopeInfo::ContextSlotIndex().

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

Friends And Related Function Documentation

◆ Isolate

friend class Isolate
friend

Definition at line 106 of file scopeinfo.h.

Member Data Documentation

◆ keys_

Key v8::internal::ContextSlotCache::keys_[kLength]
private

Definition at line 103 of file scopeinfo.h.

Referenced by Clear(), ContextSlotCache(), Lookup(), and Update().

◆ kLength

const int v8::internal::ContextSlotCache::kLength = 256
staticprivate

Definition at line 54 of file scopeinfo.h.

Referenced by Clear(), ContextSlotCache(), and Hash().

◆ kNotFound

const int v8::internal::ContextSlotCache::kNotFound = -2
static

◆ values_

uint32_t v8::internal::ContextSlotCache::values_[kLength]
private

Definition at line 104 of file scopeinfo.h.

Referenced by ContextSlotCache(), Lookup(), and Update().


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