V8 Project
v8::internal::TypeFeedbackOracle Class Reference

#include <type-info.h>

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

Public Member Functions

 TypeFeedbackOracle (Handle< Code > code, Handle< TypeFeedbackVector > feedback_vector, Handle< Context > native_context, Zone *zone)
 
bool LoadIsUninitialized (TypeFeedbackId id)
 
bool StoreIsUninitialized (TypeFeedbackId id)
 
bool StoreIsKeyedPolymorphic (TypeFeedbackId id)
 
bool CallIsMonomorphic (int slot)
 
bool CallIsMonomorphic (TypeFeedbackId aid)
 
bool KeyedArrayCallIsHoley (TypeFeedbackId id)
 
bool CallNewIsMonomorphic (int slot)
 
byte ForInType (int feedback_vector_slot)
 
KeyedAccessStoreMode GetStoreMode (TypeFeedbackId id)
 
void PropertyReceiverTypes (TypeFeedbackId id, Handle< String > name, SmallMapList *receiver_types)
 
void KeyedPropertyReceiverTypes (TypeFeedbackId id, SmallMapList *receiver_types, bool *is_string)
 
void AssignmentReceiverTypes (TypeFeedbackId id, Handle< String > name, SmallMapList *receiver_types)
 
void KeyedAssignmentReceiverTypes (TypeFeedbackId id, SmallMapList *receiver_types, KeyedAccessStoreMode *store_mode)
 
void CountReceiverTypes (TypeFeedbackId id, SmallMapList *receiver_types)
 
void CollectReceiverTypes (TypeFeedbackId id, SmallMapList *types)
 
Handle< JSFunctionGetCallTarget (int slot)
 
Handle< AllocationSiteGetCallAllocationSite (int slot)
 
Handle< JSFunctionGetCallNewTarget (int slot)
 
Handle< AllocationSiteGetCallNewAllocationSite (int slot)
 
bool LoadIsBuiltin (TypeFeedbackId id, Builtins::Name builtin_id)
 
byte ToBooleanTypes (TypeFeedbackId id)
 
void BinaryType (TypeFeedbackId id, Type **left, Type **right, Type **result, Maybe< int > *fixed_right_arg, Handle< AllocationSite > *allocation_site, Token::Value operation)
 
void CompareType (TypeFeedbackId id, Type **left, Type **right, Type **combined)
 
TypeCountType (TypeFeedbackId id)
 
Zonezone () const
 
Isolateisolate () const
 
- Public Member Functions inherited from v8::internal::ZoneObject
 INLINE (void *operator new(size_t size, Zone *zone))
 
void operator delete (void *, size_t)
 
void operator delete (void *pointer, Zone *zone)
 

Static Public Member Functions

static bool CanRetainOtherContext (Map *map, Context *native_context)
 
static bool CanRetainOtherContext (JSFunction *function, Context *native_context)
 

Private Member Functions

void CollectReceiverTypes (TypeFeedbackId id, Handle< String > name, Code::Flags flags, SmallMapList *types)
 
void SetInfo (TypeFeedbackId id, Object *target)
 
void BuildDictionary (Handle< Code > code)
 
void GetRelocInfos (Handle< Code > code, ZoneList< RelocInfo > *infos)
 
void CreateDictionary (Handle< Code > code, ZoneList< RelocInfo > *infos)
 
void RelocateRelocInfos (ZoneList< RelocInfo > *infos, Code *old_code, Code *new_code)
 
void ProcessRelocInfos (ZoneList< RelocInfo > *infos)
 
Handle< ObjectGetInfo (TypeFeedbackId id)
 
Handle< ObjectGetInfo (int slot)
 
 DISALLOW_COPY_AND_ASSIGN (TypeFeedbackOracle)
 

Private Attributes

Handle< Contextnative_context_
 
Zonezone_
 
Handle< UnseededNumberDictionarydictionary_
 
Handle< TypeFeedbackVectorfeedback_vector_
 

Detailed Description

Definition at line 20 of file type-info.h.

Constructor & Destructor Documentation

◆ TypeFeedbackOracle()

v8::internal::TypeFeedbackOracle::TypeFeedbackOracle ( Handle< Code code,
Handle< TypeFeedbackVector feedback_vector,
Handle< Context native_context,
Zone zone 
)

Definition at line 21 of file type-info.cc.

