Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
dart::StoreIndexedInstr Class Reference

#include <il.h>

Inheritance diagram for dart::StoreIndexedInstr:
dart::TemplateInstruction< 3, NoThrow >

Public Types

enum  { kArrayPos = 0 , kIndexPos = 1 , kValuePos = 2 }
 
- Public Types inherited from dart::TemplateInstruction< 3, NoThrow >
using BaseClass = typename NoCSE< Instruction, PureInstruction >::Base
 

Public Member Functions

 StoreIndexedInstr (Value *array, Value *index, Value *value, StoreBarrierType emit_store_barrier, bool index_unboxed, intptr_t index_scale, intptr_t class_id, AlignmentType alignment, intptr_t deopt_id, const InstructionSource &source, SpeculativeMode speculative_mode=kGuardInputs)
 
Valuearray () const
 
Valueindex () const
 
Valuevalue () const
 
intptr_t index_scale () const
 
intptr_t class_id () const
 
bool aligned () const
 
bool ShouldEmitStoreBarrier () const
 
void set_emit_store_barrier (StoreBarrierType value)
 
virtual SpeculativeMode SpeculativeModeOfInput (intptr_t index) const
 
virtual bool ComputeCanDeoptimize () const
 
virtual Representation RequiredInputRepresentation (intptr_t idx) const
 
bool IsUntagged () const
 
virtual intptr_t DeoptimizationTarget () const
 
virtual bool HasUnknownSideEffects () const
 
virtual bool MayHaveVisibleEffect () const
 
virtual InstructionCanonicalize (FlowGraph *flow_graph)
 
