V8 Project
v8::internal::StoreIC Class Reference

#include <ic.h>

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

Classes

class  StrictModeState
 

Public Member Functions

 StoreIC (FrameDepth depth, Isolate *isolate)
 
StrictMode strict_mode () const
 
MUST_USE_RESULT MaybeHandle< ObjectStore (Handle< Object > object, Handle< Name > name, Handle< Object > value, JSReceiver::StoreFromKeyed store_mode=JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED)
 
bool LookupForWrite (LookupIterator *it, Handle< Object > value, JSReceiver::StoreFromKeyed store_mode)
 
- Public Member Functions inherited from v8::internal::IC
 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 ExtraICState ComputeExtraICState (StrictMode flag)
 
static StrictMode GetStrictMode (ExtraICState state)
 
static void GenerateSlow (MacroAssembler *masm)
 
static void GenerateInitialize (MacroAssembler *masm)
 
static void GeneratePreMonomorphic (MacroAssembler *masm)
 
static void GenerateMiss (MacroAssembler *masm)
 
static void GenerateMegamorphic (MacroAssembler *masm)
 
static void GenerateNormal (MacroAssembler *masm)
 
static void GenerateRuntimeSetProperty (MacroAssembler *masm, StrictMode strict_mode)
 
static Handle< Codeinitialize_stub (Isolate *isolate, StrictMode strict_mode)
 
- Static Public Member Functions inherited from v8::internal::IC
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)
 

Static Public Attributes

static const ExtraICState kStrictModeState = 1 << StrictModeState::kShift
 

Protected Member Functions

virtual Handle< Codemegamorphic_stub () OVERRIDE
 
Handle< Codegeneric_stub () const
 
Handle< Codeslow_stub () const
 
virtual Handle< Codepre_monomorphic_stub () const
 
void UpdateCaches (LookupIterator *lookup, Handle< Object > value, JSReceiver::StoreFromKeyed store_mode)
 
virtual Handle< CodeCompileHandler (LookupIterator *lookup, Handle< Object > value, CacheHolderFlag cache_holder)
 
- Protected Member Functions inherited from v8::internal::IC
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())
 
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
 
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 Handle< Codepre_monomorphic_stub (Isolate *isolate, StrictMode strict_mode)
 
- Static Protected Member Functions inherited from v8::internal::IC
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

void set_target (Code *code)
 

Static Private Member Functions

static void Clear (Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
 

Friends

class IC
 

Additional Inherited Members

- Public Types inherited from v8::internal::IC
enum  UtilityId { kUtilityCount }
 
enum  FrameDepth { NO_EXTRA_FRAME = 0 , EXTRA_CALL_FRAME = 1 }
 
typedef InlineCacheState State
 

Detailed Description

Definition at line 447 of file ic.h.

Constructor & Destructor Documentation

◆ StoreIC()

v8::internal::StoreIC::StoreIC ( FrameDepth  depth,
Isolate isolate 
)
inline

Definition at line 461 of file ic.h.

461  : IC(depth, isolate) {
462  DCHECK(IsStoreStub());
463  }
Isolate * isolate() const
Definition: ic.h:136
friend class IC
Definition: ic.h:520
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK.

Member Function Documentation

◆ Clear()

void v8::internal::StoreIC::Clear ( Isolate isolate,
Address  address,
Code target,
ConstantPoolArray constant_pool 
)
staticprivate

Definition at line 536 of file ic.cc.

537  {
538  if (IsCleared(target)) return;
539  Code* code = PropertyICCompiler::FindPreMonomorphic(isolate, Code::STORE_IC,
540  target->extra_ic_state());
542 }
static void SetTargetAtAddress(Address address, Code *target, ConstantPoolArray *constant_pool)
Definition: ic-inl.h:96
ConstantPoolArray * constant_pool() const
Definition: ic-inl.h:51
Address address() const
Definition: ic-inl.h:19
Handle< Code > target() const
Definition: ic.h:132
static bool IsCleared(Code *code)
Definition: ic.h:112
static Code * FindPreMonomorphic(Isolate *isolate, Code::Kind kind, ExtraICState extra_ic_state)
Definition: ic-compiler.cc:149

References v8::internal::IC::address(), v8::internal::IC::constant_pool(), v8::internal::PropertyICCompiler::FindPreMonomorphic(), v8::internal::IC::IsCleared(), v8::internal::IC::isolate(), v8::internal::IC::SetTargetAtAddress(), and v8::internal::IC::target().

Referenced by v8::internal::IC::Clear().

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

◆ CompileHandler()

Handle< Code > v8::internal::StoreIC::CompileHandler ( LookupIterator *  lookup,
Handle< Object value,
CacheHolderFlag  cache_holder 
)
protectedvirtual

Reimplemented from v8::internal::IC.

Definition at line 1423 of file ic.cc.

1425  {
1426  DCHECK_NE(LookupIterator::JSPROXY, lookup->state());
1427 
1428  // This is currently guaranteed by checks in StoreIC::Store.
1429  Handle<JSObject> receiver = Handle<JSObject>::cast(lookup->GetReceiver());
1430  Handle<JSObject> holder = lookup->GetHolder<JSObject>();
1431  DCHECK(!receiver->IsAccessCheckNeeded());
1432 
1433  switch (lookup->state()) {
1434  case LookupIterator::TRANSITION: {
1435  Handle<Map> transition = lookup->transition_map();
1436  // Currently not handled by CompileStoreTransition.
1437  if (!holder->HasFastProperties()) {
1438  TRACE_GENERIC_IC(isolate(), "StoreIC", "transition from slow");
1439  break;
1440  }
1441 
1442  DCHECK(lookup->IsCacheableTransition());
1443  NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder);
1444  return compiler.CompileStoreTransition(transition, lookup->name());
1445  }
1446 
1447  case LookupIterator::INTERCEPTOR: {
1448  DCHECK(!holder->GetNamedInterceptor()->setter()->IsUndefined());
1449  NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder);
1450  return compiler.CompileStoreInterceptor(lookup->name());
1451  }
1452 
1453  case LookupIterator::ACCESSOR: {
1454  if (!holder->HasFastProperties()) {
1455  TRACE_GENERIC_IC(isolate(), "StoreIC", "accessor on slow map");
1456  break;
1457  }
1458  Handle<Object> accessors = lookup->GetAccessors();
1459  if (accessors->IsExecutableAccessorInfo()) {
1460  Handle<ExecutableAccessorInfo> info =
1462  if (v8::ToCData<Address>(info->setter()) == 0) {
1463  TRACE_GENERIC_IC(isolate(), "StoreIC", "setter == 0");
1464  break;
1465  }
1467  isolate(), info, receiver_type())) {
1468  TRACE_GENERIC_IC(isolate(), "StoreIC", "incompatible receiver type");
1469  break;
1470  }
1471  NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder);
1472  return compiler.CompileStoreCallback(receiver, lookup->name(), info);
1473  } else if (accessors->IsAccessorPair()) {
1474  Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(),
1475  isolate());
1476  if (!setter->IsJSFunction()) {
1477  TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function");
1478  break;
1479  }
1480  Handle<JSFunction> function = Handle<JSFunction>::cast(setter);
1481  CallOptimization call_optimization(function);
1482  NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder);
1483  if (call_optimization.is_simple_api_call() &&
1484  call_optimization.IsCompatibleReceiver(receiver, holder)) {
1485  return compiler.CompileStoreCallback(receiver, lookup->name(),
1486  call_optimization);
1487  }
1488  return compiler.CompileStoreViaSetter(receiver, lookup->name(),
1489  Handle<JSFunction>::cast(setter));
1490  }
1491  // TODO(dcarney): Handle correctly.
1492  DCHECK(accessors->IsDeclaredAccessorInfo());
1493  TRACE_GENERIC_IC(isolate(), "StoreIC", "declared accessor info");
1494  break;
1495  }
1496 
1497  case LookupIterator::DATA: {
1498  if (lookup->is_dictionary_holder()) {
1499  if (holder->IsGlobalObject()) {
1500  Handle<PropertyCell> cell = lookup->GetPropertyCell();
1501  Handle<HeapType> union_type = PropertyCell::UpdatedType(cell, value);
1502  StoreGlobalStub stub(isolate(), union_type->IsConstant(),
1503  receiver->IsJSGlobalProxy());
1504  Handle<Code> code = stub.GetCodeCopyFromTemplate(
1505  Handle<GlobalObject>::cast(holder), cell);
1506  // TODO(verwaest): Move caching of these NORMAL stubs outside as well.
1507  HeapObject::UpdateMapCodeCache(receiver, lookup->name(), code);
1508  return code;
1509  }
1510  DCHECK(holder.is_identical_to(receiver));
1511  return isolate()->builtins()->StoreIC_Normal();
1512  }
1513 
1514  // -------------- Fields --------------
1515  if (lookup->property_details().type() == FIELD) {
1516  bool use_stub = true;
1517  if (lookup->representation().IsHeapObject()) {
1518  // Only use a generic stub if no types need to be tracked.
1519  Handle<HeapType> field_type = lookup->GetFieldType();
1520  HeapType::Iterator<Map> it = field_type->Classes();
1521  use_stub = it.Done();
1522  }
1523  if (use_stub) {
1524  StoreFieldStub stub(isolate(), lookup->GetFieldIndex(),
1525  lookup->representation());
1526  return stub.GetCode();
1527  }
1528  NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder);
1529  return compiler.CompileStoreField(lookup);
1530  }
1531 
1532  // -------------- Constant properties --------------
1533  DCHECK(lookup->property_details().type() == CONSTANT);
1534  TRACE_GENERIC_IC(isolate(), "StoreIC", "constant property");
1535  break;
1536  }
1537 
1538  case LookupIterator::ACCESS_CHECK:
1539  case LookupIterator::JSPROXY:
1540  case LookupIterator::NOT_FOUND:
1541  UNREACHABLE();
1542  }
1543  return slow_stub();
1544 }
static bool IsCompatibleReceiverType(Isolate *isolate, Handle< AccessorInfo > info, Handle< HeapType > type)
Definition: objects.cc:467
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
static void UpdateMapCodeCache(Handle< HeapObject > object, Handle< Name > name, Handle< Code > code)
Definition: objects.cc:4158
Handle< HeapType > receiver_type()
Definition: ic.h:203
Builtins * builtins()
Definition: isolate.h:947
static Handle< HeapType > UpdatedType(Handle< PropertyCell > cell, Handle< Object > value)
Definition: objects.cc:16348
Handle< Code > slow_stub() const
Definition: ic.cc:1385
#define TRACE_GENERIC_IC(isolate, type, reason)
Definition: ic.cc:79
#define UNREACHABLE()
Definition: logging.h:30
#define DCHECK_NE(v1, v2)
Definition: logging.h:207

References v8::internal::ACCESSOR, v8::internal::Isolate::builtins(), v8::internal::Handle< T >::cast(), v8::internal::NamedStoreHandlerCompiler::CompileStoreCallback(), v8::internal::NamedStoreHandlerCompiler::CompileStoreField(), v8::internal::NamedStoreHandlerCompiler::CompileStoreInterceptor(), v8::internal::NamedStoreHandlerCompiler::CompileStoreTransition(), v8::internal::NamedStoreHandlerCompiler::CompileStoreViaSetter(), v8::internal::CONSTANT, DCHECK, DCHECK_NE, v8::internal::TypeImpl< Config >::Iterator< T >::Done(), v8::internal::FIELD, v8::internal::StoreGlobalStub::GetCodeCopyFromTemplate(), v8::internal::AccessorInfo::IsCompatibleReceiverType(), v8::internal::IC::isolate(), v8::internal::IC::receiver_type(), slow_stub(), TRACE_GENERIC_IC, UNREACHABLE, v8::internal::PropertyCell::UpdatedType(), and v8::internal::HeapObject::UpdateMapCodeCache().

+ Here is the call graph for this function:

◆ ComputeExtraICState()

static ExtraICState v8::internal::StoreIC::ComputeExtraICState ( StrictMode  flag)
inlinestatic

Definition at line 450 of file ic.h.

