V8 Project
v8::internal::CompilationCache Class Reference

#include <compilation-cache.h>

+ Collaboration diagram for v8::internal::CompilationCache:

Public Member Functions

MaybeHandle< SharedFunctionInfoLookupScript (Handle< String > source, Handle< Object > name, int line_offset, int column_offset, bool is_shared_cross_origin, Handle< Context > context)
 
MaybeHandle< SharedFunctionInfoLookupEval (Handle< String > source, Handle< Context > context, StrictMode strict_mode, int scope_position)
 
MaybeHandle< FixedArrayLookupRegExp (Handle< String > source, JSRegExp::Flags flags)
 
void PutScript (Handle< String > source, Handle< Context > context, Handle< SharedFunctionInfo > function_info)
 
void PutEval (Handle< String > source, Handle< Context > context, Handle< SharedFunctionInfo > function_info, int scope_position)
 
void PutRegExp (Handle< String > source, JSRegExp::Flags flags, Handle< FixedArray > data)
 
void Clear ()
 
void Remove (Handle< SharedFunctionInfo > function_info)
 
void Iterate (ObjectVisitor *v)
 
void IterateFunctions (ObjectVisitor *v)
 
void MarkCompactPrologue ()
 
void Enable ()
 
void Disable ()
 

Private Member Functions

 CompilationCache (Isolate *isolate)
 
 ~CompilationCache ()
 
HashMapEagerOptimizingSet ()
 
bool IsEnabled ()
 
Isolateisolate ()
 
 DISALLOW_COPY_AND_ASSIGN (CompilationCache)
 

Private Attributes

Isolateisolate_
 
CompilationCacheScript script_
 
CompilationCacheEval eval_global_
 
CompilationCacheEval eval_contextual_
 
CompilationCacheRegExp reg_exp_
 
CompilationSubCachesubcaches_ [kSubCacheCount]
 
bool enabled_
 

Static Private Attributes

static const int kSubCacheCount = 4
 

Friends

class Isolate
 

Detailed Description

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

Constructor & Destructor Documentation

◆ CompilationCache()

v8::internal::CompilationCache::CompilationCache ( Isolate isolate)
explicitprivate

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

28  : isolate_(isolate),
33  enabled_(true) {
34  CompilationSubCache* subcaches[kSubCacheCount] =
36  for (int i = 0; i < kSubCacheCount; ++i) {
37  subcaches_[i] = subcaches[i];
38  }
39 }
CompilationCacheRegExp reg_exp_
CompilationCacheEval eval_contextual_
CompilationCacheScript script_
CompilationSubCache * subcaches_[kSubCacheCount]
CompilationCacheEval eval_global_
static const int kEvalContextualGenerations
static const int kRegExpGenerations
static const int kScriptGenerations
static const int kEvalGlobalGenerations

References eval_contextual_, eval_global_, kSubCacheCount, reg_exp_, script_, and subcaches_.

◆ ~CompilationCache()

v8::internal::CompilationCache::~CompilationCache ( )
private

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

42 {}

Member Function Documentation

◆ Clear()

void v8::internal::CompilationCache::Clear ( )

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

391  {
392  for (int i = 0; i < kSubCacheCount; i++) {
393  subcaches_[i]->Clear();
394  }
395 }

References v8::internal::CompilationSubCache::Clear(), kSubCacheCount, and subcaches_.

Referenced by v8::internal::Heap::AdvanceIdleIncrementalMarking(), v8::internal::Heap::CollectAllAvailableGarbage(), v8::internal::Heap::CreateInitialObjects(), and Disable().

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

◆ Disable()

void v8::internal::CompilationCache::Disable ( )

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

424  {
425  enabled_ = false;
426  Clear();
427 }

References Clear(), and enabled_.

Referenced by v8::internal::Debug::UpdateState().

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

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::CompilationCache::DISALLOW_COPY_AND_ASSIGN ( CompilationCache  )
private