- Public Member Functions inherited from dart::TemplateInstruction< 3, NoThrow >
 TemplateInstruction (intptr_t deopt_id=DeoptId::kNone)
 
 TemplateInstruction (const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
 
virtual intptr_t InputCount () const
 
virtual ValueInputAt (intptr_t i) const
 
virtual bool MayThrow () const
 

Static Public Member Functions

static Representation ValueRepresentation (intptr_t array_cid)
 

Additional Inherited Members

- Protected Attributes inherited from dart::TemplateInstruction< 3, NoThrow >
EmbeddedArray< Value *, Ninputs_
 

Detailed Description

Definition at line 7020 of file il.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kArrayPos 
kIndexPos 
kValuePos 

Definition at line 7035 of file il.h.

Constructor & Destructor Documentation

◆ StoreIndexedInstr()

dart::StoreIndexedInstr::StoreIndexedInstr ( Value array,
Value index,
Value value,
StoreBarrierType  emit_store_barrier,
bool  index_unboxed,
intptr_t  index_scale,
intptr_t  class_id,
AlignmentType  alignment,
intptr_t  deopt_id,
const InstructionSource source,
SpeculativeMode  speculative_mode = kGuardInputs 
)

Definition at line 6879 of file il.cc.

6890 : TemplateInstruction(source, deopt_id),
6891 emit_store_barrier_(emit_store_barrier),
6892 index_unboxed_(index_unboxed),
6893 index_scale_(index_scale),
6894 class_id_(class_id),
6895 alignment_(StrengthenAlignment(class_id, alignment)),
6896 token_pos_(source.token_pos),
6897 speculative_mode_(speculative_mode) {
6898 // In particular, notice that kPointerCid is _not_ supported because it gives
6899 // no information about whether the elements are signed for elements with
6900 // unboxed integer representations. The constructor must take that information
6901 // separately to allow kPointerCid.
6902 ASSERT(class_id != kPointerCid);
6903 SetInputAt(kArrayPos, array);
6904 SetInputAt(kIndexPos, index);
6905 SetInputAt(kValuePos, value);
6906}
Value * value() const
Definition il.h:7039
Value * array() const
Definition il.h:7037
intptr_t class_id() const
Definition il.h:7042
intptr_t index_scale() const
Definition il.h:7041
Value * index() const
Definition il.h:7038
TemplateInstruction(intptr_t deopt_id=DeoptId::kNone)
Definition il.h:1501
#define ASSERT(E)
SkBitmap source
Definition examples.cpp:28
static AlignmentType StrengthenAlignment(intptr_t cid, AlignmentType alignment)
Definition il.cc:6813

Member Function Documentation

◆ aligned()

bool dart::StoreIndexedInstr::aligned ( ) const
inline

Definition at line 7043 of file il.h.

7043{ return alignment_ == kAlignedAccess; }
@ kAlignedAccess
Definition il.h:6722

◆ array()

Value * dart::StoreIndexedInstr::array ( ) const
inline

Definition at line 7037 of file il.h.

7037{ return inputs_[kArrayPos]; }
EmbeddedArray< Value *, N > inputs_
Definition il.h:1516

◆ Canonicalize()

Instruction * dart::StoreIndexedInstr::Canonicalize ( FlowGraph flow_graph)
virtual

Definition at line 6908 of file il.cc.

6908 {
6909 flow_graph->ExtractExternalUntaggedPayload(this, array(), class_id());
6910
6911 if (auto box = index()->definition()->AsBoxInt64()) {
6912 // TODO(dartbug.com/39432): Make StoreIndexed fully suport unboxed indices.
6913 if (!box->ComputeCanDeoptimize() && compiler::target::kWordSize == 8) {
6914 auto Z = flow_graph->zone();
6915 auto store = new (Z) StoreIndexedInstr(
6916 array()->CopyWithType(Z), box->value()->CopyWithType(Z),
6917 value()->CopyWithType(Z), emit_store_barrier_,
6918 /*index_unboxed=*/true, index_scale(), class_id(), alignment_,
6919 GetDeoptId(), source(), speculative_mode_);
6920 flow_graph->InsertBefore(this, store, env(), FlowGraph::kEffect);
6921 return nullptr;
6922 }
6923 }
6924 return this;
6925}
SI void store(P *ptr, const T &val)
#define Z
StoreIndexedInstr(Value *array, Value *index, Value *value, StoreBarrierType emit_store_barrier, bool index_unboxed, intptr_t index_scale, intptr_t class_id, AlignmentType alignment, intptr_t deopt_id, const InstructionSource &source, SpeculativeMode speculative_mode=kGuardInputs)
Definition il.cc:6879
Value * CopyWithType(Zone *zone)
Definition il.h:138
Definition __init__.py:1

◆ class_id()

intptr_t dart::StoreIndexedInstr::class_id ( ) const
inline

Definition at line 7042 of file il.h.

7042{ return class_id_; }

◆ ComputeCanDeoptimize()

virtual bool dart::StoreIndexedInstr::ComputeCanDeoptimize ( ) const
inlinevirtual

Definition at line 7067 of file il.h.

7067{ return false; }

◆ DeoptimizationTarget()

virtual intptr_t dart::StoreIndexedInstr::DeoptimizationTarget ( ) const
inlinevirtual

Definition at line 7080 of file il.h.

7080 {
7081 // Direct access since this instruction cannot deoptimize, and the deopt-id
7082 // was inherited from another instruction that could deoptimize.
7083 return GetDeoptId();
7084 }

◆ HasUnknownSideEffects()

virtual bool dart::StoreIndexedInstr::HasUnknownSideEffects ( ) const
inlinevirtual

Definition at line 7086 of file il.h.

7086{ return false; }

◆ index()

Value * dart::StoreIndexedInstr::index ( ) const
inline

Definition at line 7038 of file il.h.

7038{ return inputs_[kIndexPos]; }

◆ index_scale()

intptr_t dart::StoreIndexedInstr::index_scale ( ) const
inline

Definition at line 7041 of file il.h.

7041{ return index_scale_; }

◆ IsUntagged()

bool dart::StoreIndexedInstr::IsUntagged ( ) const
inline

Definition at line 7076 of file il.h.

7076 {
7077 return array()->definition()->representation() == kUntagged;
7078 }
virtual Representation representation() const
Definition il.h:1254
Definition * definition() const
Definition il.h:103

◆ MayHaveVisibleEffect()

virtual bool dart::StoreIndexedInstr::MayHaveVisibleEffect ( ) const
inlinevirtual

Definition at line 7088 of file il.h.

7088{ return true; }

◆ RequiredInputRepresentation()

Representation dart::StoreIndexedInstr::RequiredInputRepresentation ( intptr_t  idx) const
virtual

Definition at line 6932 of file il.cc.

6933 {
6934 // Array can be a Dart object or a pointer to external data.
6935 if (idx == 0) return kNoRepresentation; // Flexible input representation.
6936 if (idx == 1) {
6937 if (index_unboxed_) {
6938#if defined(TARGET_ARCH_IS_64_BIT)
6939 return kUnboxedInt64;
6940#else
6941 // TODO(dartbug.com/39432): kUnboxedInt32 || kUnboxedUint32 on 32-bit
6942 // architectures.
6943 return kNoRepresentation; // Index can be any unboxed representation.
6944#endif
6945 } else {
6946 return kTagged; // Index is a smi.
6947 }
6948 }
6949 ASSERT(idx == 2);
6950 return ValueRepresentation(class_id());
6951}
static Representation ValueRepresentation(intptr_t array_cid)
Definition il.cc:6927

◆ set_emit_store_barrier()

void dart::StoreIndexedInstr::set_emit_store_barrier ( StoreBarrierType  value)
inline

Definition at line 7059 of file il.h.

7059 {
7060 emit_store_barrier_ = value;
7061 }

◆ ShouldEmitStoreBarrier()

bool dart::StoreIndexedInstr::ShouldEmitStoreBarrier ( ) const
inline

Definition at line 7045 of file il.h.

7045 {
7046 if (array()->definition() == value()->definition()) {
7047 // `x[slot] = x` cannot create an old->new or old&marked->old&unmarked
7048 // reference.
7049 return false;
7050 }
7051
7052 if (value()->definition()->Type()->IsBool()) {
7053 return false;
7054 }
7055 return value()->NeedsWriteBarrier() &&
7056 (emit_store_barrier_ == kEmitStoreBarrier);
7057 }
bool NeedsWriteBarrier()
Definition il.cc:1388
@ kEmitStoreBarrier
Definition il.h:6252

◆ SpeculativeModeOfInput()

virtual SpeculativeMode dart::StoreIndexedInstr::SpeculativeModeOfInput ( intptr_t  index) const
inlinevirtual

Definition at line 7063 of file il.h.

7063 {
7064 return speculative_mode_;
7065 }

◆ value()

Value * dart::StoreIndexedInstr::value ( ) const
inline

Definition at line 7039 of file il.h.

7039{ return inputs_[kValuePos]; }

◆ ValueRepresentation()

Representation dart::StoreIndexedInstr::ValueRepresentation ( intptr_t  array_cid)
static

Definition at line 6927 of file il.cc.

6927 {
6930}
static constexpr Representation NativeRepresentation(Representation rep)
Definition il.h:8456
static Representation RepresentationOfArrayElement(classid_t cid)
Definition locations.cc:79

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