V8 Project
v8::internal::StringTracker Class Reference

#include <api.h>

+ Collaboration diagram for v8::internal::StringTracker:

Public Member Functions

void RecordWrite (Handle< String > string)
 
bool IsFreshUnusedString (Handle< String > string)
 

Private Member Functions

 StringTracker ()
 
bool IsUseCountLow (Address top)
 
void IncrementUseCount (Address top)
 
 DISALLOW_COPY_AND_ASSIGN (StringTracker)
 

Static Private Member Functions

static bool IsFreshString (Address string, Address top)
 

Private Attributes

int use_count_
 
Address last_top_
 
Isolateisolate_
 

Static Private Attributes

static const int kFreshnessLimit = 1024
 
static const int kUseLimit = 32
 

Friends

class Isolate
 

Detailed Description

Definition at line 395 of file api.h.

Constructor & Destructor Documentation

◆ StringTracker()

v8::internal::StringTracker::StringTracker ( )
inlineprivate

Definition at line 418 of file api.h.

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

Member Function Documentation

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::StringTracker::DISALLOW_COPY_AND_ASSIGN ( StringTracker  )
private

◆ IncrementUseCount()

void v8::internal::StringTracker::IncrementUseCount ( Address  top)
inlineprivate

Definition at line 429 of file api.h.

429  {
430  if (last_top_ != top) {
431  use_count_ = 0;
432  last_top_ = top;
433  }
434  ++use_count_;
435  }

References last_top_, and use_count_.

Referenced by RecordWrite().

+ Here is the caller graph for this function:

◆ IsFreshString()

static bool v8::internal::StringTracker::IsFreshString ( Address  string,
Address  top 
)
inlinestaticprivate

Definition at line 420 of file api.h.

420  {
421  return top - kFreshnessLimit <= string && string <= top;
422  }
static const int kFreshnessLimit
Definition: api.h:446

References kFreshnessLimit.

Referenced by IsFreshUnusedString(), and RecordWrite().

+ Here is the caller graph for this function:

◆ IsFreshUnusedString()

bool v8::internal::StringTracker::IsFreshUnusedString ( Handle< String string)
inline

Definition at line 411 of file api.h.

411  {
412  Address address = reinterpret_cast<Address>(*string);
413  Address top = isolate_->heap()->NewSpaceTop();
414  return IsFreshString(address, top) && IsUseCountLow(top);
415  }
Address NewSpaceTop()
Definition: heap.h:591
bool IsUseCountLow(Address top)
Definition: api.h:424
static bool IsFreshString(Address string, Address top)
Definition: api.h:420
byte * Address
Definition: globals.h:101

References v8::internal::Isolate::heap(), IsFreshString(), isolate_, IsUseCountLow(), and v8::internal::Heap::NewSpaceTop().

Referenced by v8::String::CanMakeExternal(), and v8::String::MakeExternal().

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

◆ IsUseCountLow()

bool v8::internal::StringTracker::IsUseCountLow ( Address  top)
inlineprivate

Definition at line 424 of file api.h.

424  {
425  if (last_top_ != top) return true;
426  return use_count_ < kUseLimit;
427  }
static const int kUseLimit
Definition: api.h:449

References kUseLimit, last_top_, and use_count_.

Referenced by IsFreshUnusedString().

+ Here is the caller graph for this function:

◆ RecordWrite()

void v8::internal::StringTracker::RecordWrite ( Handle< String string)
inline

Definition at line 400 of file api.h.

400  {
401  Address address = reinterpret_cast<Address>(*string);
402  Address top = isolate_->heap()->NewSpaceTop();
403  if (IsFreshString(address, top)) {
404  IncrementUseCount(top);
405  }
406  }
void IncrementUseCount(Address top)
Definition: api.h:429

References v8::internal::Isolate::heap(), IncrementUseCount(), IsFreshString(), isolate_, and v8::internal::Heap::NewSpaceTop().

Referenced by v8::WriteHelper().

+ 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 451 of file api.h.

Member Data Documentation

◆ isolate_

Isolate* v8::internal::StringTracker::isolate_
private

Definition at line 443 of file api.h.

Referenced by v8::internal::Isolate::Init(), IsFreshUnusedString(), and RecordWrite().

◆ kFreshnessLimit

const int v8::internal::StringTracker::kFreshnessLimit = 1024
staticprivate

Definition at line 446 of file api.h.

Referenced by IsFreshString().

◆ kUseLimit

const int v8::internal::StringTracker::kUseLimit = 32
staticprivate

Definition at line 449 of file api.h.

Referenced by IsUseCountLow().

◆ last_top_

Address v8::internal::StringTracker::last_top_
private

Definition at line 441 of file api.h.

Referenced by IncrementUseCount(), and IsUseCountLow().

◆ use_count_

int v8::internal::StringTracker::use_count_
private

Definition at line 438 of file api.h.

Referenced by IncrementUseCount(), and IsUseCountLow().


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