24  : native_context_(native_context), zone_(zone) {
25  BuildDictionary(code);
26  DCHECK(dictionary_->IsDictionary());
27  // We make a copy of the feedback vector because a GC could clear
28  // the type feedback info contained therein.
29  // TODO(mvstanton): revisit the decision to copy when we weakly
30  // traverse the feedback vector at GC time.
32 }
Handle< Context > native_context_
Definition: type-info.h:119
Handle< TypeFeedbackVector > feedback_vector_
Definition: type-info.h:122
void BuildDictionary(Handle< Code > code)
Definition: type-info.cc:391
Handle< UnseededNumberDictionary > dictionary_
Definition: type-info.h:121
Isolate * isolate() const
Definition: type-info.h:92
static Handle< TypeFeedbackVector > Copy(Isolate *isolate, Handle< TypeFeedbackVector > vector)
#define DCHECK(condition)
Definition: logging.h:205

References BuildDictionary(), v8::internal::TypeFeedbackVector::Copy(), DCHECK, dictionary_, v8::internal::feedback_vector, feedback_vector_, and isolate().

+ Here is the call graph for this function:

Member Function Documentation

◆ AssignmentReceiverTypes()

void v8::internal::TypeFeedbackOracle::AssignmentReceiverTypes ( TypeFeedbackId  id,
Handle< String name,
SmallMapList *  receiver_types 
)

Definition at line 278 of file type-info.cc.

279  {
280  receiver_types->Clear();
281  Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC);
282  CollectReceiverTypes(id, name, flags, receiver_types);
283 }
static Flags ComputeHandlerFlags(Kind handler_kind, StubType type=NORMAL, CacheHolderFlag holder=kCacheOnReceiver)
Definition: objects-inl.h:4975
uint32_t Flags
Definition: objects.h:4929
void CollectReceiverTypes(TypeFeedbackId id, SmallMapList *types)
Definition: type-info.cc:357
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 CollectReceiverTypes(), v8::internal::Code::ComputeHandlerFlags(), v8::internal::anonymous_namespace{flags.cc}::flags, and name.

+ Here is the call graph for this function:

◆ BinaryType()

void v8::internal::TypeFeedbackOracle::BinaryType ( TypeFeedbackId  id,
Type **  left,
Type **  right,
Type **  result,
Maybe< int > *  fixed_right_arg,
Handle< AllocationSite > *  allocation_site,
Token::Value  operation 
)

Definition at line 210 of file type-info.cc.

216  {
217  Handle<Object> object = GetInfo(id);
218  if (!object->IsCode()) {
219  // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the
220  // operations covered by the BinaryOpIC we should always have them.
221  DCHECK(op < BinaryOpICState::FIRST_TOKEN ||
222  op > BinaryOpICState::LAST_TOKEN);
223  *left = *right = *result = Type::None(zone());
224  *fixed_right_arg = Maybe<int>();
225  *allocation_site = Handle<AllocationSite>::null();
226  return;
227  }
228  Handle<Code> code = Handle<Code>::cast(object);
229  DCHECK_EQ(Code::BINARY_OP_IC, code->kind());
230  BinaryOpICState state(isolate(), code->extra_ic_state());
231  DCHECK_EQ(op, state.op());
232 
233  *left = state.GetLeftType(zone());
234  *right = state.GetRightType(zone());
235  *result = state.GetResultType(zone());
236  *fixed_right_arg = state.fixed_right_arg();
237 
238  AllocationSite* first_allocation_site = code->FindFirstAllocationSite();
239  if (first_allocation_site != NULL) {
240  *allocation_site = handle(first_allocation_site);
241  } else {
242  *allocation_site = Handle<AllocationSite>::null();
243  }
244 }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
static Handle< T > null()
Definition: handles.h:123
Handle< Object > GetInfo(TypeFeedbackId id)
Definition: type-info.cc:40
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
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146
@ None
Definition: v8.h:2211

References v8::internal::Handle< T >::cast(), DCHECK, DCHECK_EQ, GetInfo(), v8::internal::handle(), isolate(), v8::None, NULL, v8::internal::Handle< T >::null(), and zone().

+ Here is the call graph for this function:

◆ BuildDictionary()

void v8::internal::TypeFeedbackOracle::BuildDictionary ( Handle< Code code)
private

Definition at line 391 of file type-info.cc.

391  {
392  DisallowHeapAllocation no_allocation;
393  ZoneList<RelocInfo> infos(16, zone());
394  HandleScope scope(isolate());
395  GetRelocInfos(code, &infos);
396  CreateDictionary(code, &infos);
397  ProcessRelocInfos(&infos);
398  // Allocate handle in the parent scope.
399  dictionary_ = scope.CloseAndEscape(dictionary_);
400 }
void ProcessRelocInfos(ZoneList< RelocInfo > *infos)
Definition: type-info.cc:433
void CreateDictionary(Handle< Code > code, ZoneList< RelocInfo > *infos)
Definition: type-info.cc:412
void GetRelocInfos(Handle< Code > code, ZoneList< RelocInfo > *infos)
Definition: type-info.cc:403
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
Definition: assert-scope.h:110