450  {
452  }
static U encode(T value)
Definition: utils.h:217
kFeedbackVectorOffset flag
Definition: objects-inl.h:5418

References v8::internal::flag.

Referenced by initialize_stub(), and pre_monomorphic_stub().

+ Here is the caller graph for this function:

◆ GenerateInitialize()

static void v8::internal::StoreIC::GenerateInitialize ( MacroAssembler masm)
inlinestatic

Definition at line 471 of file ic.h.

471 { GenerateMiss(masm); }
static void GenerateMiss(MacroAssembler *masm)

References v8::internal::LoadIC::GenerateMiss().

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

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

◆ GenerateMegamorphic()

static void v8::internal::StoreIC::GenerateMegamorphic ( MacroAssembler masm)
static

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

+ Here is the caller graph for this function:

◆ GenerateMiss()

static void v8::internal::StoreIC::GenerateMiss ( MacroAssembler masm)
static

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

+ Here is the caller graph for this function:

◆ GenerateNormal()

static void v8::internal::StoreIC::GenerateNormal ( MacroAssembler masm)
static

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

+ Here is the caller graph for this function:

◆ GeneratePreMonomorphic()

static void v8::internal::StoreIC::GeneratePreMonomorphic ( MacroAssembler masm)
inlinestatic

Definition at line 472 of file ic.h.

472  {
473  GenerateMiss(masm);
474  }

References v8::internal::LoadIC::GenerateMiss().

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

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

◆ GenerateRuntimeSetProperty()

static void v8::internal::StoreIC::GenerateRuntimeSetProperty ( MacroAssembler masm,
StrictMode  strict_mode 
)
static

◆ GenerateSlow()

static void v8::internal::StoreIC::GenerateSlow ( MacroAssembler masm)
static

◆ generic_stub()

Handle< Code > v8::internal::StoreIC::generic_stub ( ) const
protected

Definition at line 1370 of file ic.cc.

1370  {
1371  if (kind() == Code::STORE_IC) {
1373  extra_ic_state());
1374  } else {
1375  DCHECK(kind() == Code::KEYED_STORE_IC);
1376  if (strict_mode() == STRICT) {
1377  return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
1378  } else {
1379  return isolate()->builtins()->KeyedStoreIC_Generic();
1380  }
1381  }
1382 }
Code::Kind kind() const
Definition: ic.h:185
ExtraICState extra_ic_state() const
Definition: ic.h:200
static Handle< Code > ComputeStore(Isolate *isolate, InlineCacheState ic_state, ExtraICState extra_state)
Definition: ic-compiler.cc:193
StrictMode strict_mode() const
Definition: ic.h:465

References v8::internal::Isolate::builtins(), v8::internal::PropertyICCompiler::ComputeStore(), DCHECK, v8::internal::IC::extra_ic_state(), v8::internal::GENERIC, v8::internal::IC::isolate(), v8::internal::IC::kind(), v8::internal::STRICT, and strict_mode().

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

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

◆ GetStrictMode()

static StrictMode v8::internal::StoreIC::GetStrictMode ( ExtraICState  state)
inlinestatic

Definition at line 453 of file ic.h.

453  {
455  }
static T decode(U value)
Definition: utils.h:228
State state() const
Definition: ic.h:66

References v8::internal::IC::state().

Referenced by v8::internal::KeyedStoreIC::Clear(), v8::internal::PropertyICCompiler::CompileStoreGeneric(), set_target(), v8::internal::KeyedStoreIC::set_target(), and v8::internal::IC::SetTargetAtAddress().

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

◆ initialize_stub()

Handle< Code > v8::internal::StoreIC::initialize_stub ( Isolate isolate,
StrictMode  strict_mode 
)
static

Definition at line 1346 of file ic.cc.

1347  {
1349  Handle<Code> ic =
1351  return ic;
1352 }
static ExtraICState ComputeExtraICState(StrictMode flag)
Definition: ic.h:450
int ExtraICState
Definition: objects.h:305
@ UNINITIALIZED
Definition: globals.h:446

References ComputeExtraICState(), v8::internal::PropertyICCompiler::ComputeStore(), v8::internal::IC::isolate(), strict_mode(), and v8::internal::UNINITIALIZED.