◆ EagerOptimizingSet()

HashMap* v8::internal::CompilationCache::EagerOptimizingSet ( )
private

◆ Enable()

void v8::internal::CompilationCache::Enable ( )

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

419  {
420  enabled_ = true;
421 }

References enabled_.

Referenced by v8::internal::Debug::UpdateState().

+ Here is the caller graph for this function:

◆ IsEnabled()

bool v8::internal::CompilationCache::IsEnabled ( )
inlineprivate

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

220 { return FLAG_compilation_cache && enabled_; }

References enabled_.

Referenced by LookupEval(), LookupRegExp(), LookupScript(), PutEval(), PutRegExp(), PutScript(), and Remove().

+ Here is the caller graph for this function:

◆ isolate()

Isolate* v8::internal::CompilationCache::isolate ( )
inlineprivate

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

222 { return isolate_; }

References isolate_.

Referenced by PutEval().

+ Here is the caller graph for this function:

◆ Iterate()

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

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

398  {
399  for (int i = 0; i < kSubCacheCount; i++) {
400  subcaches_[i]->Iterate(v);
401  }
402 }

References v8::internal::CompilationSubCache::Iterate(), kSubCacheCount, and subcaches_.

Referenced by v8::internal::Heap::IterateStrongRoots().

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

◆ IterateFunctions()

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

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

405  {
406  for (int i = 0; i < kSubCacheCount; i++) {
408  }
409 }
void IterateFunctions(ObjectVisitor *v)

References v8::internal::CompilationSubCache::IterateFunctions(), kSubCacheCount, and subcaches_.

Referenced by v8::internal::MarkCompactCollector::PrepareForCodeFlushing().

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

◆ LookupEval()

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

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

330  {
331  if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>();
332 
333  MaybeHandle<SharedFunctionInfo> result;
334  if (context->IsNativeContext()) {
335  result = eval_global_.Lookup(
336  source, context, strict_mode, scope_position);
337  } else {
338  DCHECK(scope_position != RelocInfo::kNoPosition);
339  result = eval_contextual_.Lookup(
340  source, context, strict_mode, scope_position);
341  }
342  return result;
343 }
MaybeHandle< SharedFunctionInfo > Lookup(Handle< String > source, Handle< Context > context, StrictMode strict_mode, int scope_position)
static const int kNoPosition
Definition: assembler.h:317
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, eval_contextual_, eval_global_, IsEnabled(), v8::internal::RelocInfo::kNoPosition, and v8::internal::CompilationCacheEval::Lookup().

Referenced by v8::internal::Compiler::GetFunctionFromEval().

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

◆ LookupRegExp()

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

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

347  {
348  if (!IsEnabled()) return MaybeHandle<FixedArray>();
349 
350  return reg_exp_.Lookup(source, flags);
351 }
MaybeHandle< FixedArray > Lookup(Handle< String > source, JSRegExp::Flags flags)

References v8::internal::anonymous_namespace{flags.cc}::flags, IsEnabled(), v8::internal::CompilationCacheRegExp::Lookup(), and reg_exp_.

Referenced by v8::internal::RegExpImpl::Compile().

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

◆ LookupScript()

MaybeHandle< SharedFunctionInfo > v8::internal::CompilationCache::LookupScript ( Handle< String source,
Handle< Object name,
int  line_offset,
int  column_offset,
bool  is_shared_cross_origin,
Handle< Context context 
)

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

318  {
319  if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>();
320 
321  return script_.Lookup(source, name, line_offset, column_offset,
322  is_shared_cross_origin, context);
323 }
Handle< SharedFunctionInfo > Lookup(Handle< String > source, Handle< Object > name, int line_offset, int column_offset, bool is_shared_cross_origin, Handle< Context > context)
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 IsEnabled(), v8::internal::CompilationCacheScript::Lookup(), name, and script_.

Referenced by v8::internal::Compiler::CompileScript().

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

◆ MarkCompactPrologue()

void v8::internal::CompilationCache::MarkCompactPrologue ( )

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

412  {
413  for (int i = 0; i < kSubCacheCount; i++) {
414  subcaches_[i]->Age();
415  }
416 }

References v8::internal::CompilationSubCache::Age(), kSubCacheCount, and subcaches_.

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

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

◆ PutEval()

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

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

366  {
367  if (!IsEnabled()) return;
368 
369  HandleScope scope(isolate());
370  if (context->IsNativeContext()) {
371  eval_global_.Put(source, context, function_info, scope_position);
372  } else {
373  DCHECK(scope_position != RelocInfo::kNoPosition);
374  eval_contextual_.Put(source, context, function_info, scope_position);
375  }
376 }
void Put(Handle< String > source, Handle< Context > context, Handle< SharedFunctionInfo > function_info, int scope_position)

References DCHECK, eval_contextual_, eval_global_, IsEnabled(), isolate(), v8::internal::RelocInfo::kNoPosition, and v8::internal::CompilationCacheEval::Put().

Referenced by v8::internal::Compiler::GetFunctionFromEval().

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

◆ PutRegExp()

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

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

382  {
383  if (!IsEnabled()) {
384  return;
385  }
386 
387  reg_exp_.Put(source, flags, data);
388 }
void Put(Handle< String > source, JSRegExp::Flags flags, Handle< FixedArray > data)

References v8::internal::anonymous_namespace{flags.cc}::flags, IsEnabled(), v8::internal::CompilationCacheRegExp::Put(), and reg_exp_.

Referenced by v8::internal::RegExpImpl::Compile().

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

◆ PutScript()

void v8::internal::CompilationCache::PutScript ( Handle< String source,
Handle< Context context,
Handle< SharedFunctionInfo function_info 
)

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

356  {
357  if (!IsEnabled()) return;
358 
359  script_.Put(source, context, function_info);
360 }
void Put(Handle< String > source, Handle< Context > context, Handle< SharedFunctionInfo > function_info)

References IsEnabled(), v8::internal::CompilationCacheScript::Put(), and script_.

Referenced by v8::internal::Compiler::CompileScript().

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

◆ Remove()

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

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

303  {
304  if (!IsEnabled()) return;
305 
306  eval_global_.Remove(function_info);
307  eval_contextual_.Remove(function_info);
308  script_.Remove(function_info);
309 }
void Remove(Handle< SharedFunctionInfo > function_info)

References eval_contextual_, eval_global_, IsEnabled(), v8::internal::CompilationSubCache::Remove(), and script_.

Referenced by v8::internal::LiveEdit::ReplaceFunctionCode().

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

Member Data Documentation

◆ enabled_

bool v8::internal::CompilationCache::enabled_
private

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

Referenced by Disable(), Enable(), and IsEnabled().

◆ eval_contextual_

CompilationCacheEval v8::internal::CompilationCache::eval_contextual_
private

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

Referenced by CompilationCache(), LookupEval(), PutEval(), and Remove().

◆ eval_global_

CompilationCacheEval v8::internal::CompilationCache::eval_global_
private

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

Referenced by CompilationCache(), LookupEval(), PutEval(), and Remove().

◆ isolate_

Isolate* v8::internal::CompilationCache::isolate_
private

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

Referenced by isolate().

◆ kSubCacheCount

const int v8::internal::CompilationCache::kSubCacheCount = 4
staticprivate

◆ reg_exp_

CompilationCacheRegExp v8::internal::CompilationCache::reg_exp_
private

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

Referenced by CompilationCache(), LookupRegExp(), and PutRegExp().

◆ script_

CompilationCacheScript v8::internal::CompilationCache::script_
private

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

Referenced by CompilationCache(), LookupScript(), PutScript(), and Remove().

◆ subcaches_

CompilationSubCache* v8::internal::CompilationCache::subcaches_[kSubCacheCount]
private

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