References v8::internal::HandleScope::CloseAndEscape(), CreateDictionary(), dictionary_, GetRelocInfos(), isolate(), ProcessRelocInfos(), and zone().

Referenced by TypeFeedbackOracle().

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

◆ CallIsMonomorphic() [1/2]

bool v8::internal::TypeFeedbackOracle::CallIsMonomorphic ( int  slot)

Definition at line 95 of file type-info.cc.

95  {
96  Handle<Object> value = GetInfo(slot);
97  return value->IsAllocationSite() || value->IsJSFunction();
98 }

References GetInfo().

+ Here is the call graph for this function:

◆ CallIsMonomorphic() [2/2]

bool v8::internal::TypeFeedbackOracle::CallIsMonomorphic ( TypeFeedbackId  aid)

◆ CallNewIsMonomorphic()

bool v8::internal::TypeFeedbackOracle::CallNewIsMonomorphic ( int  slot)

Definition at line 101 of file type-info.cc.

101  {
102  Handle<Object> info = GetInfo(slot);
103  return FLAG_pretenuring_call_new
104  ? info->IsJSFunction()
105  : info->IsAllocationSite() || info->IsJSFunction();
106 }

References GetInfo().

+ Here is the call graph for this function:

◆ CanRetainOtherContext() [1/2]

bool v8::internal::TypeFeedbackOracle::CanRetainOtherContext ( JSFunction function,
Context native_context 
)
static

Definition at line 350 of file type-info.cc.

351  {
352  return function->context()->global_object() != native_context->global_object()
353  && function->context()->global_object() != native_context->builtins();
354 }

References v8::internal::Context::builtins(), and v8::internal::Context::global_object().

+ Here is the call graph for this function:

◆ CanRetainOtherContext() [2/2]

bool v8::internal::TypeFeedbackOracle::CanRetainOtherContext ( Map map,
Context native_context 
)
static

Definition at line 326 of file type-info.cc.

327  {
328  Object* constructor = NULL;
329  while (!map->prototype()->IsNull()) {
330  constructor = map->constructor();
331  if (!constructor->IsNull()) {
332  // If the constructor is not null or a JSFunction, we have to
333  // conservatively assume that it may retain a native context.
334  if (!constructor->IsJSFunction()) return true;
335  // Check if the constructor directly references a foreign context.
336  if (CanRetainOtherContext(JSFunction::cast(constructor),
337  native_context)) {
338  return true;
339  }
340  }
341  map = HeapObject::cast(map->prototype())->map();
342  }
343  constructor = map->constructor();
344  if (constructor->IsNull()) return false;
345  JSFunction* function = JSFunction::cast(constructor);
346  return CanRetainOtherContext(function, native_context);
347 }
static bool CanRetainOtherContext(Map *map, Context *native_context)
Definition: type-info.cc:326
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 map
kSerializedDataOffset Object
Definition: objects-inl.h:5322

References map, and NULL.

Referenced by v8::internal::StubCache::CollectMatchingMaps(), CollectReceiverTypes(), CompareType(), and GetInfo().

+ Here is the caller graph for this function:

◆ CollectReceiverTypes() [1/2]

void v8::internal::TypeFeedbackOracle::CollectReceiverTypes ( TypeFeedbackId  id,
Handle< String name,
Code::Flags  flags,
SmallMapList *  types 
)
private

Definition at line 302 of file type-info.cc.

305  {
306  Handle<Object> object = GetInfo(ast_id);
307  if (object->IsUndefined() || object->IsSmi()) return;
308 
309  DCHECK(object->IsCode());
310  Handle<Code> code(Handle<Code>::cast(object));
311 
312  if (FLAG_collect_megamorphic_maps_from_stub_cache &&
313  code->ic_state() == MEGAMORPHIC) {
314  types->Reserve(4, zone());
316  types, name, flags, native_context_, zone());
317  } else {
318  CollectReceiverTypes(ast_id, types);
319  }
320 }
StubCache * stub_cache()
Definition: isolate.h:875
void CollectMatchingMaps(SmallMapList *types, Handle< Name > name, Code::Flags flags, Handle< Context > native_context, Zone *zone)
Definition: stub-cache.cc:108

References v8::internal::StubCache::CollectMatchingMaps(), CollectReceiverTypes(), DCHECK, v8::internal::anonymous_namespace{flags.cc}::flags, GetInfo(), isolate(), v8::internal::MEGAMORPHIC, name, native_context_, v8::internal::Isolate::stub_cache(), and zone().

+ Here is the call graph for this function:

◆ CollectReceiverTypes() [2/2]

void v8::internal::TypeFeedbackOracle::CollectReceiverTypes ( TypeFeedbackId  id,
SmallMapList *  types 
)

Definition at line 357 of file type-info.cc.

358  {
359  Handle<Object> object = GetInfo(ast_id);
360  if (!object->IsCode()) return;
361  Handle<Code> code = Handle<Code>::cast(object);
362  MapHandleList maps;
363  if (code->ic_state() == MONOMORPHIC) {
364  Map* map = code->FindFirstMap();
365  if (map != NULL) maps.Add(handle(map));
366  } else if (code->ic_state() == POLYMORPHIC) {
367  code->FindAllMaps(&maps);
368  } else {
369  return;
370  }
371  types->Reserve(maps.length(), zone());
372  for (int i = 0; i < maps.length(); i++) {
373  Handle<Map> map(maps.at(i));
375  types->AddMapIfMissing(map, zone());
376  }
377  }
378 }
List< Handle< Map > > MapHandleList
Definition: list.h:197

References v8::internal::List< T, AllocationPolicy >::Add(), v8::internal::List< T, AllocationPolicy >::at(), CanRetainOtherContext(), v8::internal::Handle< T >::cast(), GetInfo(), v8::internal::handle(), map, v8::internal::MONOMORPHIC, native_context_, NULL, v8::internal::POLYMORPHIC, and zone().

Referenced by AssignmentReceiverTypes(), CollectReceiverTypes(), CountReceiverTypes(), KeyedAssignmentReceiverTypes(), KeyedPropertyReceiverTypes(), and PropertyReceiverTypes().

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

◆ CompareType()

void v8::internal::TypeFeedbackOracle::CompareType ( TypeFeedbackId  id,
Type **  left,
Type **  right,
Type **  combined 
)

Definition at line 176 of file type-info.cc.

179  {
180  Handle<Object> info = GetInfo(id);
181  if (!info->IsCode()) {
182  // For some comparisons we don't have ICs, e.g. LiteralCompareTypeof.
183  *left_type = *right_type = *combined_type = Type::None(zone());
184  return;
185  }
186  Handle<Code> code = Handle<Code>::cast(info);
187 
188  Handle<Map> map;
189  Map* raw_map = code->FindFirstMap();
190  if (raw_map != NULL) {
191  if (Map::TryUpdate(handle(raw_map)).ToHandle(&map) &&
194  }
195  }
196 
197  if (code->is_compare_ic_stub()) {
198  CompareICStub stub(code->stub_key(), isolate());
199  *left_type = CompareICState::StateToType(zone(), stub.left());
200  *right_type = CompareICState::StateToType(zone(), stub.right());
201  *combined_type = CompareICState::StateToType(zone(), stub.state(), map);
202  } else if (code->is_compare_nil_ic_stub()) {
203  CompareNilICStub stub(isolate(), code->extra_ic_state());
204  *combined_type = stub.GetType(zone(), map);
205  *left_type = *right_type = stub.GetInputType(zone(), map);
206  }
207 }
static Type * StateToType(Zone *zone, State state, Handle< Map > map=Handle< Map >())
Definition: ic-state.cc:483
static MaybeHandle< Map > TryUpdate(Handle< Map > map) WARN_UNUSED_RESULT
Definition: objects.cc:2691

References CanRetainOtherContext(), v8::internal::Handle< T >::cast(), GetInfo(), v8::internal::CompareNilICStub::GetInputType(), v8::internal::CompareNilICStub::GetType(), v8::internal::handle(), isolate(), v8::internal::CompareICStub::left(), map, native_context_, v8::None, NULL, v8::internal::Handle< T >::null(), v8::internal::CompareICStub::right(), v8::internal::CompareICStub::state(), v8::internal::CompareICState::StateToType(), v8::internal::Map::TryUpdate(), and zone().

+ Here is the call graph for this function:

◆ CountReceiverTypes()

void v8::internal::TypeFeedbackOracle::CountReceiverTypes ( TypeFeedbackId  id,
SmallMapList *  receiver_types 
)

Definition at line 295 of file type-info.cc.

296  {
297  receiver_types->Clear();
298  CollectReceiverTypes(id, receiver_types);
299 }

References CollectReceiverTypes().

+ Here is the call graph for this function:

◆ CountType()

Type * v8::internal::TypeFeedbackOracle::CountType ( TypeFeedbackId  id)

Definition at line 247 of file type-info.cc.

247  {
248  Handle<Object> object = GetInfo(id);
249  if (!object->IsCode()) return Type::None(zone());
250  Handle<Code> code = Handle<Code>::cast(object);
251  DCHECK_EQ(Code::BINARY_OP_IC, code->kind());
252  BinaryOpICState state(isolate(), code->extra_ic_state());
253  return state.GetLeftType(zone());
254 }

