V8 Project
v8::internal::CompilationCacheRegExp Class Reference

#include <compilation-cache.h>

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

Public Member Functions

 CompilationCacheRegExp (Isolate *isolate, int generations)
 
MaybeHandle< FixedArrayLookup (Handle< String > source, JSRegExp::Flags flags)
 
void Put (Handle< String > source, JSRegExp::Flags flags, Handle< FixedArray > data)
 
- 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 (CompilationCacheRegExp)
 

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 132 of file compilation-cache.h.

Constructor & Destructor Documentation

◆ CompilationCacheRegExp()

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

Member Function Documentation

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::CompilationCacheRegExp::DISALLOW_IMPLICIT_CONSTRUCTORS ( CompilationCacheRegExp  )
private

◆ Lookup()

MaybeHandle< FixedArray > v8::internal::CompilationCacheRegExp::Lookup ( Handle< String source,
JSRegExp::Flags  flags 
)

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

268  {
269  HandleScope scope(isolate());
270  // Make sure not to leak the table into the surrounding handle
271  // scope. Otherwise, we risk keeping old tables around even after
272  // having cleared the cache.
273  Handle<Object> result = isolate()->factory()->undefined_value();
274  int generation;
275  for (generation = 0; generation < generations(); generation++) {
276  Handle<CompilationCacheTable> table = GetTable(generation);
277  result = table->LookupRegExp(source, flags);
278  if (result->IsFixedArray()) break;
279  }
280  if (result->IsFixedArray()) {
281  Handle<FixedArray> data = Handle<FixedArray>::cast(result);
282  if (generation != 0) {
283  Put(source, flags, data);
284  }
285  isolate()->counters()->compilation_cache_hits()->Increment();
286  return scope.CloseAndEscape(data);
287  } else {
288  isolate()->counters()->compilation_cache_misses()->Increment();
289  return MaybeHandle<FixedArray>();
290  }
291 }
void Put(Handle< String > source, JSRegExp::Flags flags, Handle< FixedArray > data)
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::anonymous_namespace{flags.cc}::flags, v8::internal::CompilationSubCache::generations(), v8::internal::CompilationSubCache::GetTable(), v8::internal::CompilationSubCache::isolate(), and Put().

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

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

◆ Put()

void v8::internal::CompilationCacheRegExp::Put ( Handle< String source,
JSRegExp::Flags  flags,
Handle< FixedArray data 
)

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

296  {
297  HandleScope scope(isolate());
298  Handle<CompilationCacheTable> table = GetFirstTable();
300 }
static Handle< CompilationCacheTable > PutRegExp(Handle< CompilationCacheTable > cache, Handle< String > src, JSRegExp::Flags flags, Handle< FixedArray > value)
Definition: objects.cc:14811
Handle< CompilationCacheTable > GetFirstTable()
void SetFirstTable(Handle< CompilationCacheTable > value)

References v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::CompilationSubCache::GetFirstTable(), v8::internal::CompilationSubCache::isolate(), v8::internal::CompilationCacheTable::PutRegExp(), and v8::internal::CompilationSubCache::SetFirstTable().

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

+ 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: