V8 Project
v8::internal::IC Class Reference

#include <ic.h>

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

Public Types

enum  UtilityId { kUtilityCount }
 
enum  FrameDepth { NO_EXTRA_FRAME = 0 , EXTRA_CALL_FRAME = 1 }
 
typedef InlineCacheState State
 

Public Member Functions

 IC (FrameDepth depth, Isolate *isolate)
 
virtual ~IC ()
 
State state () const
 
Address address () const
 
void UpdateState (Handle< Object > receiver, Handle< Object > name)
 
bool IsNameCompatibleWithPrototypeFailure (Handle< Object > name)
 
void MarkPrototypeFailure (Handle< Object > name)
 

Static Public Member Functions

static Address AddressFromUtilityId (UtilityId id)
 
static void RegisterWeakMapDependency (Handle< Code > stub)
 
static void InvalidateMaps (Code *stub)
 
static void Clear (Isolate *isolate, Address address, ConstantPoolArray *constant_pool)
 
template<class TypeClass >
static JSFunctionGetRootConstructor (TypeClass *type, Context *native_context)
 
static Handle< MapGetHandlerCacheHolder (HeapType *type, bool receiver_is_holder, Isolate *isolate, CacheHolderFlag *flag)
 
static Handle< MapGetICCacheHolder (HeapType *type, Isolate *isolate, CacheHolderFlag *flag)
 
static bool IsCleared (Code *code)
 
static Handle< MapTypeToMap (HeapType *type, Isolate *isolate)
 
template<class T >
static T::TypeHandle MapToType (Handle< Map > map, typename T::Region *region)
 
static Handle< HeapTypeCurrentTypeOf (Handle< Object > object, Isolate *isolate)
 

Protected Member Functions

Handle< Codetarget () const
 
Address fp () const
 
Address pc () const
 
Isolateisolate () const
 
SharedFunctionInfoGetSharedFunctionInfo () const
 
CodeGetCode () const
 
CodeGetOriginalCode () const
 
void set_target (Code *code)
 
bool is_target_set ()
 
char TransitionMarkFromState (IC::State state)
 
void TraceIC (const char *type, Handle< Object > name)
 
void TraceIC (const char *type, Handle< Object > name, State old_state, State new_state)
 
MaybeHandle< ObjectTypeError (const char *type, Handle< Object > object, Handle< Object > key)
 
MaybeHandle< ObjectReferenceError (const char *type, Handle< Name > name)
 
Handle< CodeComputeHandler (LookupIterator *lookup, Handle< Object > value=Handle< Code >::null())
 
virtual Handle< CodeCompileHandler (LookupIterator *lookup, Handle< Object > value, CacheHolderFlag cache_holder)
 
void UpdateMonomorphicIC (Handle< Code > handler, Handle< Name > name)
 
bool UpdatePolymorphicIC (Handle< Name > name, Handle< Code > code)
 
void UpdateMegamorphicCache (HeapType *type, Name *name, Code *code)
 
void CopyICToMegamorphicCache (Handle< Name > name)
 
bool IsTransitionOfMonomorphicTarget (Map *source_map, Map *target_map)
 
void PatchCache (Handle< Name > name, Handle< Code > code)
 
Code::Kind kind () const
 
Code::Kind handler_kind () const
 
virtual Handle< Codemegamorphic_stub ()
 
bool TryRemoveInvalidPrototypeDependentStub (Handle< Object > receiver, Handle< String > name)
 
ExtraICState extra_ic_state () const
 
void set_extra_ic_state (ExtraICState state)
 
Handle< HeapTypereceiver_type ()
 
void update_receiver_type (Handle< Object > receiver)
 
void TargetMaps (MapHandleList *list)
 
void TargetTypes (TypeHandleList *list)
 
MapFirstTargetMap ()
 
void UpdateTarget ()
 

Static Protected Member Functions

static CodeGetTargetAtAddress (Address address, ConstantPoolArray *constant_pool)
 
static void SetTargetAtAddress (Address address, Code *target, ConstantPoolArray *constant_pool)
 
static void OnTypeFeedbackChanged (Isolate *isolate, Address address, State old_state, State new_state, bool target_remains_ic_stub)
 
static void PostPatching (Address address, Code *target, Code *old_target)
 

Private Member Functions

Coderaw_target () const
 
ConstantPoolArrayconstant_pool () const
 
ConstantPoolArrayraw_constant_pool () const
 
void FindTargetMaps ()
 
 DISALLOW_IMPLICIT_CONSTRUCTORS (IC)
 

Private Attributes

Address fp_
 
Addresspc_address_
 
Isolateisolate_
 
Handle< ConstantPoolArrayraw_constant_pool_
 
Handle< Codetarget_
 
bool target_set_
 
State state_
 
Code::Kind kind_
 
Handle< HeapTypereceiver_type_
 
MaybeHandle< Codemaybe_handler_
 
ExtraICState extra_ic_state_
 
MapHandleList target_maps_
 
bool target_maps_set_
 

Detailed Description

Definition at line 41 of file ic.h.

Member Typedef Documentation

◆ State

Definition at line 55 of file ic.h.

Member Enumeration Documentation

◆ FrameDepth

Enumerator
NO_EXTRA_FRAME 
EXTRA_CALL_FRAME 

Definition at line 59 of file ic.h.

59 { NO_EXTRA_FRAME = 0, EXTRA_CALL_FRAME = 1 };
@ NO_EXTRA_FRAME
Definition: ic.h:59
@ EXTRA_CALL_FRAME
Definition: ic.h:59

◆ UtilityId

Enumerator
kUtilityCount 

Definition at line 44 of file ic.h.

44  {
45 #define CONST_NAME(name) k##name,
47 #undef CONST_NAME
49  };
@ kUtilityCount
Definition: ic.h:48
#define CONST_NAME(name)
Definition: ic.h:45
#define IC_UTIL_LIST(ICU)
Definition: ic.h:17

Constructor & Destructor Documentation

◆ IC()

v8::internal::IC::IC ( FrameDepth  depth,
Isolate isolate 
)

Definition at line 141 of file ic.cc.

142  : isolate_(isolate), target_set_(false), target_maps_set_(false) {
143  // To improve the performance of the (much used) IC code, we unfold a few
144  // levels of the stack frame iteration code. This yields a ~35% speedup when
145  // running DeltaBlue and a ~25% speedup of gbemu with the '--nouse-ic' flag.
148  if (FLAG_enable_ool_constant_pool) {
149  constant_pool =
151  }
152  Address* pc_address =
153  reinterpret_cast<Address*>(entry + ExitFrameConstants::kCallerPCOffset);
155  // If there's another JavaScript frame on the stack or a
156  // StubFailureTrampoline, we need to look one frame further down the stack to
157  // find the frame pointer and the return address stack slot.
158  if (depth == EXTRA_CALL_FRAME) {
159  if (FLAG_enable_ool_constant_pool) {
160  constant_pool =
162  }
163  const int kCallerPCOffset = StandardFrameConstants::kCallerPCOffset;
164  pc_address = reinterpret_cast<Address*>(fp + kCallerPCOffset);
166  }
167 #ifdef DEBUG
168  StackFrameIterator it(isolate);
169  for (int i = 0; i < depth + 1; i++) it.Advance();
170  StackFrame* frame = it.frame();
171  DCHECK(fp == frame->fp() && pc_address == frame->pc_address());
172 #endif
173  fp_ = fp;
174  if (FLAG_enable_ool_constant_pool) {
176  ConstantPoolArray::cast(reinterpret_cast<Object*>(constant_pool)),
177  isolate);
178  }
179  pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address);
181  state_ = target_->ic_state();
182  kind_ = target_->kind();
183  extra_ic_state_ = target_->extra_ic_state();
184 }
static const int kCallerPCOffset
Definition: frames-arm.h:98
static const int kConstantPoolOffset
Definition: frames-arm.h:90
static const int kCallerFPOffset
Definition: frames-arm.h:96
State state_
Definition: ic.h:264
Handle< Code > target_
Definition: ic.h:262
ConstantPoolArray * constant_pool() const
Definition: ic-inl.h:51
Handle< ConstantPoolArray > raw_constant_pool_
Definition: ic.h:259
Isolate * isolate() const
Definition: ic.h:136
ExtraICState extra_ic_state_
Definition: ic.h:269
bool target_maps_set_
Definition: ic.h:271
Code * raw_target() const
Definition: ic-inl.h:154
Code::Kind kind_
Definition: ic.h:265
Isolate * isolate_
Definition: ic.h:255
bool target_set_
Definition: ic.h:263
Address fp_
Definition: ic.h:247
Address * pc_address_
Definition: ic.h:253
Address fp() const
Definition: ic.h:134
static Address c_entry_fp(ThreadLocalTop *thread)
Definition: isolate.h:647
ThreadLocalTop * thread_local_top()
Definition: isolate.h:878
static Address & Address_at(Address addr)
Definition: v8memory.h:56
static const int kConstantPoolOffset
Definition: frames.h:163
static const int kCallerPCOffset
Definition: frames.h:166
static const int kCallerFPOffset
Definition: frames.h:165
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(condition)
Definition: logging.h:205
HANDLE HANDLE LPSTACKFRAME64 StackFrame
kSerializedDataOffset Object
Definition: objects-inl.h:5322
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146
byte * Address
Definition: globals.h:101