References v8::internal::Handle< T >::cast(), DCHECK_EQ, GetInfo(), isolate(), v8::None, and zone().

+ Here is the call graph for this function:

◆ CreateDictionary()

void v8::internal::TypeFeedbackOracle::CreateDictionary ( Handle< Code code,
ZoneList< RelocInfo > *  infos 
)
private

Definition at line 412 of file type-info.cc.

413  {
414  AllowHeapAllocation allocation_allowed;
415  Code* old_code = *code;
416  dictionary_ = UnseededNumberDictionary::New(isolate(), infos->length());
417  RelocateRelocInfos(infos, old_code, *code);
418 }
static MUST_USE_RESULT Handle< UnseededNumberDictionary > New(Isolate *isolate, int at_least_space_for, PretenureFlag pretenure=NOT_TENURED)
Definition: objects.cc:14899
void RelocateRelocInfos(ZoneList< RelocInfo > *infos, Code *old_code, Code *new_code)
Definition: type-info.cc:421
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, true > AllowHeapAllocation
Definition: assert-scope.h:114

References dictionary_, isolate(), v8::internal::Dictionary< UnseededNumberDictionary, UnseededNumberDictionaryShape, uint32_t >::New(), and RelocateRelocInfos().

Referenced by BuildDictionary().

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

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::TypeFeedbackOracle::DISALLOW_COPY_AND_ASSIGN ( TypeFeedbackOracle  )
private

◆ ForInType()

byte v8::internal::TypeFeedbackOracle::ForInType ( int  feedback_vector_slot)

Definition at line 109 of file type-info.cc.

109  {
110  Handle<Object> value = GetInfo(feedback_vector_slot);
111  return value.is_identical_to(
113  ? ForInStatement::FAST_FOR_IN
114  : ForInStatement::SLOW_FOR_IN;
115 }
static Handle< Object > UninitializedSentinel(Isolate *isolate)

References GetInfo(), isolate(), and v8::internal::TypeFeedbackVector::UninitializedSentinel().

+ Here is the call graph for this function:

◆ GetCallAllocationSite()

Handle< AllocationSite > v8::internal::TypeFeedbackOracle::GetCallAllocationSite ( int  slot)

Definition at line 152 of file type-info.cc.

152  {
153  Handle<Object> info = GetInfo(slot);
154  if (info->IsAllocationSite()) {
155  return Handle<AllocationSite>::cast(info);
156  }
158 }

References v8::internal::Handle< T >::cast(), GetInfo(), and v8::internal::Handle< T >::null().

+ Here is the call graph for this function:

◆ GetCallNewAllocationSite()

Handle< AllocationSite > v8::internal::TypeFeedbackOracle::GetCallNewAllocationSite ( int  slot)

Definition at line 161 of file type-info.cc.

161  {
162  Handle<Object> info = GetInfo(slot);
163  if (FLAG_pretenuring_call_new || info->IsAllocationSite()) {
164  return Handle<AllocationSite>::cast(info);
165  }
167 }

References v8::internal::Handle< T >::cast(), GetInfo(), and v8::internal::Handle< T >::null().

+ Here is the call graph for this function:

◆ GetCallNewTarget()

Handle< JSFunction > v8::internal::TypeFeedbackOracle::GetCallNewTarget ( int  slot)

Definition at line 141 of file type-info.cc.

141  {
142  Handle<Object> info = GetInfo(slot);
143  if (FLAG_pretenuring_call_new || info->IsJSFunction()) {
144  return Handle<JSFunction>::cast(info);
145  }
146 
147  DCHECK(info->IsAllocationSite());
148  return Handle<JSFunction>(isolate()->native_context()->array_function());
149 }

References v8::internal::Handle< T >::cast(), DCHECK, GetInfo(), and isolate().

+ Here is the call graph for this function:

◆ GetCallTarget()

Handle< JSFunction > v8::internal::TypeFeedbackOracle::GetCallTarget ( int  slot)

Definition at line 131 of file type-info.cc.

131  {
132  Handle<Object> info = GetInfo(slot);
133  if (info->IsAllocationSite()) {
134  return Handle<JSFunction>(isolate()->native_context()->array_function());
135  }
136 
137  return Handle<JSFunction>::cast(info);
138 }

References v8::internal::Handle< T >::cast(), GetInfo(), and isolate().

+ Here is the call graph for this function:

◆ GetInfo() [1/2]

Handle< Object > v8::internal::TypeFeedbackOracle::GetInfo ( int  slot)
private

Definition at line 55 of file type-info.cc.

55  {
56  DCHECK(slot >= 0 && slot < feedback_vector_->length());
57  Object* obj = feedback_vector_->get(slot);
58  if (!obj->IsJSFunction() ||
59  !CanRetainOtherContext(JSFunction::cast(obj), *native_context_)) {
60  return Handle<Object>(obj, isolate());
61  }
62  return Handle<Object>::cast(isolate()->factory()->undefined_value());
63 }

References CanRetainOtherContext(), v8::internal::Handle< T >::cast(), DCHECK, feedback_vector_, isolate(), and native_context_.

+ Here is the call graph for this function:

◆ GetInfo() [2/2]

Handle< Object > v8::internal::TypeFeedbackOracle::GetInfo ( TypeFeedbackId  id)
private

Definition at line 40 of file type-info.cc.

40  {
41  int entry = dictionary_->FindEntry(IdToKey(ast_id));
43  Object* value = dictionary_->ValueAt(entry);
44  if (value->IsCell()) {
45  Cell* cell = Cell::cast(value);
46  return Handle<Object>(cell->value(), isolate());
47  } else {
48  return Handle<Object>(value, isolate());
49  }
50  }
51  return Handle<Object>::cast(isolate()->factory()->undefined_value());
52 }
static const int kNotFound
Definition: objects.h:3283
static uint32_t IdToKey(TypeFeedbackId ast_id)
Definition: type-info.cc:35

