V8 Project
v8::internal::InnerPointerToCodeCache Class Reference

#include <frames.h>

+ Collaboration diagram for v8::internal::InnerPointerToCodeCache:

Classes

struct  InnerPointerToCodeCacheEntry
 

Public Member Functions

 InnerPointerToCodeCache (Isolate *isolate)
 
CodeGcSafeFindCodeForInnerPointer (Address inner_pointer)
 
CodeGcSafeCastToCode (HeapObject *object, Address inner_pointer)
 
void Flush ()
 
InnerPointerToCodeCacheEntryGetCacheEntry (Address inner_pointer)
 

Private Member Functions

InnerPointerToCodeCacheEntrycache (int index)
 
 DISALLOW_COPY_AND_ASSIGN (InnerPointerToCodeCache)
 

Private Attributes

Isolateisolate_
 
InnerPointerToCodeCacheEntry cache_ [kInnerPointerToCodeCacheSize]
 

Static Private Attributes

static const int kInnerPointerToCodeCacheSize = 1024
 

Detailed Description

Definition at line 36 of file frames.h.

Constructor & Destructor Documentation

◆ InnerPointerToCodeCache()

v8::internal::InnerPointerToCodeCache::InnerPointerToCodeCache ( Isolate isolate)
inlineexplicit

Definition at line 44 of file frames.h.

44  : isolate_(isolate) {
45  Flush();
46  }

References Flush().

+ Here is the call graph for this function:

Member Function Documentation

◆ cache()

InnerPointerToCodeCacheEntry* v8::internal::InnerPointerToCodeCache::cache ( int  index)
inlineprivate

Definition at line 58 of file frames.h.

58 { return &cache_[index]; }
InnerPointerToCodeCacheEntry cache_[kInnerPointerToCodeCacheSize]
Definition: frames.h:63

References cache_.

Referenced by GetCacheEntry().

+ Here is the caller graph for this function:

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::InnerPointerToCodeCache::DISALLOW_COPY_AND_ASSIGN ( InnerPointerToCodeCache  )
private

◆ Flush()

void v8::internal::InnerPointerToCodeCache::Flush ( )
inline

Definition at line 51 of file frames.h.

51  {
52  memset(&cache_[0], 0, sizeof(cache_));
53  }

References cache_.

Referenced by v8::internal::MarkCompactCollector::EvacuateNewSpaceAndCandidates(), and InnerPointerToCodeCache().

+ Here is the caller graph for this function:

◆ GcSafeCastToCode()

Code * v8::internal::InnerPointerToCodeCache::GcSafeCastToCode ( HeapObject object,
Address  inner_pointer 
)

Definition at line 1460 of file frames.cc.

1461  {
1462  Code* code = reinterpret_cast<Code*>(object);
1463  DCHECK(code != NULL && GcSafeCodeContains(code, inner_pointer));
1464  return code;
1465 }
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
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, and NULL.

Referenced by GcSafeFindCodeForInnerPointer().

+ Here is the caller graph for this function:

◆ GcSafeFindCodeForInnerPointer()

Code * v8::internal::InnerPointerToCodeCache::GcSafeFindCodeForInnerPointer ( Address  inner_pointer)

Definition at line 1468 of file frames.cc.

1469  {
1470  Heap* heap = isolate_->heap();
1471  // Check if the inner pointer points into a large object chunk.
1472  LargePage* large_page = heap->lo_space()->FindPage(inner_pointer);
1473  if (large_page != NULL) {
1474  return GcSafeCastToCode(large_page->GetObject(), inner_pointer);
1475  }
1476 
1477  // Iterate through the page until we reach the end or find an object starting
1478  // after the inner pointer.
1479  Page* page = Page::FromAddress(inner_pointer);
1480 
1481  Address addr = page->skip_list()->StartFor(inner_pointer);
1482 
1483  Address top = heap->code_space()->top();
1484  Address limit = heap->code_space()->limit();
1485 
1486  while (true) {
1487  if (addr == top && addr != limit) {
1488  addr = limit;
1489  continue;
1490  }
1491 
1492  HeapObject* obj = HeapObject::FromAddress(addr);
1493  int obj_size = GcSafeSizeOfCodeSpaceObject(obj);
1494  Address next_addr = addr + obj_size;
1495  if (next_addr > inner_pointer) return GcSafeCastToCode(obj, inner_pointer);
1496  addr = next_addr;
1497  }
1498 }
static HeapObject * FromAddress(Address address)
Definition: objects-inl.h:1464
LargeObjectSpace * lo_space()
Definition: heap.h:600
Code * GcSafeCastToCode(HeapObject *object, Address inner_pointer)
Definition: frames.cc:1460
LargePage * FindPage(Address a)
Definition: spaces.cc:2910
static MemoryChunk * FromAddress(Address a)
Definition: spaces.h:276
byte * Address
Definition: globals.h:101
static int GcSafeSizeOfCodeSpaceObject(HeapObject *object)
Definition: frames.cc:1444

