5 #ifndef V8_OBJECTS_ALLOCATION_SITE_H_ 6 #define V8_OBJECTS_ALLOCATION_SITE_H_ 8 #include "src/objects.h" 11 #include "src/objects/object-macros.h" 16 enum InstanceType : uint16_t;
20 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
21 static const double kPretenureRatio;
22 static const int kPretenureMinimumCreated = 100;
25 enum PretenureDecision {
31 kLastPretenureDecisionValue = kZombie
34 const char* PretenureDecisionName(PretenureDecision decision);
38 DECL_ACCESSORS(transition_info_or_boilerplate,
Object)
39 DECL_ACCESSORS(boilerplate,
JSObject)
40 DECL_INT_ACCESSORS(transition_info)
45 DECL_ACCESSORS(nested_site,
Object)
48 DECL_INT32_ACCESSORS(pretenure_data)
50 DECL_INT32_ACCESSORS(pretenure_create_count)
56 DECL_ACCESSORS(weak_next,
Object)
58 inline void Initialize();
61 inline bool HasWeakNext()
const;
75 STATIC_ASSERT(PretenureDecisionBits::kMax >= kLastPretenureDecisionValue);
79 inline bool IncrementMementoFoundCount(
int increment = 1);
81 inline void IncrementMementoCreateCount();
83 PretenureFlag GetPretenureMode()
const;
85 void ResetPretenureDecision();
87 inline PretenureDecision pretenure_decision()
const;
88 inline void set_pretenure_decision(PretenureDecision decision);
90 inline bool deopt_dependent_code()
const;
91 inline void set_deopt_dependent_code(
bool deopt);
93 inline int memento_found_count()
const;
94 inline void set_memento_found_count(
int count);
96 inline int memento_create_count()
const;
97 inline void set_memento_create_count(
int count);
103 inline bool IsZombie()
const;
105 inline bool IsMaybeTenure()
const;
107 inline void MarkZombie();
109 inline bool MakePretenureDecision(PretenureDecision current_decision,
110 double ratio,
bool maximum_size_scavenge);
112 inline bool DigestPretenuringFeedback(
bool maximum_size_scavenge);
114 inline ElementsKind GetElementsKind()
const;
115 inline void SetElementsKind(ElementsKind kind);
117 inline bool CanInlineCall()
const;
118 inline void SetDoNotInlineCall();
120 inline bool PointsToLiteral()
const;
122 template <AllocationSiteUpdateMode update_or_check =
123 AllocationSiteUpdateMode::kUpdate>
125 ElementsKind to_kind);
131 static inline bool ShouldTrack(ElementsKind boilerplate_elements_kind);
132 static bool ShouldTrack(ElementsKind from, ElementsKind to);
133 static inline bool CanTrack(InstanceType
type);
138 #define ALLOCATION_SITE_FIELDS(V) \ 140 V(kTransitionInfoOrBoilerplateOffset, kTaggedSize) \ 141 V(kNestedSiteOffset, kTaggedSize) \ 142 V(kDependentCodeOffset, kTaggedSize) \ 143 V(kCommonPointerFieldEndOffset, 0) \ 144 V(kPretenureDataOffset, kInt32Size) \ 145 V(kPretenureCreateCountOffset, kInt32Size) \ 147 V(kSizeWithoutWeakNext, 0) \ 148 V(kWeakNextOffset, kTaggedSize) \ 150 V(kSizeWithWeakNext, 0) 152 DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, ALLOCATION_SITE_FIELDS)
153 #undef ALLOCATION_SITE_FIELDS 158 inline bool PretenuringDecisionMade()
const;
166 #define ALLOCATION_MEMENTO_FIELDS(V) \ 167 V(kAllocationSiteOffset, kTaggedSize) \ 170 DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
171 ALLOCATION_MEMENTO_FIELDS)
172 #undef ALLOCATION_MEMENTO_FIELDS 174 DECL_ACCESSORS(allocation_site,
Object)
176 inline bool IsValid()
const;
178 inline Address GetAllocationSiteUnchecked()
const;
192 #include "src/objects/object-macros-undef.h" 194 #endif // V8_OBJECTS_ALLOCATION_SITE_H_