References v8::internal::Handle< T >::cast(), dictionary_, v8::internal::IdToKey(), isolate(), and v8::internal::HashTable< Derived, Shape, Key >::kNotFound.

Referenced by BinaryType(), CallIsMonomorphic(), CallNewIsMonomorphic(), CollectReceiverTypes(), CompareType(), CountType(), ForInType(), GetCallAllocationSite(), GetCallNewAllocationSite(), GetCallNewTarget(), GetCallTarget(), GetStoreMode(), LoadIsBuiltin(), LoadIsUninitialized(), StoreIsKeyedPolymorphic(), StoreIsUninitialized(), and ToBooleanTypes().

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

◆ GetRelocInfos()

void v8::internal::TypeFeedbackOracle::GetRelocInfos ( Handle< Code code,
ZoneList< RelocInfo > *  infos 
)
private

Definition at line 403 of file type-info.cc.

404  {
406  for (RelocIterator it(*code, mask); !it.done(); it.next()) {
407  infos->Add(*it.rinfo(), zone());
408  }
409 }
static int ModeMask(Mode mode)
Definition: assembler.h:445

References v8::internal::List< T, AllocationPolicy >::Add(), v8::internal::RelocInfo::CODE_TARGET_WITH_ID, v8::internal::RelocIterator::done(), v8::internal::RelocInfo::ModeMask(), and zone().

Referenced by BuildDictionary().

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

◆ GetStoreMode()

KeyedAccessStoreMode v8::internal::TypeFeedbackOracle::GetStoreMode ( TypeFeedbackId  id)

Definition at line 118 of file type-info.cc.

119  {
120  Handle<Object> maybe_code = GetInfo(ast_id);
121  if (maybe_code->IsCode()) {
122  Handle<Code> code = Handle<Code>::cast(maybe_code);
123  if (code->kind() == Code::KEYED_STORE_IC) {
124  return KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state());
125  }
126  }
127  return STANDARD_STORE;
128 }
static KeyedAccessStoreMode GetKeyedAccessStoreMode(ExtraICState extra_state)
Definition: ic.h:543
@ STANDARD_STORE
Definition: objects.h:154

References v8::internal::Handle< T >::cast(), GetInfo(), v8::internal::KeyedStoreIC::GetKeyedAccessStoreMode(), and v8::internal::STANDARD_STORE.

Referenced by KeyedAssignmentReceiverTypes().

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

◆ isolate()

Isolate* v8::internal::TypeFeedbackOracle::isolate ( ) const
inline

Definition at line 92 of file type-info.h.

92 { return zone_->isolate(); }
Isolate * isolate() const
Definition: zone.h:68

References v8::internal::Zone::isolate(), and zone_.

Referenced by BinaryType(), BuildDictionary(), CollectReceiverTypes(), CompareType(), CountType(), CreateDictionary(), ForInType(), GetCallNewTarget(), GetCallTarget(), GetInfo(), LoadIsBuiltin(), SetInfo(), and TypeFeedbackOracle().

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

◆ KeyedArrayCallIsHoley()

bool v8::internal::TypeFeedbackOracle::KeyedArrayCallIsHoley ( TypeFeedbackId  id)

◆ KeyedAssignmentReceiverTypes()

void v8::internal::TypeFeedbackOracle::KeyedAssignmentReceiverTypes ( TypeFeedbackId  id,
SmallMapList *  receiver_types,
KeyedAccessStoreMode store_mode 
)

Definition at line 286 of file type-info.cc.

