V8 Project
v8::internal::CompilationSubCache Class Reference

#include <compilation-cache.h>

+ Inheritance diagram for v8::internal::CompilationSubCache:
+ Collaboration diagram for v8::internal::CompilationSubCache:

Public Member Functions

 CompilationSubCache (Isolate *isolate, int generations)
 
 ~CompilationSubCache ()
 
Handle< CompilationCacheTableGetTable (int generation)
 
Handle< CompilationCacheTableGetFirstTable ()
 
void SetFirstTable (Handle< CompilationCacheTable > value)
 
void Age ()
 
void Iterate (ObjectVisitor *v)
 
void IterateFunctions (ObjectVisitor *v)
 
void Clear ()
 
void Remove (Handle< SharedFunctionInfo > function_info)
 
int generations ()
 

Static Public Attributes

static const int kFirstGeneration = 0
 

Protected Member Functions

Isolateisolate ()
 

Private Member Functions

 DISALLOW_IMPLICIT_CONSTRUCTORS (CompilationSubCache)
 

Private Attributes

Isolateisolate_
 
int generations_
 
Object ** tables_
 

Detailed Description

Definition at line 16 of file compilation-cache.h.

Constructor & Destructor Documentation

◆ CompilationSubCache()

v8::internal::CompilationSubCache::CompilationSubCache ( Isolate isolate,
int  generations 
)
inline

Definition at line 18 of file compilation-cache.h.

References generations(), and tables_.

+ Here is the call graph for this function:

◆ ~CompilationSubCache()

v8::internal::CompilationSubCache::~CompilationSubCache ( )
inline

Definition at line 24 of file compilation-cache.h.

24 { DeleteArray(tables_); }
void DeleteArray(T *array)
Definition: allocation.h:68

References v8::internal::DeleteArray(), and tables_.

+ Here is the call graph for this function:

Member Function Documentation

◆ Age()

void v8::internal::CompilationSubCache::Age ( )

Definition at line 60 of file compilation-cache.cc.

60  {
61  // Age the generations implicitly killing off the oldest.
62  for (int i = generations_ - 1; i > 0; i--) {
63  tables_[i] = tables_[i - 1];
64  }
65 
66  // Set the first generation as unborn.
67  tables_[0] = isolate()->heap()->undefined_value();
68 }

References generations_, v8::internal::Isolate::heap(), isolate(), and tables_.

Referenced by v8::internal::CompilationCache::MarkCompactPrologue().

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

◆ Clear()

void v8::internal::CompilationSubCache::Clear ( )

Definition at line 86 of file compilation-cache.cc.

86  {
87  MemsetPointer(tables_, isolate()->heap()->undefined_value(), generations_);
88 }
void MemsetPointer(T **dest, U *value, int counter)
Definition: utils.h:1183

References generations_, isolate(), v8::internal::MemsetPointer(), and tables_.

Referenced by v8::internal::CompilationCache::Clear().

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

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::CompilationSubCache::DISALLOW_IMPLICIT_CONSTRUCTORS ( CompilationSubCache  )
private

◆ generations()

int v8::internal::CompilationSubCache::generations ( )
inline

Definition at line 56 of file compilation-cache.h.

56 { return generations_; }

References generations_.

Referenced by CompilationSubCache(), v8::internal::CompilationCacheEval::Lookup(), v8::internal::CompilationCacheScript::Lookup(), v8::internal::CompilationCacheRegExp::Lookup(), and Remove().

+ Here is the caller graph for this function:

◆ GetFirstTable()

Handle<CompilationCacheTable> v8::internal::CompilationSubCache::GetFirstTable ( )
inline

Definition at line 33 of file compilation-cache.h.

33  {
34  return GetTable(kFirstGeneration);
35  }
Handle< CompilationCacheTable > GetTable(int generation)

References GetTable(), and kFirstGeneration.

Referenced by v8::internal::CompilationCacheScript::Put(), v8::internal::CompilationCacheEval::Put(), and v8::internal::CompilationCacheRegExp::Put().

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

◆ GetTable()

Handle< CompilationCacheTable > v8::internal::CompilationSubCache::GetTable ( int  generation)

Definition at line 45 of file compilation-cache.cc.

