V8 Project
v8::internal::CompilationCacheEval Class Reference

#include <compilation-cache.h>

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

Public Member Functions

 CompilationCacheEval (Isolate *isolate, int generations)
 
MaybeHandle< SharedFunctionInfoLookup (Handle< String > source, Handle< Context > context, StrictMode strict_mode, int scope_position)
 
void Put (Handle< String > source, Handle< Context > context, Handle< SharedFunctionInfo > function_info, int scope_position)
 
- Public Member Functions inherited from v8::internal::CompilationSubCache
 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 ()
 

Private Member Functions

 DISALLOW_IMPLICIT_CONSTRUCTORS (CompilationCacheEval)
 

Additional Inherited Members

- Static Public Attributes inherited from v8::internal::CompilationSubCache
static const int kFirstGeneration = 0
 
- Protected Member Functions inherited from v8::internal::CompilationSubCache
Isolateisolate ()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ CompilationCacheEval()

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

Member Function Documentation

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::CompilationCacheEval::DISALLOW_IMPLICIT_CONSTRUCTORS ( CompilationCacheEval  )
private

◆ Lookup()

MaybeHandle< SharedFunctionInfo > v8::internal::CompilationCacheEval::Lookup ( Handle< String source,
Handle< Context context,
StrictMode  strict_mode,
int  scope_position 
)

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

227  {
228  HandleScope scope(isolate());
229  // Make sure not to leak the table into the surrounding handle
230  // scope. Otherwise, we risk keeping old tables around even after
231  // having cleared the cache.
232  Handle<Object> result = isolate()->factory()->undefined_value();
233  int generation;
234  for (generation = 0; generation < generations(); generation++) {
235  Handle<CompilationCacheTable> table = GetTable(generation);
236  result = table->LookupEval(source, context, strict_mode, scope_position);
237  if (result->IsSharedFunctionInfo()) break;
238  }
239  if (result->IsSharedFunctionInfo()) {
240  Handle<SharedFunctionInfo> function_info =
242  if (generation != 0) {
243  Put(source, context, function_info, scope_position);
244  }
245  isolate()->counters()->compilation_cache_hits()->Increment();
246  return scope.CloseAndEscape(function_info);
247  } else {
248  isolate()->counters()->compilation_cache_misses()->Increment();
249  return MaybeHandle<SharedFunctionInfo>();
250  }
251 }
void Put(Handle< String > source, Handle< Context > context, Handle< SharedFunctionInfo > function_info, int scope_position)
Handle< CompilationCacheTable > GetTable(int generation)
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
Counters * counters()
Definition: isolate.h:857
Factory * factory()
Definition: isolate.h:982

References v8::internal::Handle< T >::cast(), v8::internal::HandleScope::CloseAndEscape(), v8::internal::Isolate::counters(), v8::internal::Isolate::factory(), v8::internal::CompilationSubCache::generations(), v8::internal::CompilationSubCache::GetTable(), v8::internal::CompilationSubCache::isolate(), and Put().

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

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

◆ Put()

void v8::internal::CompilationCacheEval::Put ( Handle< String source,
Handle< Context context,
Handle< SharedFunctionInfo function_info,
int  scope_position 
)

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

257  {
258  HandleScope scope(isolate());
259  Handle<CompilationCacheTable> table = GetFirstTable();
260  table = CompilationCacheTable::PutEval(table, source, context,
261  function_info, scope_position);
262  SetFirstTable(table);
263 }
static Handle< CompilationCacheTable > PutEval(Handle< CompilationCacheTable > cache, Handle< String > src, Handle< Context > context, Handle< SharedFunctionInfo > value, int scope_position)
Definition: objects.cc:14794
Handle< CompilationCacheTable > GetFirstTable()
void SetFirstTable(Handle< CompilationCacheTable > value)

References v8::internal::CompilationSubCache::GetFirstTable(), v8::internal::CompilationSubCache::isolate(), v8::internal::CompilationCacheTable::PutEval(), and v8::internal::CompilationSubCache::SetFirstTable().

Referenced by Lookup(), and v8::internal::CompilationCache::PutEval().

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

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