288  {
289  receiver_types->Clear();
290  CollectReceiverTypes(id, receiver_types);
291  *store_mode = GetStoreMode(id);
292 }
KeyedAccessStoreMode GetStoreMode(TypeFeedbackId id)
Definition: type-info.cc:118

References CollectReceiverTypes(), and GetStoreMode().

+ Here is the call graph for this function:

◆ KeyedPropertyReceiverTypes()

void v8::internal::TypeFeedbackOracle::KeyedPropertyReceiverTypes ( TypeFeedbackId  id,
SmallMapList *  receiver_types,
bool is_string 
)

Definition at line 266 of file type-info.cc.

267  {
268  receiver_types->Clear();
269  *is_string = false;
270  if (LoadIsBuiltin(id, Builtins::kKeyedLoadIC_String)) {
271  *is_string = true;
272  } else {
273  CollectReceiverTypes(id, receiver_types);
274  }
275 }
bool LoadIsBuiltin(TypeFeedbackId id, Builtins::Name builtin_id)
Definition: type-info.cc:170

References CollectReceiverTypes(), and LoadIsBuiltin().

+ Here is the call graph for this function:

◆ LoadIsBuiltin()

bool v8::internal::TypeFeedbackOracle::LoadIsBuiltin ( TypeFeedbackId  id,
Builtins::Name  builtin_id 
)

Definition at line 170 of file type-info.cc.

171  {
172  return *GetInfo(id) == isolate()->builtins()->builtin(builtin);
173 }
Code * builtin(Name name)
Definition: builtins.h:254
Builtins * builtins()
Definition: isolate.h:947

References v8::internal::Builtins::builtin(), v8::internal::Isolate::builtins(), GetInfo(), and isolate().

Referenced by KeyedPropertyReceiverTypes().

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

◆ LoadIsUninitialized()

bool v8::internal::TypeFeedbackOracle::LoadIsUninitialized ( TypeFeedbackId  id)

Definition at line 66 of file type-info.cc.

66  {
67  Handle<Object> maybe_code = GetInfo(id);
68  if (maybe_code->IsCode()) {
69  Handle<Code> code = Handle<Code>::cast(maybe_code);
70  return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED;
71  }
72  return false;
73 }
@ UNINITIALIZED
Definition: globals.h:446

References v8::internal::Handle< T >::cast(), GetInfo(), and v8::internal::UNINITIALIZED.

+ Here is the call graph for this function:

◆ ProcessRelocInfos()

void v8::internal::TypeFeedbackOracle::ProcessRelocInfos ( ZoneList< RelocInfo > *  infos)
private

Definition at line 433 of file type-info.cc.

433  {
434  for (int i = 0; i < infos->length(); i++) {
435  RelocInfo reloc_entry = (*infos)[i];
436  Address target_address = reloc_entry.target_address();
437  TypeFeedbackId ast_id =
438  TypeFeedbackId(static_cast<unsigned>((*infos)[i].data()));
439  Code* target = Code::GetCodeFromTargetAddress(target_address);
440  switch (target->kind()) {
441  case Code::LOAD_IC:
442  case Code::STORE_IC:
443  case Code::KEYED_LOAD_IC:
444  case Code::KEYED_STORE_IC:
445  case Code::BINARY_OP_IC:
446  case Code::COMPARE_IC:
447  case Code::TO_BOOLEAN_IC:
448  case Code::COMPARE_NIL_IC:
449  SetInfo(ast_id, target);
450  break;
451 
452  default:
453  break;
454  }
455  }
456 }
static Code * GetCodeFromTargetAddress(Address address)
Definition: objects-inl.h:5018
void SetInfo(TypeFeedbackId id, Object *target)
Definition: type-info.cc:459
byte * Address
Definition: globals.h:101

References v8::internal::Code::GetCodeFromTargetAddress(), v8::internal::Code::kind(), and SetInfo().

Referenced by BuildDictionary().

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

◆ PropertyReceiverTypes()

void v8::internal::TypeFeedbackOracle::PropertyReceiverTypes ( TypeFeedbackId  id,
Handle< String name,
SmallMapList *  receiver_types 
)

Definition at line 257 of file type-info.cc.

259  {
260  receiver_types->Clear();
262  CollectReceiverTypes(id, name, flags, receiver_types);
263 }

References CollectReceiverTypes(), v8::internal::Code::ComputeHandlerFlags(), v8::internal::anonymous_namespace{flags.cc}::flags, and name.

+ Here is the call graph for this function:

◆ RelocateRelocInfos()

void v8::internal::TypeFeedbackOracle::RelocateRelocInfos ( ZoneList< RelocInfo > *  infos,
Code old_code,
Code new_code 
)
private

