V8 Project
v8::internal::DependentCode Class Reference

#include <objects.h>

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

Classes

class  GroupStartIndexes
 

Public Types

enum  DependencyGroup {
  kWeakICGroup , kWeakCodeGroup , kTransitionGroup , kPrototypeCheckGroup ,
  kElementsCantBeAddedGroup , kPropertyCellChangedGroup , kFieldTypeGroup , kInitialMapChangedGroup ,
  kAllocationSiteTenuringChangedGroup , kAllocationSiteTransitionChangedGroup
}
 
- Public Types inherited from v8::internal::Object
enum  StoreFromKeyed { MAY_BE_STORE_FROM_KEYED , CERTAINLY_NOT_STORE_FROM_KEYED }
 
enum  StorePropertyMode { NORMAL_PROPERTY , SUPER_PROPERTY }
 

Public Member Functions

bool Contains (DependencyGroup group, Code *code)
 
void UpdateToFinishedCode (DependencyGroup group, CompilationInfo *info, Code *code)
 
void RemoveCompilationInfo (DependentCode::DependencyGroup group, CompilationInfo *info)
 
void DeoptimizeDependentCodeGroup (Isolate *isolate, DependentCode::DependencyGroup group)
 
bool MarkCodeForDeoptimization (Isolate *isolate, DependentCode::DependencyGroup group)
 
void AddToDependentICList (Handle< Code > stub)
 
int number_of_entries (DependencyGroup group)
 
void set_number_of_entries (DependencyGroup group, int value)
 
bool is_code_at (int i)
 
Codecode_at (int i)
 
CompilationInfocompilation_info_at (int i)
 
void set_object_at (int i, Object *object)
 
Object ** slot_at (int i)
 
Objectobject_at (int i)
 
void clear_at (int i)
 
void copy (int from, int to)
 
- Public Member Functions inherited from v8::internal::FixedArray
Objectget (int index)
 
void set (int index, Object *value)
 
bool is_the_hole (int index)
 
void set (int index, Smi *value)
 
void set (int index, Object *value, WriteBarrierMode mode)
 
void set_undefined (int index)
 
void set_null (int index)
 
void set_the_hole (int index)
 
Object ** GetFirstElementAddress ()
 
bool ContainsOnlySmisOrHoles ()
 
Object ** data_start ()
 
void FillWithHoles (int from, int to)
 
void Shrink (int length)
 
void CopyTo (int pos, FixedArray *dest, int dest_pos, int len)
 
Object ** RawFieldOfElementAt (int index)
 
void SwapPairs (FixedArray *numbers, int i, int j)
 
void SortPairs (FixedArray *numbers, uint32_t len)
 
- Public Member Functions inherited from v8::internal::FixedArrayBase
int length () const
 
void set_length (int value)
 
int synchronized_length () const
 
void synchronized_set_length (int value)
 
- Public Member Functions inherited from v8::internal::HeapObject
Mapmap () const
 
void set_map (Map *value)
 
void set_map_no_write_barrier (Map *value)
 
Mapsynchronized_map ()
 
MapWord synchronized_map_word () const
 
void synchronized_set_map (Map *value)
 
void synchronized_set_map_no_write_barrier (Map *value)
 
void synchronized_set_map_word (MapWord map_word)
 
MapWord map_word () const
 
void set_map_word (MapWord map_word)
 
HeapGetHeap () const
 
IsolateGetIsolate () const
 
Address address ()
 
void Iterate (ObjectVisitor *v)
 
void IterateBody (InstanceType type, int object_size, ObjectVisitor *v)
 
int Size ()
 
bool MayContainRawValues ()
 
int SizeFromMap (Map *map)
 
WriteBarrierMode GetWriteBarrierMode (const DisallowHeapAllocation &promise)
 
void HeapObjectShortPrint (OStream &os)
 
 STATIC_ASSERT (kMapOffset==Internals::kHeapObjectMapOffset)
 