References v8::internal::Heap::code_space(), v8::internal::LargeObjectSpace::FindPage(), v8::internal::MemoryChunk::FromAddress(), v8::internal::HeapObject::FromAddress(), GcSafeCastToCode(), v8::internal::GcSafeSizeOfCodeSpaceObject(), v8::internal::LargePage::GetObject(), v8::internal::Isolate::heap(), isolate_, v8::internal::PagedSpace::limit(), v8::internal::Heap::lo_space(), NULL, v8::internal::MemoryChunk::skip_list(), v8::internal::SkipList::StartFor(), and v8::internal::PagedSpace::top().

Referenced by v8::internal::Isolate::FindCodeObject(), GetCacheEntry(), v8::internal::MarkCompactCollector::RecordCodeTargetPatch(), and v8::internal::IncrementalMarking::RecordCodeTargetPatch().

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

◆ GetCacheEntry()

InnerPointerToCodeCache::InnerPointerToCodeCacheEntry * v8::internal::InnerPointerToCodeCache::GetCacheEntry ( Address  inner_pointer)

Definition at line 1502 of file frames.cc.

1502  {
1503  isolate_->counters()->pc_to_code()->Increment();
1506  static_cast<uint32_t>(reinterpret_cast<uintptr_t>(inner_pointer)),
1508  uint32_t index = hash & (kInnerPointerToCodeCacheSize - 1);
1509  InnerPointerToCodeCacheEntry* entry = cache(index);
1510  if (entry->inner_pointer == inner_pointer) {
1511  isolate_->counters()->pc_to_code_cached()->Increment();
1512  DCHECK(entry->code == GcSafeFindCodeForInnerPointer(inner_pointer));
1513  } else {
1514  // Because this code may be interrupted by a profiling signal that
1515  // also queries the cache, we cannot update inner_pointer before the code
1516  // has been set. Otherwise, we risk trying to use a cache entry before
1517  // the code has been computed.
1518  entry->code = GcSafeFindCodeForInnerPointer(inner_pointer);
1519  entry->safepoint_entry.Reset();
1520  entry->inner_pointer = inner_pointer;
1521  }
1522  return entry;
1523 }
Code * GcSafeFindCodeForInnerPointer(Address inner_pointer)
Definition: frames.cc:1468
InnerPointerToCodeCacheEntry * cache(int index)
Definition: frames.h:58
static const int kInnerPointerToCodeCacheSize
Definition: frames.h:62
Counters * counters()
Definition: isolate.h:857
bool IsPowerOfTwo32(uint32_t value)
Definition: bits.h:77
static const uint32_t kZeroHashSeed
Definition: utils.h:245
uint32_t ComputeIntegerHash(uint32_t key, uint32_t seed)
Definition: utils.h:249

References cache(), v8::internal::ComputeIntegerHash(), v8::internal::Isolate::counters(), DCHECK, GcSafeFindCodeForInnerPointer(), isolate_, v8::base::bits::IsPowerOfTwo32(), kInnerPointerToCodeCacheSize, and v8::internal::kZeroHashSeed.

Referenced by v8::internal::IC::OnTypeFeedbackChanged().

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

Member Data Documentation

◆ cache_

InnerPointerToCodeCacheEntry v8::internal::InnerPointerToCodeCache::cache_[kInnerPointerToCodeCacheSize]
private

Definition at line 63 of file frames.h.

Referenced by cache(), and Flush().

◆ isolate_

Isolate* v8::internal::InnerPointerToCodeCache::isolate_
private

Definition at line 60 of file frames.h.

Referenced by GcSafeFindCodeForInnerPointer(), and GetCacheEntry().

◆ kInnerPointerToCodeCacheSize

const int v8::internal::InnerPointerToCodeCache::kInnerPointerToCodeCacheSize = 1024
staticprivate

Definition at line 62 of file frames.h.

Referenced by GetCacheEntry().


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