Definition at line 421 of file type-info.cc.

423  {
424  for (int i = 0; i < infos->length(); i++) {
425  RelocInfo* info = &(*infos)[i];
426  info->set_host(new_code);
427  info->set_pc(new_code->instruction_start() +
428  (info->pc() - old_code->instruction_start()));
429  }
430 }

References v8::internal::Code::instruction_start(), v8::internal::RelocInfo::pc(), v8::internal::RelocInfo::set_host(), and v8::internal::RelocInfo::set_pc().

Referenced by CreateDictionary().

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

◆ SetInfo()

void v8::internal::TypeFeedbackOracle::SetInfo ( TypeFeedbackId  id,
Object target 
)
private

Definition at line 459 of file type-info.cc.

459  {
460  DCHECK(dictionary_->FindEntry(IdToKey(ast_id)) ==
462  // Dictionary has been allocated with sufficient size for all elements.
463  DisallowHeapAllocation no_need_to_resize_dictionary;
464  HandleScope scope(isolate());
466  dictionary_, IdToKey(ast_id), handle(target, isolate())));
467 }
static MUST_USE_RESULT Handle< UnseededNumberDictionary > AtNumberPut(Handle< UnseededNumberDictionary > dictionary, uint32_t key, Handle< Object > value)
Definition: objects.cc:15117
void USE(T)
Definition: macros.h:322

References v8::internal::UnseededNumberDictionary::AtNumberPut(), DCHECK, dictionary_, v8::internal::handle(), v8::internal::IdToKey(), isolate(), v8::internal::HashTable< Derived, Shape, Key >::kNotFound, and USE().

Referenced by ProcessRelocInfos().

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

◆ StoreIsKeyedPolymorphic()

bool v8::internal::TypeFeedbackOracle::StoreIsKeyedPolymorphic ( TypeFeedbackId  id)

Definition at line 84 of file type-info.cc.

84  {
85  Handle<Object> maybe_code = GetInfo(ast_id);
86  if (maybe_code->IsCode()) {
87  Handle<Code> code = Handle<Code>::cast(maybe_code);
88  return code->is_keyed_store_stub() &&
89  code->ic_state() == POLYMORPHIC;
90  }
91  return false;
92 }

References v8::internal::Handle< T >::cast(), GetInfo(), and v8::internal::POLYMORPHIC.

+ Here is the call graph for this function:

◆ StoreIsUninitialized()

bool v8::internal::TypeFeedbackOracle::StoreIsUninitialized ( TypeFeedbackId  id)

Definition at line 76 of file type-info.cc.

76  {
77  Handle<Object> maybe_code = GetInfo(ast_id);
78  if (!maybe_code->IsCode()) return false;
79  Handle<Code> code = Handle<Code>::cast(maybe_code);
80  return code->ic_state() == UNINITIALIZED;
81 }

References v8::internal::Handle< T >::cast(), GetInfo(), and v8::internal::UNINITIALIZED.

+ Here is the call graph for this function:

◆ ToBooleanTypes()

byte v8::internal::TypeFeedbackOracle::ToBooleanTypes ( TypeFeedbackId  id)

Definition at line 381 of file type-info.cc.

381  {
382  Handle<Object> object = GetInfo(id);
383  return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0;
384 }

References v8::internal::Handle< T >::cast(), and GetInfo().

Referenced by v8::internal::Expression::RecordToBooleanTypeFeedback().

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

◆ zone()

Zone* v8::internal::TypeFeedbackOracle::zone ( ) const
inline

Definition at line 91 of file type-info.h.

91 { return zone_; }

References zone_.

Referenced by BinaryType(), BuildDictionary(), CollectReceiverTypes(), CompareType(), CountType(), and GetRelocInfos().

+ Here is the caller graph for this function:

Member Data Documentation

◆ dictionary_

Handle<UnseededNumberDictionary> v8::internal::TypeFeedbackOracle::dictionary_
private

Definition at line 121 of file type-info.h.

Referenced by BuildDictionary(), CreateDictionary(), GetInfo(), SetInfo(), and TypeFeedbackOracle().

◆ feedback_vector_

Handle<TypeFeedbackVector> v8::internal::TypeFeedbackOracle::feedback_vector_
private

Definition at line 122 of file type-info.h.

Referenced by GetInfo(), and TypeFeedbackOracle().

◆ native_context_

Handle<Context> v8::internal::TypeFeedbackOracle::native_context_
private

Definition at line 119 of file type-info.h.

Referenced by CollectReceiverTypes(), CompareType(), and GetInfo().

◆ zone_

Zone* v8::internal::TypeFeedbackOracle::zone_
private

Definition at line 120 of file type-info.h.

Referenced by isolate(), and zone().


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