- Public Member Functions inherited from v8::internal::Object
bool IsObject () const
 
 INLINE (bool IsFixedArrayBase() const)
 
 INLINE (bool IsExternal() const)
 
 INLINE (bool IsAccessorInfo() const)
 
 INLINE (bool IsStruct() const)
 
 INLINE (bool IsSpecObject()) const
 
 INLINE (bool IsSpecFunction()) const
 
 INLINE (bool IsTemplateInfo()) const
 
 INLINE (bool IsNameDictionary() const)
 
 INLINE (bool IsSeededNumberDictionary() const)
 
 INLINE (bool IsUnseededNumberDictionary() const)
 
 INLINE (bool IsOrderedHashSet() const)
 
 INLINE (bool IsOrderedHashMap() const)
 
bool IsCallable () const
 
 INLINE (bool IsUndefined() const)
 
 INLINE (bool IsNull() const)
 
 INLINE (bool IsTheHole() const)
 
 INLINE (bool IsException() const)
 
 INLINE (bool IsUninitialized() const)
 
 INLINE (bool IsTrue() const)
 
 INLINE (bool IsFalse() const)
 
 INLINE (bool IsArgumentsMarker() const)
 
 INLINE (bool IsFiller() const)
 
double Number ()
 
 INLINE (bool IsNaN() const)
 
 INLINE (bool IsMinusZero() const)
 
bool ToInt32 (int32_t *value)
 
bool ToUint32 (uint32_t *value)
 
Representation OptimalRepresentation ()
 
bool FitsRepresentation (Representation representation)
 
Handle< HeapTypeOptimalType (Isolate *isolate, Representation representation)
 
bool HasValidElements ()
 
bool HasSpecificClassOf (String *name)
 
bool BooleanValue ()
 
ObjectGetHash ()
 
bool SameValue (Object *other)
 
bool SameValueZero (Object *other)
 
bool ToArrayIndex (uint32_t *index)
 
bool IsStringObjectWithCharacterAt (uint32_t index)
 
void VerifyApiCallResultType ()
 
void ShortPrint (FILE *out=stdout)
 
void ShortPrint (StringStream *accumulator)
 

Static Public Member Functions

static Handle< DependentCodeInsert (Handle< DependentCode > entries, DependencyGroup group, Handle< Object > object)
 
static DependentCodeForObject (Handle< HeapObject > object, DependencyGroup group)
 
static const char * DependencyGroupName (DependencyGroup group)
 
static void SetMarkedForDeoptimization (Code *code, DependencyGroup group)
 
- Static Public Member Functions inherited from v8::internal::FixedArray
static Handle< Objectget (Handle< FixedArray > array, int index)
 
static Handle< FixedArrayCopySize (Handle< FixedArray > array, int new_length, PretenureFlag pretenure=NOT_TENURED)
 
static MUST_USE_RESULT MaybeHandle< FixedArrayAddKeysFromArrayLike (Handle< FixedArray > content, Handle< JSObject > array)
 
static MUST_USE_RESULT MaybeHandle< FixedArrayUnionOfKeys (Handle< FixedArray > first, Handle< FixedArray > second)
 
static int SizeFor (int length)
 
static int OffsetOfElementAt (int index)
 
- Static Public Member Functions inherited from v8::internal::HeapObject
static HeapObjectFromAddress (Address address)
 
static Object ** RawField (HeapObject *obj, int offset)
 
static void UpdateMapCodeCache (Handle< HeapObject > object, Handle< Name > name, Handle< Code > code)
 
- Static Public Member Functions inherited from v8::internal::Object
static Handle< ObjectNewStorageFor (Isolate *isolate, Handle< Object > object, Representation representation)
 
static Handle< ObjectWrapForRead (Isolate *isolate, Handle< Object > object, Representation representation)
 
static MaybeHandle< JSReceiverToObject (Isolate *isolate, Handle< Object > object)
 
static MaybeHandle< JSReceiverToObject (Isolate *isolate, Handle< Object > object, Handle< Context > context)
 