+ Here is the call graph for this function:

◆ LookupForWrite()

bool v8::internal::StoreIC::LookupForWrite ( LookupIterator *  it,
Handle< Object value,
JSReceiver::StoreFromKeyed  store_mode 
)

Definition at line 1221 of file ic.cc.

1222  {
1223  // Disable ICs for non-JSObjects for now.
1224  Handle<Object> receiver = it->GetReceiver();
1225  if (!receiver->IsJSObject()) return false;
1226  DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated());
1227 
1228  for (; it->IsFound(); it->Next()) {
1229  switch (it->state()) {
1230  case LookupIterator::NOT_FOUND:
1231  case LookupIterator::TRANSITION:
1232  UNREACHABLE();
1233  case LookupIterator::JSPROXY:
1234  return false;
1235  case LookupIterator::INTERCEPTOR: {
1236  Handle<JSObject> holder = it->GetHolder<JSObject>();
1237  InterceptorInfo* info = holder->GetNamedInterceptor();
1238  if (it->HolderIsReceiverOrHiddenPrototype()) {
1239  if (!info->setter()->IsUndefined()) return true;
1240  } else if (!info->getter()->IsUndefined() ||
1241  !info->query()->IsUndefined()) {
1242  return false;
1243  }
1244  break;
1245  }
1246  case LookupIterator::ACCESS_CHECK:
1247  if (it->GetHolder<JSObject>()->IsAccessCheckNeeded()) return false;
1248  break;
1250  return !it->IsReadOnly();
1251  case LookupIterator::DATA: {
1252  if (it->IsReadOnly()) return false;
1253  Handle<JSObject> holder = it->GetHolder<JSObject>();
1254  if (receiver.is_identical_to(holder)) {
1255  it->PrepareForDataProperty(value);
1256  // The previous receiver map might just have been deprecated,
1257  // so reload it.
1258  update_receiver_type(receiver);
1259  return true;
1260  }
1261 
1262  // Receiver != holder.
1263  PrototypeIterator iter(it->isolate(), receiver);
1264  if (receiver->IsJSGlobalProxy()) {
1265  return it->GetHolder<Object>().is_identical_to(
1267  }
1268 
1269  it->PrepareTransitionToDataProperty(value, NONE, store_mode);
1270  return it->IsCacheableTransition();
1271  }
1272  }
1273  }
1274 
1275  it->PrepareTransitionToDataProperty(value, NONE, store_mode);
1276  return it->IsCacheableTransition();
1277 }
void update_receiver_type(Handle< Object > receiver)
Definition: ic.h:204
Object * GetCurrent() const
Definition: prototype.h:62
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
@ NONE

References v8::internal::ACCESSOR, DCHECK, v8::internal::PrototypeIterator::GetCurrent(), map, NONE, UNREACHABLE, and v8::internal::IC::update_receiver_type().

Referenced by UpdateCaches().

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

◆ megamorphic_stub()

Handle< Code > v8::internal::StoreIC::megamorphic_stub ( )
protectedvirtual

Reimplemented from v8::internal::IC.

Definition at line 1355 of file ic.cc.

1355  {
1356  if (kind() == Code::STORE_IC) {
1358  extra_ic_state());
1359  } else {
1360  DCHECK(kind() == Code::KEYED_STORE_IC);
1361  if (strict_mode() == STRICT) {
1362  return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
1363  } else {
1364  return isolate()->builtins()->KeyedStoreIC_Generic();
1365  }
1366  }
1367 }

References v8::internal::Isolate::builtins(), v8::internal::PropertyICCompiler::ComputeStore(), DCHECK, v8::internal::IC::extra_ic_state(), v8::internal::IC::isolate(), v8::internal::IC::kind(), v8::internal::MEGAMORPHIC, v8::internal::STRICT, and strict_mode().

+ Here is the call graph for this function:

◆ pre_monomorphic_stub() [1/2]

virtual Handle<Code> v8::internal::StoreIC::pre_monomorphic_stub ( ) const
inlineprotectedvirtual

Reimplemented in v8::internal::KeyedStoreIC.