45  {
46  DCHECK(generation < generations_);
47  Handle<CompilationCacheTable> result;
48  if (tables_[generation]->IsUndefined()) {
50  tables_[generation] = *result;
51  } else {
52  CompilationCacheTable* table =
53  CompilationCacheTable::cast(tables_[generation]);
54  result = Handle<CompilationCacheTable>(table, isolate());
55  }
56  return result;
57 }
static MUST_USE_RESULT Handle< CompilationCacheTable > New(Isolate *isolate, int at_least_space_for, MinimumCapacity capacity_option=USE_DEFAULT_MINIMUM_CAPACITY, PretenureFlag pretenure=NOT_TENURED)
Definition: objects.cc:13756
#define DCHECK(condition)
Definition: logging.h:205
static const int kInitialCacheSize

References DCHECK, generations_, isolate(), v8::internal::kInitialCacheSize, v8::internal::HashTable< CompilationCacheTable, CompilationCacheShape, HashTableKey * >::New(), and tables_.

Referenced by GetFirstTable(), v8::internal::CompilationCacheEval::Lookup(), v8::internal::CompilationCacheScript::Lookup(), v8::internal::CompilationCacheRegExp::Lookup(), and Remove().

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

◆ isolate()

Isolate* v8::internal::CompilationSubCache::isolate ( )
inlineprotected

◆ Iterate()

void v8::internal::CompilationSubCache::Iterate ( ObjectVisitor v)

Definition at line 81 of file compilation-cache.cc.

81  {
82  v->VisitPointers(&tables_[0], &tables_[generations_]);
83 }

References generations_, and tables_.

Referenced by v8::internal::CompilationCache::Iterate().

+ Here is the caller graph for this function:

◆ IterateFunctions()

void v8::internal::CompilationSubCache::IterateFunctions ( ObjectVisitor v)

Definition at line 71 of file compilation-cache.cc.

71  {
72  Object* undefined = isolate()->heap()->undefined_value();
73  for (int i = 0; i < generations_; i++) {
74  if (tables_[i] != undefined) {
75  reinterpret_cast<CompilationCacheTable*>(tables_[i])->IterateElements(v);
76  }
77  }
78 }
static bool IterateElements(Isolate *isolate, Handle< JSArray > receiver, ArrayConcatVisitor *visitor)
A helper function that visits elements of a JSArray in numerical order.
Definition: runtime.cc:4946
kSerializedDataOffset Object
Definition: objects-inl.h:5322

References generations_, v8::internal::Isolate::heap(), isolate(), v8::internal::IterateElements(), and tables_.

Referenced by v8::internal::CompilationCache::IterateFunctions().

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

◆ Remove()

void v8::internal::CompilationSubCache::Remove ( Handle< SharedFunctionInfo function_info)

Definition at line 91 of file compilation-cache.cc.

91  {
92  // Probe the script generation tables. Make sure not to leak handles
93  // into the caller's handle scope.
94  { HandleScope scope(isolate());
95  for (int generation = 0; generation < generations(); generation++) {
96  Handle<CompilationCacheTable> table = GetTable(generation);
97  table->Remove(*function_info);
98  }
99  }
100 }

References generations(), GetTable(), and isolate().

Referenced by v8::internal::CompilationCache::Remove().

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

◆ SetFirstTable()

void v8::internal::CompilationSubCache::SetFirstTable ( Handle< CompilationCacheTable value)
inline

Definition at line 36 of file compilation-cache.h.

36  {
38  tables_[kFirstGeneration] = *value;
39  }

References DCHECK, generations_, kFirstGeneration, and tables_.

Referenced by v8::internal::CompilationCacheScript::Put(), v8::internal::CompilationCacheEval::Put(), and v8::internal::CompilationCacheRegExp::Put().

+ Here is the caller graph for this function:

Member Data Documentation

◆ generations_

int v8::internal::CompilationSubCache::generations_
private

◆ isolate_

Isolate* v8::internal::CompilationSubCache::isolate_
private

Definition at line 62 of file compilation-cache.h.

Referenced by isolate().

◆ kFirstGeneration

const int v8::internal::CompilationSubCache::kFirstGeneration = 0
static

Definition at line 27 of file compilation-cache.h.

Referenced by GetFirstTable(), and SetFirstTable().

◆ tables_

Object** v8::internal::CompilationSubCache::tables_
private

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