References v8::internal::Memory::Address_at(), v8::internal::StackFrameIterator::Advance(), v8::internal::Isolate::c_entry_fp(), constant_pool(), DCHECK, EXTRA_CALL_FRAME, extra_ic_state_, fp(), fp_, v8::internal::StackFrameIterator::frame(), v8::internal::handle(), isolate(), v8::internal::ExitFrameConstants::kCallerFPOffset, v8::internal::StandardFrameConstants::kCallerFPOffset, v8::internal::ExitFrameConstants::kCallerPCOffset, v8::internal::StandardFrameConstants::kCallerPCOffset, v8::internal::ExitFrameConstants::kConstantPoolOffset, v8::internal::StandardFrameConstants::kConstantPoolOffset, kind_, NULL, pc_address_, raw_constant_pool_, raw_target(), state_, target_, and v8::internal::Isolate::thread_local_top().

+ Here is the call graph for this function:

◆ ~IC()

virtual v8::internal::IC::~IC ( )
inlinevirtual

Definition at line 64 of file ic.h.

64 {}

Member Function Documentation

◆ address()

Address v8::internal::IC::address ( ) const
inline

Definition at line 19 of file ic-inl.h.

19  {
20  // Get the address of the call.
22 
23  Debug* debug = isolate()->debug();
24  // First check if any break points are active if not just return the address
25  // of the call.
26  if (!debug->has_break_points()) return result;
27 
28  // At least one break point is active perform additional test to ensure that
29  // break point locations are updated correctly.
30  if (debug->IsDebugBreak(
32  // If the call site is a call to debug break then return the address in
33  // the original code instead of the address in the running code. This will
34  // cause the original code to be updated and keeps the breakpoint active in
35  // the running code.
36  Code* code = GetCode();
37  Code* original_code = GetOriginalCode();
38  intptr_t delta =
39  original_code->instruction_start() - code->instruction_start();
40  // Return the address in the original code. This is the place where
41  // the call which has been overwritten by the DebugBreakXXX resides
42  // and the place where the inline cache system should look.
43  return result + delta;
44  } else {
45  // No break point here just return the address of the call.
46  return result;
47  }
48 }
static Address target_address_at(Address pc, ConstantPoolArray *constant_pool)
static Address target_address_from_return_address(Address pc)
Code * GetOriginalCode() const
Definition: ic.cc:209
ConstantPoolArray * raw_constant_pool() const
Definition: ic-inl.h:75
Address pc() const
Definition: ic.h:135
Code * GetCode() const
Definition: ic.cc:201

References v8::internal::Isolate::debug(), GetCode(), GetOriginalCode(), v8::internal::Debug::has_break_points(), v8::internal::Code::instruction_start(), v8::internal::Debug::IsDebugBreak(), isolate(), pc(), raw_constant_pool(), v8::internal::Assembler::target_address_at(), and v8::internal::Assembler::target_address_from_return_address().

Referenced by v8::internal::CompareNilIC::Clear(), v8::internal::LoadIC::Clear(), v8::internal::KeyedLoadIC::Clear(), v8::internal::StoreIC::Clear(), v8::internal::KeyedStoreIC::Clear(), v8::internal::CompareIC::Clear(), Clear(), v8::internal::CallIC::DoCustomHandler(), GetTargetAtAddress(), v8::internal::CallIC::HandleMiss(), OnTypeFeedbackChanged(), v8::internal::CallIC::PatchMegamorphic(), PostPatching(), raw_target(), set_target(), SetTargetAtAddress(), v8::internal::BinaryOpIC::Transition(), and v8::internal::CompareIC::UpdateCaches().

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

◆ AddressFromUtilityId()

Address v8::internal::IC::AddressFromUtilityId ( IC::UtilityId  id)
static

Definition at line 2687 of file ic.cc.

2687 { return IC_utilities[id]; }
static const Address IC_utilities[]
Definition: ic.cc:2680

References v8::internal::IC_utilities.

◆ Clear()

void v8::internal::IC::Clear ( Isolate isolate,
Address  address,
ConstantPoolArray constant_pool 
)
static

Definition at line 478 of file ic.cc.

479  {
481 
482  // Don't clear debug break inline cache as it will remove the break point.
483  if (target->is_debug_stub()) return;
484 
485  switch (target->kind()) {
486  case Code::LOAD_IC:
488  case Code::KEYED_LOAD_IC:
490  case Code::STORE_IC:
492  case Code::KEYED_STORE_IC:
494  case Code::CALL_IC:
496  case Code::COMPARE_IC:
498  case Code::COMPARE_NIL_IC:
500  case Code::BINARY_OP_IC:
501  case Code::TO_BOOLEAN_IC:
502  // Clearing these is tricky and does not
503  // make any performance difference.
504  return;
505  default:
506  UNREACHABLE();
507  }
508 }
static void Clear(Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
Definition: ic.cc:521
static void Clear(Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
Definition: ic.cc:555
static void Clear(Address address, Code *target, ConstantPoolArray *constant_pool)
Definition: ic.cc:2385
static Code * GetTargetAtAddress(Address address, ConstantPoolArray *constant_pool)
Definition: ic-inl.h:84
Address address() const
Definition: ic-inl.h:19
Handle< Code > target() const
Definition: ic.h:132
static void Clear(Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
Definition: ic.cc:511
static void Clear(Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
Definition: ic.cc:545
static void Clear(Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
Definition: ic.cc:527
static void Clear(Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
Definition: ic.cc:536
#define UNREACHABLE()
Definition: logging.h:30

References address(), v8::internal::CompareNilIC::Clear(), v8::internal::CallIC::Clear(), v8::internal::LoadIC::Clear(), v8::internal::KeyedLoadIC::Clear(), v8::internal::StoreIC::Clear(), v8::internal::KeyedStoreIC::Clear(), v8::internal::CompareIC::Clear(), constant_pool(), GetTargetAtAddress(), isolate(), target(), and UNREACHABLE.

Referenced by v8::internal::ICUtility::Clear(), and v8::internal::Code::ClearInlineCaches().

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

◆ CompileHandler()

virtual Handle<Code> v8::internal::IC::CompileHandler ( LookupIterator *  lookup,
Handle< Object value,
CacheHolderFlag  cache_holder 
)
inlineprotectedvirtual

Reimplemented in v8::internal::StoreIC, and v8::internal::LoadIC.

Definition at line 171 of file ic.h.

173  {
174  UNREACHABLE();
175  return Handle<Code>::null();
176  }
static Handle< T > null()
Definition: handles.h:123

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

Referenced by ComputeHandler().

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

◆ ComputeHandler()

Handle< Code > v8::internal::IC::ComputeHandler ( LookupIterator *  lookup,
Handle< Object value = Handle<Code>::null() 
)
protected

Definition at line 897 of file ic.cc.

897  {
898  bool receiver_is_holder =
899  lookup->GetReceiver().is_identical_to(lookup->GetHolder<JSObject>());
901  Handle<Map> stub_holder_map = IC::GetHandlerCacheHolder(
902  *receiver_type(), receiver_is_holder, isolate(), &flag);
903 
904  Handle<Code> code = PropertyHandlerCompiler::Find(
905  lookup->name(), stub_holder_map, kind(), flag,
906  lookup->is_dictionary_holder() ? Code::NORMAL : Code::FAST);
907  // Use the cached value if it exists, and if it is different from the
908  // handler that just missed.
909  if (!code.is_null()) {
910  if (!maybe_handler_.is_null() &&
911  !maybe_handler_.ToHandleChecked().is_identical_to(code)) {
912  return code;
913  }
914  if (maybe_handler_.is_null()) {
915  // maybe_handler_ is only populated for MONOMORPHIC and POLYMORPHIC ICs.
916  // In MEGAMORPHIC case, check if the handler in the megamorphic stub
917  // cache (which just missed) is different from the cached handler.
918  if (state() == MEGAMORPHIC && lookup->GetReceiver()->IsHeapObject()) {
919  Map* map = Handle<HeapObject>::cast(lookup->GetReceiver())->map();
920  Code* megamorphic_cached_code =
921  isolate()->stub_cache()->Get(*lookup->name(), map, code->flags());
922  if (megamorphic_cached_code != *code) return code;
923  } else {
924  return code;
925  }
926  }
927  }
928 
929  code = CompileHandler(lookup, value, flag);
930  DCHECK(code->is_handler());
931 
932  // TODO(mvstanton): we'd only like to cache code on the map when it's custom
933  // code compiled for this map, otherwise it's already cached in the global
934  // code
935  // cache. We are also guarding against installing code with flags that don't
936  // match the desired CacheHolderFlag computed above, which would lead to
937  // invalid lookups later.
938  if (code->type() != Code::NORMAL &&
939  Code::ExtractCacheHolderFromFlags(code->flags()) == flag) {
940  Map::UpdateCodeCache(stub_holder_map, lookup->name(), code);
941  }
942 
943  return code;
944 }
static CacheHolderFlag ExtractCacheHolderFromFlags(Flags flags)
Definition: objects-inl.h:5001
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
MaybeHandle< Code > maybe_handler_
Definition: ic.h:267
Handle< HeapType > receiver_type()
Definition: ic.h:203
Code::Kind kind() const
Definition: ic.h:185
State state() const
Definition: ic.h:66
virtual Handle< Code > CompileHandler(LookupIterator *lookup, Handle< Object > value, CacheHolderFlag cache_holder)
Definition: ic.h:171
static Handle< Map > GetHandlerCacheHolder(HeapType *type, bool receiver_is_holder, Isolate *isolate, CacheHolderFlag *flag)
Definition: ic-inl.h:177
StubCache * stub_cache()
Definition: isolate.h:875
static void UpdateCodeCache(Handle< Map > map, Handle< Name > name, Handle< Code > code)
Definition: objects.cc:7030
static Handle< Code > Find(Handle< Name > name, Handle< Map > map, Code::Kind kind, CacheHolderFlag cache_holder, Code::StubType type)
Code * Get(Name *name, Map *map, Code::Flags flags)
Definition: stub-cache.cc:77
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
kFeedbackVectorOffset flag
Definition: objects-inl.h:5418

References v8::internal::Handle< T >::cast(), CompileHandler(), DCHECK, v8::internal::Code::ExtractCacheHolderFromFlags(), v8::internal::Code::FAST, v8::internal::PropertyHandlerCompiler::Find(), v8::internal::flag, v8::internal::StubCache::Get(), GetHandlerCacheHolder(), v8::internal::Handle< T >::is_null(), isolate(), kind(), map, maybe_handler_, v8::internal::MEGAMORPHIC, v8::internal::Code::NORMAL, receiver_type(), state(), v8::internal::Isolate::stub_cache(), and v8::internal::Map::UpdateCodeCache().

Referenced by v8::internal::LoadIC::UpdateCaches(), and v8::internal::StoreIC::UpdateCaches().

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

◆ constant_pool()

ConstantPoolArray * v8::internal::IC::constant_pool ( ) const
inlineprivate

Definition at line 51 of file ic-inl.h.

51  {
52  if (!FLAG_enable_ool_constant_pool) {
53  return NULL;
54  } else {
55  Handle<ConstantPoolArray> result = raw_constant_pool_;
56  Debug* debug = isolate()->debug();
57  // First check if any break points are active if not just return the
58  // original constant pool.
59  if (!debug->has_break_points()) return *result;
60 
61  // At least one break point is active perform additional test to ensure that
62  // break point locations are updated correctly.
64  if (debug->IsDebugBreak(
66  // If the call site is a call to debug break then we want to return the
67  // constant pool for the original code instead of the breakpointed code.
68  return GetOriginalCode()->constant_pool();
69  }
70  return *result;
71  }
72 }
ConstantPoolArray * constant_pool()
Definition: objects-inl.h:4942

References v8::internal::Code::constant_pool(), v8::internal::Isolate::debug(), GetOriginalCode(), v8::internal::Debug::has_break_points(), v8::internal::Debug::IsDebugBreak(), isolate(), NULL, pc(), raw_constant_pool(), raw_constant_pool_, target(), v8::internal::Assembler::target_address_at(), and v8::internal::Assembler::target_address_from_return_address().

Referenced by v8::internal::CompareNilIC::Clear(), v8::internal::LoadIC::Clear(), v8::internal::KeyedLoadIC::Clear(), v8::internal::StoreIC::Clear(), v8::internal::KeyedStoreIC::Clear(), v8::internal::CompareIC::Clear(), Clear(), GetTargetAtAddress(), IC(), raw_target(), set_target(), and SetTargetAtAddress().

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

◆ CopyICToMegamorphicCache()

void v8::internal::IC::CopyICToMegamorphicCache ( Handle< Name name)
protected

Definition at line 761 of file ic.cc.

761  {
762  TypeHandleList types;
763  CodeHandleList handlers;
764  TargetTypes(&types);
765  if (!target()->FindHandlers(&handlers, types.length())) return;
766  for (int i = 0; i < types.length(); i++) {
767  UpdateMegamorphicCache(*types.at(i), *name, *handlers.at(i));
768  }
769 }
void TargetTypes(TypeHandleList *list)
Definition: ic.h:215
void UpdateMegamorphicCache(HeapType *type, Name *name, Code *code)
Definition: ic.cc:890
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
List< Handle< Code > > CodeHandleList
Definition: list.h:199
List< Handle< HeapType > > TypeHandleList
Definition: list.h:198

References v8::internal::List< T, AllocationPolicy >::at(), name, target(), TargetTypes(), and UpdateMegamorphicCache().

Referenced by PatchCache().

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

◆ CurrentTypeOf()

Handle< HeapType > v8::internal::IC::CurrentTypeOf ( Handle< Object object,
Isolate isolate 
)
static

Definition at line 712 of file ic.cc.

712  {
713  return object->IsJSGlobalObject()
715  : HeapType::NowOf(object, isolate);
716 }
static TypeHandle Constant(i::Handle< i::Object > value, Region *region)
Definition: types.h:330
TypeImpl< HeapTypeConfig > HeapType
Definition: list.h:191

References v8::internal::TypeImpl< Config >::Constant(), isolate(), and v8::internal::TypeImpl< Config >::NowOf().

Referenced by v8::internal::PropertyHandlerCompiler::set_type_for_object(), and update_receiver_type().

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

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::IC::DISALLOW_IMPLICIT_CONSTRUCTORS ( IC  )
private

◆ extra_ic_state()

◆ FindTargetMaps()

void v8::internal::IC::FindTargetMaps ( )
inlineprivate

Definition at line 235 of file ic.h.

235  {
236  if (target_maps_set_) return;
237  target_maps_set_ = true;
238  if (state_ == MONOMORPHIC) {
239  Map* map = target_->FindFirstMap();
240  if (map != NULL) target_maps_.Add(handle(map));
241  } else if (state_ != UNINITIALIZED && state_ != PREMONOMORPHIC) {
242  target_->FindAllMaps(&target_maps_);
243  }
244  }
MapHandleList target_maps_
Definition: ic.h:270
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
Definition: list-inl.h:17
@ UNINITIALIZED
Definition: globals.h:446
@ PREMONOMORPHIC
Definition: globals.h:448

References v8::internal::List< T, AllocationPolicy >::Add(), v8::internal::handle(), map, v8::internal::MONOMORPHIC, NULL, v8::internal::PREMONOMORPHIC, state_, target_, target_maps_, target_maps_set_, and v8::internal::UNINITIALIZED.

Referenced by FirstTargetMap(), TargetMaps(), and TargetTypes().

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

◆ FirstTargetMap()

Map* v8::internal::IC::FirstTargetMap ( )
inlineprotected

Definition at line 222 of file ic.h.

222  {
223  FindTargetMaps();
224  return target_maps_.length() > 0 ? *target_maps_.at(0) : NULL;
225  }
void FindTargetMaps()
Definition: ic.h:235
T & at(int i) const
Definition: list.h:69

References v8::internal::List< T, AllocationPolicy >::at(), FindTargetMaps(), NULL, and target_maps_.

Referenced by v8::internal::CompareNilIC::CompareNil(), and TryRemoveInvalidPrototypeDependentStub().

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

◆ fp()

Address v8::internal::IC::fp ( ) const
inlineprotected

Definition at line 134 of file ic.h.

134 { return fp_; }

References fp_.

Referenced by IC().

+ Here is the caller graph for this function:

◆ GetCode()

Code * v8::internal::IC::GetCode ( ) const
protected

Definition at line 201 of file ic.cc.

201  {
202  HandleScope scope(isolate());
203  Handle<SharedFunctionInfo> shared(GetSharedFunctionInfo(), isolate());
204  Code* code = shared->code();
205  return code;
206 }
SharedFunctionInfo * GetSharedFunctionInfo() const
Definition: ic.cc:187

References GetSharedFunctionInfo(), and isolate().

Referenced by address().

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

◆ GetHandlerCacheHolder()

Handle< Map > v8::internal::IC::GetHandlerCacheHolder ( HeapType type,
bool  receiver_is_holder,
Isolate isolate,
CacheHolderFlag flag 
)
inlinestatic

Definition at line 177 of file ic-inl.h.

178  {
179  Handle<Map> receiver_map = TypeToMap(type, isolate);
180  if (receiver_is_holder) {
182  return receiver_map;
183  }
184  Context* native_context = *isolate->native_context();
185  JSFunction* builtin_ctor = GetRootConstructor(type, native_context);
186  if (builtin_ctor != NULL) {
188  return handle(HeapObject::cast(builtin_ctor->instance_prototype())->map());
189  }
190  *flag = receiver_map->is_dictionary_map()
193  // Callers must ensure that the prototype is non-null.
194  return handle(JSObject::cast(receiver_map->prototype())->map());
195 }
static Handle< Map > TypeToMap(HeapType *type, Isolate *isolate)
Definition: ic.cc:719
static JSFunction * GetRootConstructor(TypeClass *type, Context *native_context)
Definition: ic-inl.h:162
Handle< Context > native_context()
Definition: isolate.cc:1339
@ kCacheOnPrototype
Definition: globals.h:485
@ kCacheOnReceiver
Definition: globals.h:488
@ kCacheOnPrototypeReceiverIsPrimitive
Definition: globals.h:487
@ kCacheOnPrototypeReceiverIsDictionary
Definition: globals.h:486

References v8::internal::flag, GetRootConstructor(), v8::internal::handle(), v8::internal::JSFunction::instance_prototype(), isolate(), v8::internal::kCacheOnPrototype, v8::internal::kCacheOnPrototypeReceiverIsDictionary, v8::internal::kCacheOnPrototypeReceiverIsPrimitive, v8::internal::kCacheOnReceiver, v8::internal::Isolate::native_context(), NULL, and TypeToMap().

Referenced by v8::internal::LoadIC::CompileHandler(), ComputeHandler(), and v8::internal::NamedLoadHandlerCompiler::ComputeLoadNonexistent().

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

◆ GetICCacheHolder()

Handle< Map > v8::internal::IC::GetICCacheHolder ( HeapType type,
Isolate isolate,
CacheHolderFlag flag 
)
inlinestatic

Definition at line 198 of file ic-inl.h.

199  {
200  Context* native_context = *isolate->native_context();
201  JSFunction* builtin_ctor = GetRootConstructor(type, native_context);
202  if (builtin_ctor != NULL) {
204  return handle(builtin_ctor->initial_map());
205  }
207  return TypeToMap(type, isolate);
208 }

References v8::internal::flag, GetRootConstructor(), v8::internal::handle(), v8::internal::JSFunction::initial_map(), isolate(), v8::internal::kCacheOnPrototype, v8::internal::kCacheOnReceiver, v8::internal::Isolate::native_context(), NULL, and TypeToMap().

Referenced by v8::internal::PropertyICCompiler::ComputeMonomorphic(), and TryRemoveInvalidPrototypeDependentStub().

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

◆ GetOriginalCode()

Code * v8::internal::IC::GetOriginalCode ( ) const
protected

Definition at line 209 of file ic.cc.

209  {
210  HandleScope scope(isolate());
211  Handle<SharedFunctionInfo> shared(GetSharedFunctionInfo(), isolate());
212  DCHECK(Debug::HasDebugInfo(shared));
213  Code* original_code = Debug::GetDebugInfo(shared)->original_code();
214  DCHECK(original_code->IsCode());
215  return original_code;
216 }
static bool HasDebugInfo(Handle< SharedFunctionInfo > shared)
Definition: debug.cc:1062
static Handle< DebugInfo > GetDebugInfo(Handle< SharedFunctionInfo > shared)
Definition: debug.cc:1069

References DCHECK, v8::internal::Debug::GetDebugInfo(), GetSharedFunctionInfo(), v8::internal::Debug::HasDebugInfo(), and isolate().

Referenced by address(), and constant_pool().

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

◆ GetRootConstructor()

template<class TypeClass >
JSFunction * v8::internal::IC::GetRootConstructor ( TypeClass *  type,
Context native_context 
)
static

Definition at line 162 of file ic-inl.h.

162  {
163  if (type->Is(TypeClass::Boolean())) {
164  return native_context->boolean_function();
165  } else if (type->Is(TypeClass::Number())) {
166  return native_context->number_function();
167  } else if (type->Is(TypeClass::String())) {
168  return native_context->string_function();
169  } else if (type->Is(TypeClass::Symbol())) {
170  return native_context->symbol_function();
171  } else {
172  return NULL;
173  }
174 }
IN DWORD64 OUT PDWORD64 OUT PIMAGEHLP_SYMBOL64 Symbol

References NULL.

Referenced by GetHandlerCacheHolder(), GetICCacheHolder(), and v8::internal::HOptimizedGraphBuilder::PropertyAccessInfo::map().

+ Here is the caller graph for this function:

◆ GetSharedFunctionInfo()

SharedFunctionInfo * v8::internal::IC::GetSharedFunctionInfo ( ) const
protected

Definition at line 187 of file ic.cc.

187  {
188  // Compute the JavaScript frame for the frame pointer of this IC
189  // structure. We need this to be able to find the function
190  // corresponding to the frame.
191  StackFrameIterator it(isolate());
192  while (it.frame()->fp() != this->fp()) it.Advance();
193  JavaScriptFrame* frame = JavaScriptFrame::cast(it.frame());
194  // Find the function on the stack and both the active code for the
195  // function and the original code.
196  JSFunction* function = frame->function();
197  return function->shared();
198 }
static JavaScriptFrame * cast(StackFrame *frame)
Definition: frames.h:612

References v8::internal::StackFrameIterator::Advance(), v8::internal::JavaScriptFrame::cast(), v8::internal::StackFrameIterator::frame(), v8::internal::JavaScriptFrame::function(), and isolate().

Referenced by GetCode(), and GetOriginalCode().

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

◆ GetTargetAtAddress()

Code * v8::internal::IC::GetTargetAtAddress ( Address  address,
ConstantPoolArray constant_pool 
)
inlinestaticprotected

Definition at line 84 of file ic-inl.h.

85  {
86  // Get the target address of the IC.
88  // Convert target address to the code object. Code::GetCodeFromTargetAddress
89  // is safe for use during GC where the map might be marked.
90  Code* result = Code::GetCodeFromTargetAddress(target);
91  DCHECK(result->is_inline_cache_stub());
92  return result;
93 }
static Code * GetCodeFromTargetAddress(Address address)
Definition: objects-inl.h:5018

References address(), constant_pool(), DCHECK, v8::internal::Code::GetCodeFromTargetAddress(), v8::internal::Code::is_inline_cache_stub(), target(), and v8::internal::Assembler::target_address_at().

Referenced by Clear(), raw_target(), and SetTargetAtAddress().

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

◆ handler_kind()

Code::Kind v8::internal::IC::handler_kind ( ) const
inlineprotected

Definition at line 186 of file ic.h.

186  {
187  if (kind_ == Code::KEYED_LOAD_IC) return Code::LOAD_IC;
188  DCHECK(kind_ == Code::LOAD_IC || kind_ == Code::STORE_IC ||
189  kind_ == Code::KEYED_STORE_IC);
190  return kind_;
191  }

References DCHECK, and kind_.

◆ InvalidateMaps()

void v8::internal::IC::InvalidateMaps ( Code stub)
static

Definition at line 460 of file ic.cc.

460  {
461  DCHECK(stub->is_weak_stub());
462  stub->mark_as_invalidated_weak_stub();
463  Isolate* isolate = stub->GetIsolate();
464  Heap* heap = isolate->heap();
465  Object* undefined = heap->undefined_value();
467  for (RelocIterator it(stub, mode_mask); !it.done(); it.next()) {
468  RelocInfo::Mode mode = it.rinfo()->rmode();
470  it.rinfo()->target_object()->IsMap()) {
471  it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER);
472  }
473  }
474  CpuFeatures::FlushICache(stub->instruction_start(), stub->instruction_size());
475 }
static void FlushICache(void *start, size_t size)
static int ModeMask(Mode mode)
Definition: assembler.h:445
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 mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
@ SKIP_WRITE_BARRIER
Definition: objects.h:235

References DCHECK, v8::internal::RelocIterator::done(), v8::internal::RelocInfo::EMBEDDED_OBJECT, v8::internal::CpuFeatures::FlushICache(), v8::internal::HeapObject::GetIsolate(), v8::internal::Isolate::heap(), v8::internal::Code::instruction_size(), v8::internal::Code::instruction_start(), v8::internal::Code::is_weak_stub(), isolate(), v8::internal::Code::mark_as_invalidated_weak_stub(), mode(), v8::internal::RelocInfo::ModeMask(), and v8::internal::SKIP_WRITE_BARRIER.

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

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

◆ is_target_set()

bool v8::internal::IC::is_target_set ( )
inlineprotected

Definition at line 147 of file ic.h.

147 { return target_set_; }

References target_set_.

Referenced by v8::internal::KeyedLoadIC::Load(), and v8::internal::KeyedStoreIC::Store().

+ Here is the caller graph for this function:

◆ IsCleared()

static bool v8::internal::IC::IsCleared ( Code code)
inlinestatic

Definition at line 112 of file ic.h.

112  {
113  InlineCacheState state = code->ic_state();
114  return state == UNINITIALIZED || state == PREMONOMORPHIC;
115  }

References v8::internal::Code::ic_state(), v8::internal::PREMONOMORPHIC, state(), and v8::internal::UNINITIALIZED.

Referenced by v8::internal::CompareNilIC::Clear(), v8::internal::LoadIC::Clear(), v8::internal::KeyedLoadIC::Clear(), v8::internal::StoreIC::Clear(), and v8::internal::KeyedStoreIC::Clear().

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

◆ IsNameCompatibleWithPrototypeFailure()

bool v8::internal::IC::IsNameCompatibleWithPrototypeFailure ( Handle< Object name)

Definition at line 303 of file ic.cc.

303  {
304  if (target()->is_keyed_stub()) {
305  // Determine whether the failure is due to a name failure.
306  if (!name->IsName()) return false;
307  Name* stub_name = target()->FindFirstName();
308  if (*name != stub_name) return false;
309  }
310 
311  return true;
312 }

References name, and target().

Referenced by MarkPrototypeFailure(), and TryRemoveInvalidPrototypeDependentStub().

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

◆ isolate()

Isolate* v8::internal::IC::isolate ( ) const
inlineprotected

Definition at line 136 of file ic.h.

136 { return isolate_; }

References isolate_.

Referenced by address(), v8::internal::LoadIC::Clear(), v8::internal::KeyedLoadIC::Clear(), v8::internal::StoreIC::Clear(), v8::internal::KeyedStoreIC::Clear(), v8::internal::CompareIC::Clear(), Clear(), v8::internal::CompareNilIC::CompareNil(), v8::internal::LoadIC::CompileHandler(), v8::internal::StoreIC::CompileHandler(), ComputeHandler(), constant_pool(), CurrentTypeOf(), v8::internal::CompareNilIC::DoCompareNilSlow(), v8::internal::CallIC::DoCustomHandler(), v8::internal::CallIC::FeedbackToState(), v8::internal::StoreIC::generic_stub(), v8::internal::KeyedLoadIC::generic_stub(), GetCode(), GetHandlerCacheHolder(), GetICCacheHolder(), GetOriginalCode(), v8::internal::CompareIC::GetRawUninitialized(), GetSharedFunctionInfo(), v8::internal::KeyedStoreIC::GetStoreMode(), v8::internal::CompareIC::GetUninitialized(), v8::internal::CallIC::HandleMiss(), IC(), v8::internal::LoadIC::initialize_stub(), v8::internal::CallIC::initialize_stub(), v8::internal::StoreIC::initialize_stub(), InvalidateMaps(), v8::internal::LoadIC::Load(), v8::internal::KeyedLoadIC::Load(), v8::internal::KeyedLoadIC::LoadElementStub(), v8::internal::LoadIC::megamorphic_stub(), v8::internal::StoreIC::megamorphic_stub(), OnTypeFeedbackChanged(), v8::internal::CallIC::PatchMegamorphic(), PostPatching(), v8::internal::KeyedStoreIC::pre_monomorphic_stub(), v8::internal::KeyedLoadIC::pre_monomorphic_stub(), v8::internal::LoadIC::pre_monomorphic_stub(), v8::internal::StoreIC::pre_monomorphic_stub(), ReferenceError(), v8::internal::LoadIC::SimpleFieldLoad(), v8::internal::KeyedStoreIC::sloppy_arguments_stub(), v8::internal::LoadIC::slow_stub(), v8::internal::StoreIC::slow_stub(), v8::internal::StoreIC::Store(), v8::internal::KeyedStoreIC::Store(), v8::internal::KeyedStoreIC::StoreElementStub(), v8::internal::KeyedLoadIC::string_stub(), v8::internal::ToBooleanIC::ToBoolean(), v8::internal::BinaryOpIC::Transition(), TryRemoveInvalidPrototypeDependentStub(), TypeError(), TypeToMap(), v8::internal::CompareIC::UpdateCaches(), v8::internal::StoreIC::UpdateCaches(), and UpdateMegamorphicCache().

+ Here is the caller graph for this function:

◆ IsTransitionOfMonomorphicTarget()

bool v8::internal::IC::IsTransitionOfMonomorphicTarget ( Map source_map,
Map target_map 
)
protected

Definition at line 772 of file ic.cc.

772  {
773  if (source_map == NULL) return true;
774  if (target_map == NULL) return false;
775  ElementsKind target_elements_kind = target_map->elements_kind();
776  bool more_general_transition = IsMoreGeneralElementsKindTransition(
777  source_map->elements_kind(), target_elements_kind);
778  Map* transitioned_map =
779  more_general_transition
780  ? source_map->LookupElementsTransitionMap(target_elements_kind)
781  : NULL;
782 
783  return transitioned_map == target_map;
784 }
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, ElementsKind to_kind)

References v8::internal::Map::elements_kind(), v8::internal::IsMoreGeneralElementsKindTransition(), v8::internal::Map::LookupElementsTransitionMap(), and NULL.

Referenced by v8::internal::KeyedStoreIC::StoreElementStub(), and UpdatePolymorphicIC().

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

◆ kind()

Code::Kind v8::internal::IC::kind ( ) const
inlineprotected

◆ MapToType()

template<class T >
template Handle< HeapType > v8::internal::IC::MapToType< HeapType > ( Handle< Map map,
typename T::Region *  region 
)
static

Definition at line 733 of file ic.cc.

734  {
735  if (map->instance_type() == HEAP_NUMBER_TYPE) {
736  return T::Number(region);
737  } else if (map->instance_type() == ODDBALL_TYPE) {
738  // The only oddballs that can be recorded in ICs are booleans.
739  return T::Boolean(region);
740  } else {
741  return T::Class(map, region);
742  }
743 }
@ ODDBALL_TYPE
Definition: objects.h:663
@ HEAP_NUMBER_TYPE
Definition: objects.h:669

References v8::internal::HEAP_NUMBER_TYPE, map, and v8::internal::ODDBALL_TYPE.

◆ MarkPrototypeFailure()

void v8::internal::IC::MarkPrototypeFailure ( Handle< Object name)
inline

Definition at line 73 of file ic.h.

73  {
76  }
bool IsNameCompatibleWithPrototypeFailure(Handle< Object > name)
Definition: ic.cc:303
@ PROTOTYPE_FAILURE
Definition: globals.h:452

References DCHECK, IsNameCompatibleWithPrototypeFailure(), name, v8::internal::PROTOTYPE_FAILURE, and state_.

Referenced by UpdateState().

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

◆ megamorphic_stub()

virtual Handle<Code> v8::internal::IC::megamorphic_stub ( )
inlineprotectedvirtual

Reimplemented in v8::internal::StoreIC, and v8::internal::LoadIC.

Definition at line 192 of file ic.h.

192  {
193  UNREACHABLE();
194  return Handle<Code>::null();
195  }

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

Referenced by PatchCache().

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

◆ OnTypeFeedbackChanged()

void v8::internal::IC::OnTypeFeedbackChanged ( Isolate isolate,
Address  address,
State  old_state,
State  new_state,
bool  target_remains_ic_stub 
)
staticprotected

Definition at line 392 of file ic.cc.

394  {
395  Code* host =
397  if (host->kind() != Code::FUNCTION) return;
398 
399  if (FLAG_type_info_threshold > 0 && target_remains_ic_stub &&
400  // Not all Code objects have TypeFeedbackInfo.
401  host->type_feedback_info()->IsTypeFeedbackInfo()) {
402  int polymorphic_delta = 0; // "Polymorphic" here includes monomorphic.
403  int generic_delta = 0; // "Generic" here includes megamorphic.
404  ComputeTypeInfoCountDelta(old_state, new_state, &polymorphic_delta,
405  &generic_delta);
406  TypeFeedbackInfo* info = TypeFeedbackInfo::cast(host->type_feedback_info());
407  info->change_ic_with_type_info_count(polymorphic_delta);
408  info->change_ic_generic_count(generic_delta);
409  }
410  if (host->type_feedback_info()->IsTypeFeedbackInfo()) {
411  TypeFeedbackInfo* info = TypeFeedbackInfo::cast(host->type_feedback_info());
412  info->change_own_type_change_checksum();
413  }
414  host->set_profiler_ticks(0);
416  // TODO(2029): When an optimized function is patched, it would
417  // be nice to propagate the corresponding type information to its
418  // unoptimized version for the benefit of later inlining.
419 }
InnerPointerToCodeCacheEntry * GetCacheEntry(Address inner_pointer)
Definition: frames.cc:1502
RuntimeProfiler * runtime_profiler()
Definition: isolate.h:864
InnerPointerToCodeCache * inner_pointer_to_code_cache()
Definition: isolate.h:911
static void ComputeTypeInfoCountDelta(IC::State old_state, IC::State new_state, int *polymorphic_delta, int *generic_delta)
Definition: ic.cc:355

References address(), v8::internal::TypeFeedbackInfo::change_ic_generic_count(), v8::internal::TypeFeedbackInfo::change_ic_with_type_info_count(), v8::internal::TypeFeedbackInfo::change_own_type_change_checksum(), v8::internal::InnerPointerToCodeCache::InnerPointerToCodeCacheEntry::code, v8::internal::ComputeTypeInfoCountDelta(), v8::internal::InnerPointerToCodeCache::GetCacheEntry(), v8::internal::Isolate::inner_pointer_to_code_cache(), isolate(), v8::internal::Code::kind(), v8::internal::RuntimeProfiler::NotifyICChanged(), v8::internal::Isolate::runtime_profiler(), v8::internal::Code::set_profiler_ticks(), and v8::internal::Code::type_feedback_info().

Referenced by v8::internal::CallIC::DoCustomHandler(), v8::internal::CallIC::HandleMiss(), v8::internal::CallIC::PatchMegamorphic(), and PostPatching().

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

◆ PatchCache()

void v8::internal::IC::PatchCache ( Handle< Name name,
Handle< Code code 
)
protected

Definition at line 787 of file ic.cc.

787  {
788  switch (state()) {
789  case UNINITIALIZED:
790  case PREMONOMORPHIC:
791  UpdateMonomorphicIC(code, name);
792  break;
793  case PROTOTYPE_FAILURE:
794  case MONOMORPHIC:
795  case POLYMORPHIC:
796  if (!target()->is_keyed_stub() || state() == PROTOTYPE_FAILURE) {
797  if (UpdatePolymorphicIC(name, code)) break;
799  }
801  // Fall through.
802  case MEGAMORPHIC:
804  break;
805  case DEBUG_STUB:
806  break;
807  case DEFAULT:
808  case GENERIC:
809  UNREACHABLE();
810  break;
811  }
812 }
void UpdateMonomorphicIC(Handle< Code > handler, Handle< Name > name)
Definition: ic.cc:753
void CopyICToMegamorphicCache(Handle< Name > name)
Definition: ic.cc:761
void set_target(Code *code)
Definition: ic-inl.h:121
bool UpdatePolymorphicIC(Handle< Name > name, Handle< Code > code)
Definition: ic.cc:649
virtual Handle< Code > megamorphic_stub()
Definition: ic.h:192

References CopyICToMegamorphicCache(), v8::internal::DEBUG_STUB, v8::internal::DEFAULT, v8::internal::GENERIC, v8::internal::MEGAMORPHIC, megamorphic_stub(), v8::internal::MONOMORPHIC, name, v8::internal::POLYMORPHIC, v8::internal::PREMONOMORPHIC, v8::internal::PROTOTYPE_FAILURE, receiver_type(), set_target(), state(), target(), v8::internal::UNINITIALIZED, UNREACHABLE, UpdateMegamorphicCache(), UpdateMonomorphicIC(), and UpdatePolymorphicIC().

Referenced by v8::internal::LoadIC::UpdateCaches(), and v8::internal::StoreIC::UpdateCaches().

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

◆ pc()

Address v8::internal::IC::pc ( ) const
inlineprotected

Definition at line 135 of file ic.h.

135 { return *pc_address_; }

References pc_address_.

Referenced by address(), constant_pool(), and TraceIC().

+ Here is the caller graph for this function:

◆ PostPatching()

void v8::internal::IC::PostPatching ( Address  address,
Code target,
Code old_target 
)
staticprotected

Definition at line 422 of file ic.cc.

422  {
423  // Type vector based ICs update these statistics at a different time because
424  // they don't always patch on state change.
425  if (target->kind() == Code::CALL_IC) return;
426 
427  Isolate* isolate = target->GetHeap()->isolate();
428  State old_state = UNINITIALIZED;
429  State new_state = UNINITIALIZED;
430  bool target_remains_ic_stub = false;
431  if (old_target->is_inline_cache_stub() && target->is_inline_cache_stub()) {
432  old_state = old_target->ic_state();
433  new_state = target->ic_state();
434  target_remains_ic_stub = true;
435  }
436 
437  OnTypeFeedbackChanged(isolate, address, old_state, new_state,
438  target_remains_ic_stub);
439 }
InlineCacheState State
Definition: ic.h:55
static void OnTypeFeedbackChanged(Isolate *isolate, Address address, State old_state, State new_state, bool target_remains_ic_stub)
Definition: ic.cc:392

References address(), v8::internal::Code::ic_state(), v8::internal::Code::is_inline_cache_stub(), isolate(), OnTypeFeedbackChanged(), target(), and v8::internal::UNINITIALIZED.

Referenced by SetTargetAtAddress().

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

◆ raw_constant_pool()

ConstantPoolArray * v8::internal::IC::raw_constant_pool ( ) const
inlineprivate

Definition at line 75 of file ic-inl.h.

75  {
76  if (FLAG_enable_ool_constant_pool) {
77  return *raw_constant_pool_;
78  } else {
79  return NULL;
80  }
81 }

References NULL, and raw_constant_pool_.

Referenced by address(), and constant_pool().

+ Here is the caller graph for this function:

◆ raw_target()

Code * v8::internal::IC::raw_target ( ) const
inlineprivate

Definition at line 154 of file ic-inl.h.

154  {
156 }

References address(), constant_pool(), and GetTargetAtAddress().

Referenced by IC(), TraceIC(), and UpdateTarget().

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

◆ receiver_type()

Handle<HeapType> v8::internal::IC::receiver_type ( )
inlineprotected

Definition at line 203 of file ic.h.

203 { return receiver_type_; }
Handle< HeapType > receiver_type_
Definition: ic.h:266

References receiver_type_.

Referenced by v8::internal::LoadIC::CompileHandler(), v8::internal::StoreIC::CompileHandler(), ComputeHandler(), PatchCache(), TryRemoveInvalidPrototypeDependentStub(), v8::internal::LoadIC::UpdateCaches(), UpdateMonomorphicIC(), and UpdatePolymorphicIC().

+ Here is the caller graph for this function:

◆ ReferenceError()

MaybeHandle< Object > v8::internal::IC::ReferenceError ( const char *  type,
Handle< Name name 
)
protected

Definition at line 348 of file ic.cc.

348  {
349  HandleScope scope(isolate());
350  THROW_NEW_ERROR(isolate(), NewReferenceError(type, HandleVector(&name, 1)),
351  Object);
352 }
#define THROW_NEW_ERROR(isolate, call, T)
Definition: isolate.h:138
Vector< Handle< Object > > HandleVector(v8::internal::Handle< T > *elms, int length)
Definition: utils.h:1100

References v8::internal::HandleVector(), isolate(), name, and THROW_NEW_ERROR.

Referenced by v8::internal::LoadIC::Load().

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

◆ RegisterWeakMapDependency()

void v8::internal::IC::RegisterWeakMapDependency ( Handle< Code stub)
static

Definition at line 442 of file ic.cc.

442  {
443  if (FLAG_collect_maps && FLAG_weak_embedded_maps_in_ic &&
444  stub->CanBeWeakStub()) {
445  DCHECK(!stub->is_weak_stub());
446  MapHandleList maps;
447  stub->FindAllMaps(&maps);
448  if (maps.length() == 1 && stub->IsWeakObjectInIC(*maps.at(0))) {
449  Map::AddDependentIC(maps.at(0), stub);
450  stub->mark_as_weak_stub();
451  if (FLAG_enable_ool_constant_pool) {
452  stub->constant_pool()->set_weak_object_state(
454  }
455  }
456  }
457 }
static void AddDependentIC(Handle< Map > map, Handle< Code > stub)
Definition: objects.cc:11367
List< Handle< Map > > MapHandleList
Definition: list.h:197

References v8::internal::Map::AddDependentIC(), v8::internal::List< T, AllocationPolicy >::at(), DCHECK, and v8::internal::ConstantPoolArray::WEAK_OBJECTS_IN_IC.

Referenced by v8::internal::PropertyICCompiler::GetCode().

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

◆ set_extra_ic_state()

void v8::internal::IC::set_extra_ic_state ( ExtraICState  state)
inlineprotected

Definition at line 201 of file ic.h.

201 { extra_ic_state_ = state; }

References extra_ic_state_, and state().

+ Here is the call graph for this function:

◆ set_target()

void v8::internal::IC::set_target ( Code code)
inlineprotected

Definition at line 121 of file ic-inl.h.

121  {
122 #ifdef VERIFY_HEAP
123  code->VerifyEmbeddedObjectsDependency();
124 #endif
126  target_set_ = true;
127 }
static void SetTargetAtAddress(Address address, Code *target, ConstantPoolArray *constant_pool)
Definition: ic-inl.h:96

References address(), constant_pool(), SetTargetAtAddress(), and target_set_.

Referenced by v8::internal::CompareNilIC::CompareNil(), v8::internal::CallIC::DoCustomHandler(), PatchCache(), v8::internal::CallIC::PatchMegamorphic(), v8::internal::LoadIC::set_target(), v8::internal::StoreIC::set_target(), v8::internal::KeyedStoreIC::set_target(), v8::internal::ToBooleanIC::ToBoolean(), v8::internal::BinaryOpIC::Transition(), v8::internal::CompareIC::UpdateCaches(), UpdateMonomorphicIC(), and UpdatePolymorphicIC().

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

◆ SetTargetAtAddress()

void v8::internal::IC::SetTargetAtAddress ( Address  address,
Code target,
ConstantPoolArray constant_pool 
)
inlinestaticprotected

Definition at line 96 of file ic-inl.h.

97  {
98  DCHECK(target->is_inline_cache_stub() || target->is_compare_ic_stub());
99  Heap* heap = target->GetHeap();
100  Code* old_target = GetTargetAtAddress(address, constant_pool);
101 #ifdef DEBUG
102  // STORE_IC and KEYED_STORE_IC use Code::extra_ic_state() to mark
103  // ICs as strict mode. The strict-ness of the IC must be preserved.
104  if (old_target->kind() == Code::STORE_IC ||
105  old_target->kind() == Code::KEYED_STORE_IC) {
106  DCHECK(StoreIC::GetStrictMode(old_target->extra_ic_state()) ==
107  StoreIC::GetStrictMode(target->extra_ic_state()));
108  }
109 #endif
111  target->instruction_start());
112  if (heap->gc_state() == Heap::MARK_COMPACT) {
113  heap->mark_compact_collector()->RecordCodeTargetPatch(address, target);
114  } else {
115  heap->incremental_marking()->RecordCodeTargetPatch(address, target);
116  }
117  PostPatching(address, target, old_target);
118 }
static void set_target_address_at(Address pc, ConstantPoolArray *constant_pool, Address target, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED)
static void PostPatching(Address address, Code *target, Code *old_target)
Definition: ic.cc:422
static StrictMode GetStrictMode(ExtraICState state)
Definition: ic.h:453

References address(), constant_pool(), DCHECK, v8::internal::Code::extra_ic_state(), v8::internal::Heap::gc_state(), v8::internal::StoreIC::GetStrictMode(), GetTargetAtAddress(), v8::internal::Heap::incremental_marking(), v8::internal::Code::kind(), v8::internal::Heap::MARK_COMPACT, v8::internal::Heap::mark_compact_collector(), PostPatching(), v8::internal::MarkCompactCollector::RecordCodeTargetPatch(), v8::internal::IncrementalMarking::RecordCodeTargetPatch(), v8::internal::Assembler::set_target_address_at(), and target().

Referenced by v8::internal::CompareNilIC::Clear(), v8::internal::LoadIC::Clear(), v8::internal::KeyedLoadIC::Clear(), v8::internal::StoreIC::Clear(), v8::internal::KeyedStoreIC::Clear(), v8::internal::CompareIC::Clear(), and set_target().

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

◆ state()

◆ target()

◆ TargetMaps()

void v8::internal::IC::TargetMaps ( MapHandleList list)
inlineprotected

Definition at line 208 of file ic.h.

208  {
209  FindTargetMaps();
210  for (int i = 0; i < target_maps_.length(); i++) {
211  list->Add(target_maps_.at(i));
212  }
213  }

References v8::internal::List< T, AllocationPolicy >::Add(), v8::internal::List< T, AllocationPolicy >::at(), FindTargetMaps(), and target_maps_.

Referenced by v8::internal::KeyedLoadIC::LoadElementStub(), and v8::internal::KeyedStoreIC::StoreElementStub().

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

◆ TargetTypes()

void v8::internal::IC::TargetTypes ( TypeHandleList list)
inlineprotected

Definition at line 215 of file ic.h.

215  {
216  FindTargetMaps();
217  for (int i = 0; i < target_maps_.length(); i++) {
218  list->Add(MapToType<HeapType>(target_maps_.at(i), isolate_));
219  }
220  }

References v8::internal::List< T, AllocationPolicy >::Add(), v8::internal::List< T, AllocationPolicy >::at(), FindTargetMaps(), isolate_, and target_maps_.

Referenced by CopyICToMegamorphicCache(), and UpdatePolymorphicIC().

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

◆ TraceIC() [1/2]

void v8::internal::IC::TraceIC ( const char *  type,
Handle< Object name 
)
protected

Definition at line 90 of file ic.cc.

90  {
91  if (FLAG_trace_ic) {
92  Code* new_target = raw_target();
93  State new_state = new_target->ic_state();
94  TraceIC(type, name, state(), new_state);
95  }
96 }
void TraceIC(const char *type, Handle< Object > name)
Definition: ic.cc:90

References v8::internal::Code::ic_state(), name, raw_target(), and state().

+ Here is the call graph for this function:

◆ TraceIC() [2/2]

void v8::internal::IC::TraceIC ( const char *  type,
Handle< Object name,
State  old_state,
State  new_state 
)
protected

Definition at line 99 of file ic.cc.

100  {
101  if (FLAG_trace_ic) {
102  Code* new_target = raw_target();
103  PrintF("[%s%s in ", new_target->is_keyed_stub() ? "Keyed" : "", type);
104 
105  // TODO(jkummerow): Add support for "apply". The logic is roughly:
106  // marker = [fp_ + kMarkerOffset];
107  // if marker is smi and marker.value == INTERNAL and
108  // the frame's code == builtin(Builtins::kFunctionApply):
109  // then print "apply from" and advance one frame
110 
111  Object* maybe_function =
113  if (maybe_function->IsJSFunction()) {
114  JSFunction* function = JSFunction::cast(maybe_function);
115  JavaScriptFrame::PrintFunctionAndOffset(function, function->code(), pc(),
116  stdout, true);
117  }
118 
119  ExtraICState extra_state = new_target->extra_ic_state();
120  const char* modifier = "";
121  if (new_target->kind() == Code::KEYED_STORE_IC) {
122  modifier = GetTransitionMarkModifier(
124  }
125  PrintF(" (%c->%c%s)", TransitionMarkFromState(old_state),
126  TransitionMarkFromState(new_state), modifier);
127 #ifdef OBJECT_PRINT
128  OFStream os(stdout);
129  name->Print(os);
130 #else
131  name->ShortPrint(stdout);
132 #endif
133  PrintF("]\n");
134  }
135 }
char TransitionMarkFromState(IC::State state)
Definition: ic.cc:25
static void PrintFunctionAndOffset(JSFunction *function, Code *code, Address pc, FILE *file, bool print_line_number)
Definition: frames.cc:781
static KeyedAccessStoreMode GetKeyedAccessStoreMode(ExtraICState extra_state)
Definition: ic.h:543
static Object *& Object_at(Address addr)
Definition: v8memory.h:60
int ExtraICState
Definition: objects.h:305
void PrintF(const char *format,...)
Definition: utils.cc:80
const char * GetTransitionMarkModifier(KeyedAccessStoreMode mode)
Definition: ic.cc:56

References v8::internal::Code::extra_ic_state(), fp_, v8::internal::KeyedStoreIC::GetKeyedAccessStoreMode(), v8::internal::GetTransitionMarkModifier(), v8::internal::Code::is_keyed_stub(), v8::internal::JavaScriptFrameConstants::kFunctionOffset, v8::internal::Code::kind(), name, v8::internal::Memory::Object_at(), pc(), v8::internal::PrintF(), v8::internal::JavaScriptFrame::PrintFunctionAndOffset(), raw_target(), and TransitionMarkFromState().

+ Here is the call graph for this function:

◆ TransitionMarkFromState()

char v8::internal::IC::TransitionMarkFromState ( IC::State  state)
protected

Definition at line 25 of file ic.cc.

25  {
26  switch (state) {
27  case UNINITIALIZED:
28  return '0';
29  case PREMONOMORPHIC:
30  return '.';
31  case MONOMORPHIC:
32  return '1';
33  case PROTOTYPE_FAILURE:
34  return '^';
35  case POLYMORPHIC:
36  return 'P';
37  case MEGAMORPHIC:
38  return 'N';
39  case GENERIC:
40  return 'G';
41 
42  // We never see the debugger states here, because the state is
43  // computed from the original code - not the patched code. Let
44  // these cases fall through to the unreachable code below.
45  case DEBUG_STUB:
46  break;
47  // Type-vector-based ICs resolve state to one of the above.
48  case DEFAULT:
49  break;
50  }
51  UNREACHABLE();
52  return 0;
53 }

References v8::internal::DEBUG_STUB, v8::internal::DEFAULT, v8::internal::GENERIC, v8::internal::MEGAMORPHIC, v8::internal::MONOMORPHIC, v8::internal::POLYMORPHIC, v8::internal::PREMONOMORPHIC, v8::internal::PROTOTYPE_FAILURE, state(), v8::internal::UNINITIALIZED, and UNREACHABLE.

Referenced by TraceIC().

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

◆ TryRemoveInvalidPrototypeDependentStub()

bool v8::internal::IC::TryRemoveInvalidPrototypeDependentStub ( Handle< Object receiver,
Handle< String name 
)
protected

Definition at line 251 of file ic.cc.

252  {
253  if (!IsNameCompatibleWithPrototypeFailure(name)) return false;
254  Handle<Map> receiver_map = TypeToMap(*receiver_type(), isolate());
255  maybe_handler_ = target()->FindHandlerForMap(*receiver_map);
256 
257  // The current map wasn't handled yet. There's no reason to stay monomorphic,
258  // *unless* we're moving from a deprecated map to its replacement, or
259  // to a more general elements kind.
260  // TODO(verwaest): Check if the current map is actually what the old map
261  // would transition to.
262  if (maybe_handler_.is_null()) {
263  if (!receiver_map->IsJSObjectMap()) return false;
264  Map* first_map = FirstTargetMap();
265  if (first_map == NULL) return false;
266  Handle<Map> old_map(first_map);
267  if (old_map->is_deprecated()) return true;
268  if (IsMoreGeneralElementsKindTransition(old_map->elements_kind(),
269  receiver_map->elements_kind())) {
270  return true;
271  }
272  return false;
273  }
274 
276  Handle<Map> ic_holder_map(
278 
279  DCHECK(flag != kCacheOnReceiver || receiver->IsJSObject());
280  DCHECK(flag != kCacheOnPrototype || !receiver->IsJSReceiver());
282 
283  if (state() == MONOMORPHIC) {
284  int index = ic_holder_map->IndexInCodeCache(*name, *target());
285  if (index >= 0) {
286  ic_holder_map->RemoveFromCodeCache(*name, *target(), index);
287  }
288  }
289 
290  if (receiver->IsGlobalObject()) {
291  Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver);
292  LookupIterator it(global, name, LookupIterator::OWN_SKIP_INTERCEPTOR);
293  if (it.state() == LookupIterator::ACCESS_CHECK) return false;
294  if (!it.IsFound()) return false;
295  Handle<PropertyCell> cell = it.GetPropertyCell();
296  return cell->type()->IsConstant();
297  }
298 
299  return true;
300 }
Map * FirstTargetMap()
Definition: ic.h:222
static Handle< Map > GetICCacheHolder(HeapType *type, Isolate *isolate, CacheHolderFlag *flag)
Definition: ic-inl.h:198

References v8::internal::Handle< T >::cast(), DCHECK, FirstTargetMap(), v8::internal::flag, GetICCacheHolder(), v8::internal::IsMoreGeneralElementsKindTransition(), IsNameCompatibleWithPrototypeFailure(), isolate(), v8::internal::kCacheOnPrototype, v8::internal::kCacheOnPrototypeReceiverIsDictionary, v8::internal::kCacheOnReceiver, maybe_handler_, v8::internal::MONOMORPHIC, name, NULL, receiver_type(), state(), target(), and TypeToMap().

Referenced by UpdateState().

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

◆ TypeError()

MaybeHandle< Object > v8::internal::IC::TypeError ( const char *  type,
Handle< Object object,
Handle< Object key 
)
protected

Definition at line 340 of file ic.cc.

341  {
342  HandleScope scope(isolate());
343  Handle<Object> args[2] = {key, object};
344  THROW_NEW_ERROR(isolate(), NewTypeError(type, HandleVector(args, 2)), Object);
345 }

References v8::internal::HandleVector(), isolate(), and THROW_NEW_ERROR.

Referenced by v8::internal::LoadIC::Load(), and v8::internal::StoreIC::Store().

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

◆ TypeToMap()

Handle< Map > v8::internal::IC::TypeToMap ( HeapType type,
Isolate isolate 
)
static

Definition at line 719 of file ic.cc.

719  {
720  if (type->Is(HeapType::Number()))
721  return isolate->factory()->heap_number_map();
722  if (type->Is(HeapType::Boolean())) return isolate->factory()->boolean_map();
723  if (type->IsConstant()) {
724  return handle(
725  Handle<JSGlobalObject>::cast(type->AsConstant()->Value())->map());
726  }
727  DCHECK(type->IsClass());
728  return type->AsClass()->Map();
729 }
Factory * factory()
Definition: isolate.h:982

References v8::internal::TypeImpl< Config >::AsClass(), v8::internal::TypeImpl< Config >::AsConstant(), DCHECK, v8::internal::Isolate::factory(), v8::internal::handle(), v8::internal::TypeImpl< Config >::Is(), v8::internal::TypeImpl< Config >::IsClass(), v8::internal::TypeImpl< Config >::IsConstant(), isolate(), v8::internal::TypeImpl< Config >::ClassType::Map(), and v8::internal::TypeImpl< Config >::ConstantType::Value().

Referenced by v8::internal::NamedLoadHandlerCompiler::CompileLoadCallback(), v8::internal::NamedLoadHandlerCompiler::ComputeLoadNonexistent(), GetHandlerCacheHolder(), GetICCacheHolder(), v8::internal::AccessorInfo::IsCompatibleReceiverType(), v8::internal::PropertyHandlerCompiler::NonexistentFrontendHeader(), TryRemoveInvalidPrototypeDependentStub(), and UpdateMegamorphicCache().

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

◆ update_receiver_type()

void v8::internal::IC::update_receiver_type ( Handle< Object receiver)
inlineprotected

Definition at line 204 of file ic.h.

204  {
206  }
static Handle< HeapType > CurrentTypeOf(Handle< Object > object, Isolate *isolate)
Definition: ic.cc:712

References CurrentTypeOf(), isolate_, and receiver_type_.

Referenced by v8::internal::StoreIC::LookupForWrite(), and UpdateState().

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

◆ UpdateMegamorphicCache()

void v8::internal::IC::UpdateMegamorphicCache ( HeapType type,
Name name,
Code code 
)
protected

Definition at line 890 of file ic.cc.

890  {
891  if (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC) return;
892  Map* map = *TypeToMap(type, isolate());
893  isolate()->stub_cache()->Set(name, map, code);
894 }
Code * Set(Name *name, Map *map, Code *code)
Definition: stub-cache.cc:48

References isolate(), kind(), map, name, v8::internal::StubCache::Set(), v8::internal::Isolate::stub_cache(), and TypeToMap().

Referenced by CopyICToMegamorphicCache(), and PatchCache().

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

◆ UpdateMonomorphicIC()

void v8::internal::IC::UpdateMonomorphicIC ( Handle< Code handler,
Handle< Name name 
)
protected

Definition at line 753 of file ic.cc.

753  {
754  DCHECK(handler->is_handler());
755  Handle<Code> ic = PropertyICCompiler::ComputeMonomorphic(
756  kind(), name, receiver_type(), handler, extra_ic_state());
757  set_target(*ic);
758 }
ExtraICState extra_ic_state() const
Definition: ic.h:200
static Handle< Code > ComputeMonomorphic(Code::Kind kind, Handle< Name > name, Handle< HeapType > type, Handle< Code > handler, ExtraICState extra_ic_state)
Definition: ic-compiler.cc:49

References v8::internal::PropertyICCompiler::ComputeMonomorphic(), DCHECK, extra_ic_state(), kind(), name, receiver_type(), and set_target().

Referenced by PatchCache().

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

◆ UpdatePolymorphicIC()

bool v8::internal::IC::UpdatePolymorphicIC ( Handle< Name name,
Handle< Code code 
)
protected

Definition at line 649 of file ic.cc.

649  {
650  if (!code->is_handler()) return false;
651  if (target()->is_keyed_stub() && state() != PROTOTYPE_FAILURE) return false;
652  Handle<HeapType> type = receiver_type();
653  TypeHandleList types;
654  CodeHandleList handlers;
655 
656  TargetTypes(&types);
657  int number_of_types = types.length();
658  int deprecated_types = 0;
659  int handler_to_overwrite = -1;
660 
661  for (int i = 0; i < number_of_types; i++) {
662  Handle<HeapType> current_type = types.at(i);
663  if (current_type->IsClass() &&
664  current_type->AsClass()->Map()->is_deprecated()) {
665  // Filter out deprecated maps to ensure their instances get migrated.
666  ++deprecated_types;
667  } else if (type->NowIs(current_type)) {
668  // If the receiver type is already in the polymorphic IC, this indicates
669  // there was a prototoype chain failure. In that case, just overwrite the
670  // handler.
671  handler_to_overwrite = i;
672  } else if (handler_to_overwrite == -1 && current_type->IsClass() &&
673  type->IsClass() &&
674  IsTransitionOfMonomorphicTarget(*current_type->AsClass()->Map(),
675  *type->AsClass()->Map())) {
676  handler_to_overwrite = i;
677  }
678  }
679 
680  int number_of_valid_types =
681  number_of_types - deprecated_types - (handler_to_overwrite != -1);
682 
683  if (number_of_valid_types >= 4) return false;
684  if (number_of_types == 0) return false;
685  if (!target()->FindHandlers(&handlers, types.length())) return false;
686 
687  number_of_valid_types++;
688  if (number_of_valid_types > 1 && target()->is_keyed_stub()) return false;
689  Handle<Code> ic;
690  if (number_of_valid_types == 1) {
692  extra_ic_state());
693  } else {
694  if (handler_to_overwrite >= 0) {
695  handlers.Set(handler_to_overwrite, code);
696  if (!type->NowIs(types.at(handler_to_overwrite))) {
697  types.Set(handler_to_overwrite, type);
698  }
699  } else {
700  types.Add(type);
701  handlers.Add(code);
702  }
703  ic = PropertyICCompiler::ComputePolymorphic(kind(), &types, &handlers,
704  number_of_valid_types, name,
705  extra_ic_state());
706  }
707  set_target(*ic);
708  return true;
709 }
bool IsTransitionOfMonomorphicTarget(Map *source_map, Map *target_map)
Definition: ic.cc:772
static Handle< Code > ComputePolymorphic(Code::Kind kind, TypeHandleList *types, CodeHandleList *handlers, int number_of_valid_maps, Handle< Name > name, ExtraICState extra_ic_state)
Definition: ic-compiler.cc:272

References v8::internal::List< T, AllocationPolicy >::Add(), v8::internal::List< T, AllocationPolicy >::at(), v8::internal::PropertyICCompiler::ComputeMonomorphic(), v8::internal::PropertyICCompiler::ComputePolymorphic(), extra_ic_state(), IsTransitionOfMonomorphicTarget(), kind(), name, v8::internal::PROTOTYPE_FAILURE, receiver_type(), v8::internal::List< T, AllocationPolicy >::Set(), set_target(), state(), target(), and TargetTypes().

Referenced by PatchCache().

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

◆ UpdateState()

void v8::internal::IC::UpdateState ( Handle< Object receiver,
Handle< Object name 
)

Definition at line 315 of file ic.cc.

315  {
316  update_receiver_type(receiver);
317  if (!name->IsString()) return;
318  if (state() != MONOMORPHIC && state() != POLYMORPHIC) return;
319  if (receiver->IsUndefined() || receiver->IsNull()) return;
320 
321  // Remove the target from the code cache if it became invalid
322  // because of changes in the prototype chain to avoid hitting it
323  // again.
327  return;
328  }
329 
330  // The builtins object is special. It only changes when JavaScript
331  // builtins are loaded lazily. It is important to keep inline
332  // caches for the builtins object monomorphic. Therefore, if we get
333  // an inline cache miss for the builtins object after lazily loading
334  // JavaScript builtins, we return uninitialized as the state to
335  // force the inline cache back to monomorphic state.
336  if (receiver->IsJSBuiltinsObject()) state_ = UNINITIALIZED;
337 }
void update_receiver_type(Handle< Object > receiver)
Definition: ic.h:204
void MarkPrototypeFailure(Handle< Object > name)
Definition: ic.h:73
bool TryRemoveInvalidPrototypeDependentStub(Handle< Object > receiver, Handle< String > name)
Definition: ic.cc:251

References MarkPrototypeFailure(), v8::internal::MONOMORPHIC, name, v8::internal::POLYMORPHIC, state(), state_, TryRemoveInvalidPrototypeDependentStub(), v8::internal::UNINITIALIZED, and update_receiver_type().

Referenced by v8::internal::RUNTIME_FUNCTION().

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

◆ UpdateTarget()

void v8::internal::IC::UpdateTarget ( )
inlineprotected

Definition at line 158 of file ic-inl.h.

References v8::internal::handle(), isolate_, raw_target(), and target_.

Referenced by v8::internal::BinaryOpIC::Transition().

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

Member Data Documentation

◆ extra_ic_state_

ExtraICState v8::internal::IC::extra_ic_state_
private

Definition at line 269 of file ic.h.

Referenced by extra_ic_state(), IC(), and set_extra_ic_state().

◆ fp_

Address v8::internal::IC::fp_
private

Definition at line 247 of file ic.h.

Referenced by fp(), IC(), and TraceIC().

◆ isolate_

Isolate* v8::internal::IC::isolate_
private

Definition at line 255 of file ic.h.

Referenced by isolate(), TargetTypes(), update_receiver_type(), and UpdateTarget().

◆ kind_

Code::Kind v8::internal::IC::kind_
private

Definition at line 265 of file ic.h.

Referenced by handler_kind(), IC(), and kind().

◆ maybe_handler_

MaybeHandle<Code> v8::internal::IC::maybe_handler_
private

Definition at line 267 of file ic.h.

Referenced by ComputeHandler(), and TryRemoveInvalidPrototypeDependentStub().

◆ pc_address_

Address* v8::internal::IC::pc_address_
private

Definition at line 253 of file ic.h.

Referenced by IC(), and pc().

◆ raw_constant_pool_

Handle<ConstantPoolArray> v8::internal::IC::raw_constant_pool_
private

Definition at line 259 of file ic.h.

Referenced by constant_pool(), IC(), and raw_constant_pool().

◆ receiver_type_

Handle<HeapType> v8::internal::IC::receiver_type_
private

Definition at line 266 of file ic.h.

Referenced by receiver_type(), and update_receiver_type().

◆ state_

State v8::internal::IC::state_
private

Definition at line 264 of file ic.h.

Referenced by FindTargetMaps(), IC(), MarkPrototypeFailure(), state(), and UpdateState().

◆ target_

Handle<Code> v8::internal::IC::target_
private

Definition at line 262 of file ic.h.

Referenced by FindTargetMaps(), IC(), target(), and UpdateTarget().

◆ target_maps_

MapHandleList v8::internal::IC::target_maps_
private

Definition at line 270 of file ic.h.

Referenced by FindTargetMaps(), FirstTargetMap(), TargetMaps(), and TargetTypes().

◆ target_maps_set_

bool v8::internal::IC::target_maps_set_
private

Definition at line 271 of file ic.h.

Referenced by FindTargetMaps().

◆ target_set_

bool v8::internal::IC::target_set_
private

Definition at line 263 of file ic.h.

Referenced by is_target_set(), and set_target().


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