Definition at line 499 of file ic.h.

499  {
501  }
virtual Handle< Code > pre_monomorphic_stub() const
Definition: ic.h:499

References v8::internal::IC::isolate(), and v8::internal::LoadIC::pre_monomorphic_stub().

Referenced by UpdateCaches().

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

◆ pre_monomorphic_stub() [2/2]

Handle< Code > v8::internal::StoreIC::pre_monomorphic_stub ( Isolate isolate,
StrictMode  strict_mode 
)
staticprotected

Definition at line 1395 of file ic.cc.

References ComputeExtraICState(), v8::internal::PropertyICCompiler::ComputeStore(), v8::internal::IC::isolate(), v8::internal::PREMONOMORPHIC, v8::internal::IC::state(), and strict_mode().

+ Here is the call graph for this function:

◆ set_target()

void v8::internal::StoreIC::set_target ( Code code)
inlineprivate

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

139  {
140  // Strict mode must be preserved across IC patching.
141  DCHECK(GetStrictMode(code->extra_ic_state()) ==
143  IC::set_target(code);
144 }
void set_target(Code *code)
Definition: ic-inl.h:121
static StrictMode GetStrictMode(ExtraICState state)
Definition: ic.h:453

References DCHECK, v8::internal::Code::extra_ic_state(), v8::internal::IC::extra_ic_state(), GetStrictMode(), v8::internal::IC::set_target(), and v8::internal::IC::target().

Referenced by UpdateCaches().

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

◆ slow_stub()

Handle< Code > v8::internal::StoreIC::slow_stub ( ) const
protected

Definition at line 1385 of file ic.cc.

1385  {
1386  if (kind() == Code::STORE_IC) {
1387  return isolate()->builtins()->StoreIC_Slow();
1388  } else {
1389  DCHECK(kind() == Code::KEYED_STORE_IC);
1390  return isolate()->builtins()->KeyedStoreIC_Slow();
1391  }
1392 }

References v8::internal::Isolate::builtins(), DCHECK, v8::internal::IC::isolate(), and v8::internal::IC::kind().

Referenced by CompileHandler(), v8::internal::KeyedStoreIC::Store(), and UpdateCaches().

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

◆ Store()

MaybeHandle< Object > v8::internal::StoreIC::Store ( Handle< Object object,
Handle< Name name,
Handle< Object value,
JSReceiver::StoreFromKeyed  store_mode = JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED 
)

Definition at line 1280 of file ic.cc.

1282  {
1283  // TODO(verwaest): Let SetProperty do the migration, since storing a property
1284  // might deprecate the current map again, if value does not fit.
1285  if (MigrateDeprecated(object) || object->IsJSProxy()) {
1286  Handle<Object> result;
1288  isolate(), result,
1289  Object::SetProperty(object, name, value, strict_mode()), Object);
1290  return result;
1291  }
1292 
1293  // If the object is undefined or null it's illegal to try to set any
1294  // properties on it; throw a TypeError in that case.
1295  if (object->IsUndefined() || object->IsNull()) {
1296  return TypeError("non_object_property_store", object, name);
1297  }
1298 
1299  // Check if the given name is an array index.
1300  uint32_t index;
1301  if (name->AsArrayIndex(&index)) {
1302  // Ignore other stores where the receiver is not a JSObject.
1303  // TODO(1475): Must check prototype chains of object wrappers.
1304  if (!object->IsJSObject()) return value;
1305  Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1306 
1307  Handle<Object> result;
1309  isolate(), result,
1310  JSObject::SetElement(receiver, index, value, NONE, strict_mode()),
1311  Object);
1312  return value;
1313  }
1314 
1315  // Observed objects are always modified through the runtime.
1316  if (object->IsHeapObject() &&
1317  Handle<HeapObject>::cast(object)->map()->is_observed()) {
1318  Handle<Object> result;
1320  isolate(), result,
1321  Object::SetProperty(object, name, value, strict_mode(), store_mode),
1322  Object);
1323  return result;
1324  }
1325 
1326  LookupIterator it(object, name);
1327  if (FLAG_use_ic) UpdateCaches(&it, value, store_mode);
1328 
1329  // Set the property.
1330  Handle<Object> result;
1332  isolate(), result,
1333  Object::SetProperty(&it, value, strict_mode(), store_mode), Object);
1334  return result;
1335 }
MaybeHandle< Object > TypeError(const char *type, Handle< Object > object, Handle< Object > key)
Definition: ic.cc:340
static MUST_USE_RESULT MaybeHandle< Object > SetElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, bool check_prototype=true, SetPropertyMode set_mode=SET_PROPERTY)
Definition: objects.cc:12336
static MUST_USE_RESULT MaybeHandle< Object > SetProperty(Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
Definition: objects.cc:2798
void UpdateCaches(LookupIterator *lookup, Handle< Object > value, JSReceiver::StoreFromKeyed store_mode)
Definition: ic.cc:1402
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
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T)
Definition: isolate.h:135
static bool MigrateDeprecated(Handle< Object > object)
Definition: ic.cc:577