static MUST_USE_RESULT MaybeHandle< SmiToSmi (Isolate *isolate, Handle< Object > object)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (LookupIterator *it)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetProperty (Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetProperty (LookupIterator *it, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode, StorePropertyMode data_store_mode=NORMAL_PROPERTY)
 
static MUST_USE_RESULT MaybeHandle< ObjectWriteToReadOnlyProperty (LookupIterator *it, Handle< Object > value, StrictMode strict_mode)
 
static Handle< ObjectSetDataProperty (LookupIterator *it, Handle< Object > value)
 
static MUST_USE_RESULT MaybeHandle< ObjectAddDataProperty (LookupIterator *it, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, StoreFromKeyed store_mode)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyOrElement (Handle< Object > object, Handle< Name > key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (Isolate *isolate, Handle< Object > object, const char *key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (Handle< Object > object, Handle< Name > key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyWithAccessor (Handle< Object > receiver, Handle< Name > name, Handle< JSObject > holder, Handle< Object > structure)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyWithAccessor (Handle< Object > receiver, Handle< Name > name, Handle< Object > value, Handle< JSObject > holder, Handle< Object > structure, StrictMode strict_mode)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyWithDefinedGetter (Handle< Object > receiver, Handle< JSReceiver > getter)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyWithDefinedSetter (Handle< Object > receiver, Handle< JSReceiver > setter, Handle< Object > value)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetElement (Isolate *isolate, Handle< Object > object, uint32_t index)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetElementWithReceiver (Isolate *isolate, Handle< Object > object, Handle< Object > receiver, uint32_t index)
 
static Handle< SmiGetOrCreateHash (Isolate *isolate, Handle< Object > object)
 

Static Public Attributes

static const int kGroupCount = kAllocationSiteTransitionChangedGroup + 1
 
- Static Public Attributes inherited from v8::internal::FixedArray
static const int kMaxSize = 128 * MB * kPointerSize
 
static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize
 
- Static Public Attributes inherited from v8::internal::FixedArrayBase
static const int kLengthOffset = HeapObject::kHeaderSize
 
static const int kHeaderSize = kLengthOffset + kPointerSize
 
- Static Public Attributes inherited from v8::internal::HeapObject
static const int kMapOffset = Object::kHeaderSize
 
static const int kHeaderSize = kMapOffset + kPointerSize
 
- Static Public Attributes inherited from v8::internal::Object
static const int kHeaderSize = 0
 

Private Member Functions

void ExtendGroup (DependencyGroup group)
 

Static Private Attributes

static const int kCodesStartIndex = kGroupCount
 

Additional Inherited Members

- Protected Member Functions inherited from v8::internal::HeapObject
void IteratePointers (ObjectVisitor *v, int start, int end)
 
void IteratePointer (ObjectVisitor *v, int offset)
 
void IterateNextCodeLink (ObjectVisitor *v, int offset)
 
- Static Protected Member Functions inherited from v8::internal::FixedArray
static void NoWriteBarrierSet (FixedArray *array, int index, Object *value)
 
static void NoIncrementalWriteBarrierSet (FixedArray *array, int index, Object *value)
 

Detailed Description

Definition at line 5495 of file objects.h.

Member Enumeration Documentation

◆ DependencyGroup

Enumerator
kWeakICGroup 
kWeakCodeGroup 
kTransitionGroup 
kPrototypeCheckGroup 
kElementsCantBeAddedGroup 
kPropertyCellChangedGroup 
kFieldTypeGroup 
kInitialMapChangedGroup 
kAllocationSiteTenuringChangedGroup 
kAllocationSiteTransitionChangedGroup 

Definition at line 5497 of file objects.h.

5497  {
5498  // Group of IC stubs that weakly embed this map and depend on being
5499  // invalidated when the map is garbage collected. Dependent IC stubs form
5500  // a linked list. This group stores only the head of the list. This means
5501  // that the number_of_entries(kWeakICGroup) is 0 or 1.
5502  kWeakICGroup,
5503  // Group of code that weakly embed this map and depend on being
5504  // deoptimized when the map is garbage collected.
5506  // Group of code that embed a transition to this map, and depend on being
5507  // deoptimized when the transition is replaced by a new version.
5509  // Group of code that omit run-time prototype checks for prototypes
5510  // described by this map. The group is deoptimized whenever an object
5511  // described by this map changes shape (and transitions to a new map),
5512  // possibly invalidating the assumptions embedded in the code.
5514  // Group of code that depends on elements not being added to objects with
5515  // this map.
5517  // Group of code that depends on global property values in property cells
5518  // not being changed.
5520  // Group of code that omit run-time type checks for the field(s) introduced
5521  // by this map.
5523  // Group of code that omit run-time type checks for initial maps of
5524  // constructors.
5526  // Group of code that depends on tenuring information in AllocationSites
5527  // not being changed.
5529  // Group of code that depends on element transition information in
5530  // AllocationSites not being changed.
5532  };

Member Function Documentation

◆ AddToDependentICList()

void v8::internal::DependentCode::AddToDependentICList ( Handle< Code stub)

Definition at line 11584 of file objects.cc.

11584  {
11585  DisallowHeapAllocation no_heap_allocation;
11586  GroupStartIndexes starts(this);
11587  int i = starts.at(kWeakICGroup);
11588  Object* head = object_at(i);
11589  // Try to insert the stub after the head of the list to minimize number of
11590  // writes to the DependentCode array, since a write to the array can make it
11591  // strong if it was alread marked by incremental marker.
11592  if (head->IsCode()) {
11593  stub->set_next_code_link(Code::cast(head)->next_code_link());
11594  Code::cast(head)->set_next_code_link(*stub);
11595  } else {
11596  stub->set_next_code_link(head);
11597  set_object_at(i, *stub);
11598  }
11599 }
void set_object_at(int i, Object *object)
Definition: objects-inl.h:4580
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
Definition: assert-scope.h:110
kSerializedDataOffset Object
Definition: objects-inl.h:5322

References v8::internal::DependentCode::GroupStartIndexes::at(), kWeakICGroup, object_at(), and set_object_at().

+ Here is the call graph for this function:

◆ clear_at()

void v8::internal::DependentCode::clear_at ( int  i)
inline

Definition at line 4595 of file objects-inl.h.

4595  {
4597 }
static const int kCodesStartIndex
Definition: objects.h:5589
void set_undefined(int index)
Definition: objects-inl.h:2704

References kCodesStartIndex, and v8::internal::FixedArray::set_undefined().

Referenced by v8::internal::MarkCompactCollector::ClearDependentCode(), v8::internal::MarkCompactCollector::ClearNonLiveDependentCode(), MarkCodeForDeoptimization(), and RemoveCompilationInfo().

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

◆ code_at()

Code * v8::internal::DependentCode::code_at ( int  i)
inline

Definition at line 4569 of file objects-inl.h.

4569  {
4570  return Code::cast(get(kCodesStartIndex + i));
4571 }
Object * get(int index)
Definition: objects-inl.h:2165

References v8::internal::FixedArray::get(), and kCodesStartIndex.

Referenced by v8::internal::MarkCompactCollector::ClearDependentCode(), and MarkCodeForDeoptimization().

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

◆ compilation_info_at()

CompilationInfo * v8::internal::DependentCode::compilation_info_at ( int  i)
inline

Definition at line 4574 of file objects-inl.h.

4574  {
4575  return reinterpret_cast<CompilationInfo*>(
4576  Foreign::cast(get(kCodesStartIndex + i))->foreign_address());
4577 }

References v8::internal::FixedArray::get(), and kCodesStartIndex.

Referenced by MarkCodeForDeoptimization(), RemoveCompilationInfo(), and UpdateToFinishedCode().

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

◆ Contains()

bool v8::internal::DependentCode::Contains ( DependencyGroup  group,
Code code 
)

Definition at line 11521 of file objects.cc.

11521  {
11522  GroupStartIndexes starts(this);
11523  int start = starts.at(group);
11524  int end = starts.at(group + 1);
11525  if (group == kWeakICGroup) {
11526  return CodeListContains(object_at(start), code);
11527  }
11528  for (int i = start; i < end; i++) {
11529  if (object_at(i) == code) return true;
11530  }
11531  return false;
11532 }
static bool CodeListContains(Object *head, Code *code)
Definition: objects.cc:11512

References v8::internal::DependentCode::GroupStartIndexes::at(), v8::internal::CodeListContains(), kWeakICGroup, and object_at().

+ Here is the call graph for this function:

◆ copy()

void v8::internal::DependentCode::copy ( int  from,
int  to 
)
inline

Definition at line 4600 of file objects-inl.h.

4600  {
4602 }
void set(int index, Object *value)
Definition: objects-inl.h:2190
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 only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file

References v8::internal::FixedArray::get(), kCodesStartIndex, v8::internal::FixedArray::set(), and to().

Referenced by ExtendGroup(), MarkCodeForDeoptimization(), and RemoveCompilationInfo().

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

◆ DeoptimizeDependentCodeGroup()

void v8::internal::DependentCode::DeoptimizeDependentCodeGroup ( Isolate isolate,
DependentCode::DependencyGroup  group 
)

Definition at line 11573 of file objects.cc.

11575  {
11576  DCHECK(AllowCodeDependencyChange::IsAllowed());
11577  DisallowHeapAllocation no_allocation_scope;
11578  bool marked = MarkCodeForDeoptimization(isolate, group);
11579 
11580  if (marked) Deoptimizer::DeoptimizeMarkedCode(isolate);
11581 }
static void DeoptimizeMarkedCode(Isolate *isolate)
Definition: deoptimizer.cc:454
bool MarkCodeForDeoptimization(Isolate *isolate, DependentCode::DependencyGroup group)
Definition: objects.cc:11535
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, v8::internal::Deoptimizer::DeoptimizeMarkedCode(), and MarkCodeForDeoptimization().

+ Here is the call graph for this function:

◆ DependencyGroupName()

const char * v8::internal::DependentCode::DependencyGroupName ( DependencyGroup  group)
static

Definition at line 11618 of file objects.cc.

11618  {
11619  switch (group) {
11620  case kWeakICGroup:
11621  return "weak-ic";
11622  case kWeakCodeGroup:
11623  return "weak-code";
11624  case kTransitionGroup:
11625  return "transition";
11626  case kPrototypeCheckGroup:
11627  return "prototype-check";
11629  return "elements-cant-be-added";
11631  return "property-cell-changed";
11632  case kFieldTypeGroup:
11633  return "field-type";
11635  return "initial-map-changed";
11637  return "allocation-site-tenuring-changed";
11639  return "allocation-site-transition-changed";
11640  }
11641  UNREACHABLE();
11642  return "?";
11643 }
#define UNREACHABLE()
Definition: logging.h:30

References kAllocationSiteTenuringChangedGroup, kAllocationSiteTransitionChangedGroup, kElementsCantBeAddedGroup, kFieldTypeGroup, kInitialMapChangedGroup, kPropertyCellChangedGroup, kPrototypeCheckGroup, kTransitionGroup, kWeakCodeGroup, kWeakICGroup, and UNREACHABLE.

Referenced by SetMarkedForDeoptimization().

+ Here is the caller graph for this function:

◆ ExtendGroup()

void v8::internal::DependentCode::ExtendGroup ( DependencyGroup  group)
inlineprivate

Definition at line 4605 of file objects-inl.h.

4605  {
4606  GroupStartIndexes starts(this);
4607  for (int g = kGroupCount - 1; g > group; g--) {
4608  if (starts.at(g) < starts.at(g + 1)) {
4609  copy(starts.at(g), starts.at(g + 1));
4610  }
4611  }
4612 }
static const int kGroupCount
Definition: objects.h:5534
void copy(int from, int to)
Definition: objects-inl.h:4600

References v8::internal::DependentCode::GroupStartIndexes::at(), copy(), and kGroupCount.

+ Here is the call graph for this function:

◆ ForObject()

DependentCode * v8::internal::DependentCode::ForObject ( Handle< HeapObject object,
DependencyGroup  group 
)
static

Definition at line 11397 of file objects.cc.

11398  {
11399  AllowDeferredHandleDereference dependencies_are_safe;
11401  return Handle<PropertyCell>::cast(object)->dependent_code();
11404  return Handle<AllocationSite>::cast(object)->dependent_code();
11405  }
11406  return Handle<Map>::cast(object)->dependent_code();
11407 }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
PerThreadAssertScopeDebugOnly< DEFERRED_HANDLE_DEREFERENCE_ASSERT, true > AllowDeferredHandleDereference
Definition: assert-scope.h:130

References v8::internal::Handle< T >::cast(), kAllocationSiteTenuringChangedGroup, kAllocationSiteTransitionChangedGroup, and kPropertyCellChangedGroup.

Referenced by v8::internal::CompilationInfo::CommitDependencies(), and v8::internal::CompilationInfo::RollbackDependencies().

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

◆ Insert()

Handle< DependentCode > v8::internal::DependentCode::Insert ( Handle< DependentCode entries,
DependencyGroup  group,
Handle< Object object 
)
static

Definition at line 11410 of file objects.cc.

11412  {
11413  GroupStartIndexes starts(*entries);
11414  int start = starts.at(group);
11415  int end = starts.at(group + 1);
11416  int number_of_entries = starts.number_of_entries();
11417  // Check for existing entry to avoid duplicates.
11418  for (int i = start; i < end; i++) {
11419  if (entries->object_at(i) == *object) return entries;
11420  }
11421  if (entries->length() < kCodesStartIndex + number_of_entries + 1) {
11422  int capacity = kCodesStartIndex + number_of_entries + 1;
11423  if (capacity > 5) capacity = capacity * 5 / 4;
11424  Handle<DependentCode> new_entries = Handle<DependentCode>::cast(
11425  FixedArray::CopySize(entries, capacity, TENURED));
11426  // The number of codes can change after GC.
11427  starts.Recompute(*entries);
11428  start = starts.at(group);
11429  end = starts.at(group + 1);
11430  number_of_entries = starts.number_of_entries();
11431  for (int i = 0; i < number_of_entries; i++) {
11432  entries->clear_at(i);
11433  }
11434  // If the old fixed array was empty, we need to reset counters of the
11435  // new array.
11436  if (number_of_entries == 0) {
11437  for (int g = 0; g < kGroupCount; g++) {
11438  new_entries->set_number_of_entries(static_cast<DependencyGroup>(g), 0);
11439  }
11440  }
11441  entries = new_entries;
11442  }
11443  entries->ExtendGroup(group);
11444  entries->set_object_at(end, *object);
11445  entries->set_number_of_entries(group, end + 1 - start);
11446  return entries;
11447 }
int number_of_entries(DependencyGroup group)
Definition: objects-inl.h:4554
static Handle< FixedArray > CopySize(Handle< FixedArray > array, int new_length, PretenureFlag pretenure=NOT_TENURED)
Definition: objects.cc:7749

References v8::internal::DependentCode::GroupStartIndexes::at(), v8::internal::Handle< T >::cast(), v8::internal::FixedArray::CopySize(), kCodesStartIndex, kGroupCount, v8::internal::DependentCode::GroupStartIndexes::number_of_entries(), number_of_entries(), v8::internal::DependentCode::GroupStartIndexes::Recompute(), and v8::internal::TENURED.

Referenced by v8::internal::Map::AddDependentCode(), v8::internal::AllocationSite::AddDependentCompilationInfo(), v8::internal::Map::AddDependentCompilationInfo(), and v8::internal::PropertyCell::AddDependentCompilationInfo().

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

◆ is_code_at()

bool v8::internal::DependentCode::is_code_at ( int  i)
inline

Definition at line 4565 of file objects-inl.h.

4565  {
4566  return get(kCodesStartIndex + i)->IsCode();
4567 }

References v8::internal::FixedArray::get(), and kCodesStartIndex.

Referenced by v8::internal::MarkCompactCollector::ClearDependentCode(), MarkCodeForDeoptimization(), RemoveCompilationInfo(), and UpdateToFinishedCode().

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

◆ MarkCodeForDeoptimization()

bool v8::internal::DependentCode::MarkCodeForDeoptimization ( Isolate isolate,
DependentCode::DependencyGroup  group 
)

Definition at line 11535 of file objects.cc.

11537  {
11538  DisallowHeapAllocation no_allocation_scope;
11539  DependentCode::GroupStartIndexes starts(this);
11540  int start = starts.at(group);
11541  int end = starts.at(group + 1);
11542  int code_entries = starts.number_of_entries();
11543  if (start == end) return false;
11544 
11545  // Mark all the code that needs to be deoptimized.
11546  bool marked = false;
11547  for (int i = start; i < end; i++) {
11548  if (is_code_at(i)) {
11549  Code* code = code_at(i);
11550  if (!code->marked_for_deoptimization()) {
11551  SetMarkedForDeoptimization(code, group);
11552  marked = true;
11553  }
11554  } else {
11555  CompilationInfo* info = compilation_info_at(i);
11556  info->AbortDueToDependencyChange();
11557  }
11558  }
11559  // Compact the array by moving all subsequent groups to fill in the new holes.
11560  for (int src = end, dst = start; src < code_entries; src++, dst++) {
11561  copy(src, dst);
11562  }
11563  // Now the holes are at the end of the array, zap them for heap-verifier.
11564  int removed = end - start;
11565  for (int i = code_entries - removed; i < code_entries; i++) {
11566  clear_at(i);
11567  }
11568  set_number_of_entries(group, 0);
11569  return marked;
11570 }
static void SetMarkedForDeoptimization(Code *code, DependencyGroup group)
Definition: objects.cc:11602
void set_number_of_entries(DependencyGroup group, int value)
Definition: objects-inl.h:4560
CompilationInfo * compilation_info_at(int i)
Definition: objects-inl.h:4574

References v8::internal::CompilationInfo::AbortDueToDependencyChange(), v8::internal::DependentCode::GroupStartIndexes::at(), clear_at(), code_at(), compilation_info_at(), copy(), is_code_at(), v8::internal::Code::marked_for_deoptimization(), v8::internal::DependentCode::GroupStartIndexes::number_of_entries(), set_number_of_entries(), and SetMarkedForDeoptimization().

Referenced by DeoptimizeDependentCodeGroup().

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

◆ number_of_entries()

int v8::internal::DependentCode::number_of_entries ( DependencyGroup  group)
inline

Definition at line 4554 of file objects-inl.h.

4554  {
4555  if (length() == 0) return 0;
4556  return Smi::cast(get(group))->value();
4557 }

References v8::internal::FixedArray::get(), and v8::internal::FixedArrayBase::length().

Referenced by Insert(), and v8::internal::DependentCode::GroupStartIndexes::Recompute().

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

◆ object_at()

Object * v8::internal::DependentCode::object_at ( int  i)
inline

Definition at line 4585 of file objects-inl.h.

4585  {
4586  return get(kCodesStartIndex + i);
4587 }

References v8::internal::FixedArray::get(), and kCodesStartIndex.

Referenced by AddToDependentICList(), v8::internal::MarkCompactCollector::ClearDependentCode(), v8::internal::MarkCompactCollector::ClearNonLiveDependentCodeInGroup(), Contains(), RemoveCompilationInfo(), and UpdateToFinishedCode().

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

◆ RemoveCompilationInfo()

void v8::internal::DependentCode::RemoveCompilationInfo ( DependentCode::DependencyGroup  group,
CompilationInfo info 
)

Definition at line 11474 of file objects.cc.

11475  {
11476  DisallowHeapAllocation no_allocation;
11477  AllowDeferredHandleDereference get_object_wrapper;
11478  Foreign* info_wrapper = *info->object_wrapper();
11479  GroupStartIndexes starts(this);
11480  int start = starts.at(group);
11481  int end = starts.at(group + 1);
11482  // Find compilation info wrapper.
11483  int info_pos = -1;
11484  for (int i = start; i < end; i++) {
11485  if (object_at(i) == info_wrapper) {
11486  info_pos = i;
11487  break;
11488  }
11489  }
11490  if (info_pos == -1) return; // Not found.
11491  int gap = info_pos;
11492  // Use the last of each group to fill the gap in the previous group.
11493  for (int i = group; i < kGroupCount; i++) {
11494  int last_of_group = starts.at(i + 1) - 1;
11495  DCHECK(last_of_group >= gap);
11496  if (last_of_group == gap) continue;
11497  copy(last_of_group, gap);
11498  gap = last_of_group;
11499  }
11500  DCHECK(gap == starts.number_of_entries() - 1);
11501  clear_at(gap); // Clear last gap.
11502  set_number_of_entries(group, end - start - 1);
11503 
11504 #ifdef DEBUG
11505  for (int i = start; i < end - 1; i++) {
11506  DCHECK(is_code_at(i) || compilation_info_at(i) != info);
11507  }
11508 #endif
11509 }

References v8::internal::DependentCode::GroupStartIndexes::at(), clear_at(), compilation_info_at(), copy(), DCHECK, is_code_at(), kGroupCount, v8::internal::DependentCode::GroupStartIndexes::number_of_entries(), object_at(), v8::internal::CompilationInfo::object_wrapper(), and set_number_of_entries().

+ Here is the call graph for this function:

◆ set_number_of_entries()

void v8::internal::DependentCode::set_number_of_entries ( DependencyGroup  group,
int  value 
)
inline

Definition at line 4560 of file objects-inl.h.

4560  {
4561  set(group, Smi::FromInt(value));
4562 }
static Smi * FromInt(int value)
Definition: objects-inl.h:1321

References v8::internal::Smi::FromInt(), and v8::internal::FixedArray::set().

Referenced by v8::internal::MarkCompactCollector::ClearNonLiveDependentCodeInGroup(), MarkCodeForDeoptimization(), and RemoveCompilationInfo().

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

◆ set_object_at()

void v8::internal::DependentCode::set_object_at ( int  i,
Object object 
)
inline

Definition at line 4580 of file objects-inl.h.

4580  {
4581  set(kCodesStartIndex + i, object);
4582 }

References kCodesStartIndex, and v8::internal::FixedArray::set().

Referenced by AddToDependentICList(), v8::internal::MarkCompactCollector::ClearNonLiveDependentCodeInGroup(), and UpdateToFinishedCode().

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

◆ SetMarkedForDeoptimization()

void v8::internal::DependentCode::SetMarkedForDeoptimization ( Code code,
DependencyGroup  group 
)
static

Definition at line 11602 of file objects.cc.

11603  {
11604  code->set_marked_for_deoptimization(true);
11605  if (FLAG_trace_deopt &&
11606  (code->deoptimization_data() != code->GetHeap()->empty_fixed_array())) {
11607  DeoptimizationInputData* deopt_data =
11608  DeoptimizationInputData::cast(code->deoptimization_data());
11609  CodeTracer::Scope scope(code->GetHeap()->isolate()->GetCodeTracer());
11610  PrintF(scope.file(), "[marking dependent code 0x%08" V8PRIxPTR
11611  " (opt #%d) for deoptimization, reason: %s]\n",
11612  reinterpret_cast<intptr_t>(code),
11613  deopt_data->OptimizationId()->value(), DependencyGroupName(group));
11614  }
11615 }
static const char * DependencyGroupName(DependencyGroup group)
Definition: objects.cc:11618
#define V8PRIxPTR
Definition: macros.h:363
void PrintF(const char *format,...)
Definition: utils.cc:80

References DependencyGroupName(), v8::internal::Isolate::GetCodeTracer(), v8::internal::HeapObject::GetHeap(), v8::internal::Heap::isolate(), v8::internal::PrintF(), v8::internal::Code::set_marked_for_deoptimization(), and V8PRIxPTR.

Referenced by v8::internal::MarkCompactCollector::ClearDependentCode(), and MarkCodeForDeoptimization().

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

◆ slot_at()

Object ** v8::internal::DependentCode::slot_at ( int  i)
inline

Definition at line 4590 of file objects-inl.h.

4590  {
4592 }
Object ** RawFieldOfElementAt(int index)
Definition: objects.h:2458

References kCodesStartIndex, and v8::internal::FixedArray::RawFieldOfElementAt().

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

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

◆ UpdateToFinishedCode()

void v8::internal::DependentCode::UpdateToFinishedCode ( DependencyGroup  group,
CompilationInfo info,
Code code 
)

Definition at line 11450 of file objects.cc.

11452  {
11453  DisallowHeapAllocation no_gc;
11454  AllowDeferredHandleDereference get_object_wrapper;
11455  Foreign* info_wrapper = *info->object_wrapper();
11456  GroupStartIndexes starts(this);
11457  int start = starts.at(group);
11458  int end = starts.at(group + 1);
11459  for (int i = start; i < end; i++) {
11460  if (object_at(i) == info_wrapper) {
11461  set_object_at(i, code);
11462  break;
11463  }
11464  }
11465 
11466 #ifdef DEBUG
11467  for (int i = start; i < end; i++) {
11468  DCHECK(is_code_at(i) || compilation_info_at(i) != info);
11469  }
11470 #endif
11471 }

References v8::internal::DependentCode::GroupStartIndexes::at(), compilation_info_at(), DCHECK, is_code_at(), object_at(), v8::internal::CompilationInfo::object_wrapper(), and set_object_at().

+ Here is the call graph for this function:

Member Data Documentation

◆ kCodesStartIndex

const int v8::internal::DependentCode::kCodesStartIndex = kGroupCount
staticprivate

◆ kGroupCount


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