References ASSIGN_RETURN_ON_EXCEPTION, v8::internal::Handle< T >::cast(), v8::internal::IC::isolate(), v8::internal::MigrateDeprecated(), name, NONE, v8::internal::JSObject::SetElement(), v8::internal::Object::SetProperty(), strict_mode(), v8::internal::IC::TypeError(), and UpdateCaches().

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

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

◆ strict_mode()

StrictMode v8::internal::StoreIC::strict_mode ( ) const
inline

Definition at line 465 of file ic.h.

465  {
467  }

References v8::internal::IC::extra_ic_state().

Referenced by generic_stub(), initialize_stub(), megamorphic_stub(), pre_monomorphic_stub(), v8::internal::RUNTIME_FUNCTION(), v8::internal::KeyedStoreIC::set_target(), Store(), v8::internal::KeyedStoreIC::Store(), and v8::internal::KeyedStoreIC::StoreElementStub().

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

◆ UpdateCaches()

void v8::internal::StoreIC::UpdateCaches ( LookupIterator *  lookup,
Handle< Object value,
JSReceiver::StoreFromKeyed  store_mode 
)
protected

Definition at line 1402 of file ic.cc.

1403  {
1404  if (state() == UNINITIALIZED) {
1405  // This is the first time we execute this inline cache. Set the target to
1406  // the pre monomorphic stub to delay setting the monomorphic state.
1408  TRACE_IC("StoreIC", lookup->name());
1409  return;
1410  }
1411 
1412  bool use_ic = LookupForWrite(lookup, value, store_mode);
1413  if (!use_ic) {
1414  TRACE_GENERIC_IC(isolate(), "StoreIC", "LookupForWrite said 'false'");
1415  }
1416  Handle<Code> code = use_ic ? ComputeHandler(lookup, value) : slow_stub();
1417 
1418  PatchCache(lookup->name(), code);
1419  TRACE_IC("StoreIC", lookup->name());
1420 }
void PatchCache(Handle< Name > name, Handle< Code > code)
Definition: ic.cc:787
Handle< Code > ComputeHandler(LookupIterator *lookup, Handle< Object > value=Handle< Code >::null())
Definition: ic.cc:897
void set_target(Code *code)
Definition: ic-inl.h:139
bool LookupForWrite(LookupIterator *it, Handle< Object > value, JSReceiver::StoreFromKeyed store_mode)
Definition: ic.cc:1221
#define TRACE_IC(type, name)
Definition: ic.cc:137

References v8::internal::IC::ComputeHandler(), v8::internal::IC::isolate(), LookupForWrite(), v8::internal::IC::PatchCache(), pre_monomorphic_stub(), set_target(), slow_stub(), v8::internal::IC::state(), TRACE_GENERIC_IC, TRACE_IC, and v8::internal::UNINITIALIZED.

Referenced by Store().

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

Friends And Related Function Documentation

◆ IC

friend class IC
friend

Definition at line 520 of file ic.h.

Member Data Documentation

◆ kStrictModeState

const ExtraICState v8::internal::StoreIC::kStrictModeState = 1 << StrictModeState::kShift
static

Definition at line 459 of file ic.h.


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