Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | List of all members
dart::StoreFieldInstr Class Reference

#include <il.h>

Inheritance diagram for dart::StoreFieldInstr:
dart::TemplateInstruction< 2, NoThrow > dart::Instruction dart::ZoneAllocated

Public Types

enum class  Kind { kInitializing , kOther }
 
- Public Types inherited from dart::TemplateInstruction< 2, NoThrow >
using BaseClass = typename NoCSE< Instruction, PureInstruction >::Base
 
- Public Types inherited from dart::Instruction
enum  Tag { FOR_EACH_INSTRUCTION =(DECLARE_TAG) kNumInstructions }
 
enum  SpeculativeMode { kGuardInputs , kNotSpeculative }
 
using InputsIterable = InstructionIndexedPropertyIterable< InputsTrait >
 
using SuccessorsIterable = InstructionIndexedPropertyIterable< SuccessorsTrait >
 

Public Member Functions

 StoreFieldInstr (const Slot &slot, Value *instance, Value *value, StoreBarrierType emit_store_barrier, InnerPointerAccess stores_inner_pointer, const InstructionSource &source, Kind kind=Kind::kOther, compiler::Assembler::MemoryOrder memory_order=compiler::Assembler::kRelaxedNonAtomic)
 
 StoreFieldInstr (const Slot &slot, Value *instance, Value *value, StoreBarrierType emit_store_barrier, const InstructionSource &source, Kind kind=Kind::kOther, compiler::Assembler::MemoryOrder memory_order=compiler::Assembler::kRelaxedNonAtomic)
 
 StoreFieldInstr (const Field &field, Value *instance, Value *value, StoreBarrierType emit_store_barrier, const InstructionSource &source, const ParsedFunction *parsed_function, Kind kind=Kind::kOther)
 
virtual SpeculativeMode SpeculativeModeOfInput (intptr_t index) const
 
 DECLARE_ATTRIBUTES_NAMED (("slot", "is_initialization"),(&slot(), is_initialization())) enum
 
Valueinstance () const
 
const Slotslot () const
 
Valuevalue () const
 
virtual TokenPosition token_pos () const
 
bool is_initialization () const
 
bool ShouldEmitStoreBarrier () const
 
void set_emit_store_barrier (StoreBarrierType value)
 
InnerPointerAccess stores_inner_pointer () const
 
void set_stores_inner_pointer (InnerPointerAccess value)
 
virtual bool CanTriggerGC () const
 
virtual bool ComputeCanDeoptimize () const
 
virtual intptr_t DeoptimizationTarget () const
 
virtual bool HasUnknownSideEffects () const
 
virtual bool MayHaveVisibleEffect () const
 
virtual Representation RequiredInputRepresentation (intptr_t index) const
 
virtual InstructionCanonicalize (FlowGraph *flow_graph)
 
DECLARE_INSTRUCTION_SERIALIZABLE_FIELDS(StoreFieldInstr, TemplateInstruction, FIELD_LIST) private intptr_t OffsetInBytes () const
 
compiler::Assembler::CanBeSmi CanValueBeSmi () const
 
 DISALLOW_COPY_AND_ASSIGN (StoreFieldInstr)
 
- Public Member Functions inherited from dart::TemplateInstruction< 2, 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
 
- Public Member Functions inherited from dart::Instruction
 Instruction (const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
 
 Instruction (intptr_t deopt_id=DeoptId::kNone)
 
virtual ~Instruction ()
 
virtual Tag tag () const =0
 
virtual intptr_t statistics_tag () const
 
intptr_t deopt_id () const
 
virtual TokenPosition token_pos () const
 
InstructionSource source () const
 
virtual intptr_t InputCount () const =0
 
virtual ValueInputAt (intptr_t i) const =0
 
void SetInputAt (intptr_t i, Value *value)
 
InputsIterable inputs ()
 
void UnuseAllInputs ()
 
virtual intptr_t ArgumentCount () const
 
ValueArgumentValueAt (intptr_t index) const
 
DefinitionArgumentAt (intptr_t index) const
 
virtual void SetMoveArguments (MoveArgumentsArray *move_arguments)
 
virtual MoveArgumentsArrayGetMoveArguments () const
 
virtual void ReplaceInputsWithMoveArguments (MoveArgumentsArray *move_arguments)
 
bool HasMoveArguments () const
 
void RepairArgumentUsesInEnvironment () const
 
virtual bool ComputeCanDeoptimize () const =0
 
virtual bool ComputeCanDeoptimizeAfterCall () const
 
bool CanDeoptimize () const
 
virtual void Accept (InstructionVisitor *visitor)=0
 
Instructionprevious () const
 
void set_previous (Instruction *instr)
 
Instructionnext () const
 
void set_next (Instruction *instr)
 
void LinkTo (Instruction *next)
 
InstructionRemoveFromGraph (bool return_previous=true)
 
virtual intptr_t SuccessorCount () const
 
virtual BlockEntryInstrSuccessorAt (intptr_t index) const
 
SuccessorsIterable successors () const
 
void Goto (JoinEntryInstr *entry)
 
virtual const char * DebugName () const =0
 
void CheckField (const Field &field) const
 
const char * ToCString () const
 
 DECLARE_INSTRUCTION_TYPE_CHECK (BlockEntryWithInitialDefs, BlockEntryWithInitialDefs) template< typename T > T *Cast()
 
template<typename T >
const TCast () const
 
LocationSummarylocs ()
 
bool HasLocs () const
 
virtual LocationSummaryMakeLocationSummary (Zone *zone, bool is_optimizing) const =0
 
void InitializeLocationSummary (Zone *zone, bool optimizing)
 
virtual void EmitNativeCode (FlowGraphCompiler *compiler)
 
Environmentenv () const
 
void SetEnvironment (Environment *deopt_env)
 
void RemoveEnvironment ()
 
void ReplaceInEnvironment (Definition *current, Definition *replacement)
 
virtual intptr_t NumberOfInputsConsumedBeforeCall () const
 
intptr_t GetPassSpecificId (CompilerPass::Id pass) const
 
void SetPassSpecificId (CompilerPass::Id pass, intptr_t id)
 
bool HasPassSpecificId (CompilerPass::Id pass) const
 
bool HasUnmatchedInputRepresentations () const
 
virtual Representation RequiredInputRepresentation (intptr_t idx) const
 
SpeculativeMode SpeculativeModeOfInputs () const
 
virtual SpeculativeMode SpeculativeModeOfInput (intptr_t index) const
 
virtual Representation representation () const
 
bool WasEliminated () const
 
virtual intptr_t DeoptimizationTarget () const
 
virtual InstructionCanonicalize (FlowGraph *flow_graph)
 
void InsertBefore (Instruction *next)
 
void InsertAfter (Instruction *prev)
 
InstructionAppendInstruction (Instruction *tail)
 
virtual bool AllowsCSE () const
 
virtual bool HasUnknownSideEffects () const =0
 
virtual bool CanCallDart () const
 
virtual bool CanTriggerGC () const
 
virtual BlockEntryInstrGetBlock ()
 
virtual intptr_t inlining_id () const
 
virtual void set_inlining_id (intptr_t value)
 
virtual bool has_inlining_id () const
 
virtual uword Hash () const
 
bool Equals (const Instruction &other) const
 
virtual bool AttributesEqual (const Instruction &other) const
 
void InheritDeoptTarget (Zone *zone, Instruction *other)
 
bool NeedsEnvironment () const
 
virtual bool CanBecomeDeoptimizationTarget () const
 
void InheritDeoptTargetAfter (FlowGraph *flow_graph, Definition *call, Definition *result)
 
virtual bool MayThrow () const =0
 
virtual bool MayHaveVisibleEffect () const
 
virtual bool CanEliminate (const BlockEntryInstr *block) const
 
bool CanEliminate ()
 
bool IsDominatedBy (Instruction *dom)
 
void ClearEnv ()
 
void Unsupported (FlowGraphCompiler *compiler)
 
virtual bool UseSharedSlowPathStub (bool is_optimizing) const
 
Location::Kind RegisterKindForResult () const
 
- Public Member Functions inherited from dart::ZoneAllocated
 ZoneAllocated ()
 
void * operator new (size_t size)
 
void * operator new (size_t size, Zone *zone)
 
void operator delete (void *pointer)
 

Additional Inherited Members

- Static Public Member Functions inherited from dart::Instruction
static const ICDataGetICData (const ZoneGrowableArray< const ICData * > &ic_data_array, intptr_t deopt_id, bool is_static_call)
 
static LocationSummaryMakeCallSummary (Zone *zone, const Instruction *instr, LocationSummary *locs=nullptr)
 
static bool SlowPathSharingSupported (bool is_optimizing)
 
- Static Public Attributes inherited from dart::Instruction
static const intptr_t kInstructionAttrs [kNumInstructions]
 
- Protected Member Functions inherited from dart::Instruction
intptr_t GetDeoptId () const
 
virtual void CopyDeoptIdFrom (const Instruction &instr)
 
void WriteExtraWithoutInputs (FlowGraphSerializer *s)
 
void ReadExtraWithoutInputs (FlowGraphDeserializer *d)
 
- Protected Attributes inherited from dart::TemplateInstruction< 2, NoThrow >
EmbeddedArray< Value *, Ninputs_
 

Detailed Description

Definition at line 6332 of file il.h.

Member Enumeration Documentation

◆ Kind

enum class dart::StoreFieldInstr::Kind
strong
Enumerator
kInitializing 
kOther 

Definition at line 6334 of file il.h.

6334 {
6335 // Store is known to be the first store into a slot of an object after
6336 // object was allocated and before it escapes (e.g. stores in constructor
6337 // initializer list).
6338 kInitializing,
6339
6340 // All other stores.
6341 kOther,
6342 };

Constructor & Destructor Documentation

◆ StoreFieldInstr() [1/3]

dart::StoreFieldInstr::StoreFieldInstr ( const Slot slot,
Value instance,
Value value,
StoreBarrierType  emit_store_barrier,
InnerPointerAccess  stores_inner_pointer,
const InstructionSource source,
Kind  kind = Kind::kOther,
compiler::Assembler::MemoryOrder  memory_order = compiler::Assembler::kRelaxedNonAtomic 
)
inline

Definition at line 6344 of file il.h.

6354 slot_(slot),
6355 emit_store_barrier_(emit_store_barrier),
6356 memory_order_(memory_order),
6357 token_pos_(source.token_pos),
6358 is_initialization_(kind == Kind::kInitializing),
6359 stores_inner_pointer_(stores_inner_pointer) {
6360 switch (stores_inner_pointer) {
6362 ASSERT(slot.representation() != kUntagged);
6363 break;
6365 ASSERT(slot.representation() == kUntagged);
6367 break;
6369 ASSERT(slot.representation() == kUntagged);
6370 break;
6371 }
6372 SetInputAt(kInstancePos, instance);
6373 SetInputAt(kValuePos, value);
6374 }
void SetInputAt(intptr_t i, Value *value)
Definition: il.h:1014
InstructionSource source() const
Definition: il.h:1008
Representation representation() const
Definition: slot.h:519
bool may_contain_inner_pointer() const
Definition: slot.h:533
InnerPointerAccess stores_inner_pointer() const
Definition: il.h:6450
Value * value() const
Definition: il.h:6424
Value * instance() const
Definition: il.h:6422
const Slot & slot() const
Definition: il.h:6423
TemplateInstruction(intptr_t deopt_id=DeoptId::kNone)
Definition: il.h:1507
#define ASSERT(E)
const TokenPosition token_pos

◆ StoreFieldInstr() [2/3]

dart::StoreFieldInstr::StoreFieldInstr ( const Slot slot,
Value instance,
Value value,
StoreBarrierType  emit_store_barrier,
const InstructionSource source,
Kind  kind = Kind::kOther,
compiler::Assembler::MemoryOrder  memory_order = compiler::Assembler::kRelaxedNonAtomic 
)
inline

Definition at line 6377 of file il.h.

6386 instance,
6387 value,
6388 emit_store_barrier,
6390 source,
6391 kind,
6392 memory_order) {}
StoreFieldInstr(const Slot &slot, Value *instance, Value *value, StoreBarrierType emit_store_barrier, InnerPointerAccess stores_inner_pointer, const InstructionSource &source, Kind kind=Kind::kOther, compiler::Assembler::MemoryOrder memory_order=compiler::Assembler::kRelaxedNonAtomic)
Definition: il.h:6344

◆ StoreFieldInstr() [3/3]

dart::StoreFieldInstr::StoreFieldInstr ( const Field field,
Value instance,
Value value,
StoreBarrierType  emit_store_barrier,
const InstructionSource source,
const ParsedFunction parsed_function,
Kind  kind = Kind::kOther 
)
inline

Definition at line 6395 of file il.h.

6402 : StoreFieldInstr(Slot::Get(field, parsed_function),
6403 instance,
6404 value,
6405 emit_store_barrier,
6406 source,
6407 kind) {}
static const Slot & Get(const Field &field, const ParsedFunction *parsed_function)
Definition: slot.cc:351

Member Function Documentation

◆ Canonicalize()

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

Reimplemented from dart::Instruction.

Definition at line 1027 of file il.cc.

1027 {
1028 // Dart objects are allocated null-initialized, which means we can eliminate
1029 // all initializing stores which store null value.
1030 // Context objects can be allocated uninitialized as a performance
1031 // optimization in JIT mode - however in AOT mode we always allocate them
1032 // null initialized.
1033 if (is_initialization_ && !slot().has_untagged_instance() &&
1034 slot().representation() == kTagged &&
1035 (!slot().IsContextSlot() ||
1036 !instance()->definition()->IsAllocateUninitializedContext()) &&
1037 value()->BindsToConstantNull()) {
1038 return nullptr;
1039 }
1040
1041 if (slot().kind() == Slot::Kind::kPointerBase_data &&
1043 const intptr_t cid = instance()->Type()->ToNullableCid();
1044 // Pointers and ExternalTypedData objects never contain inner pointers.
1045 if (cid == kPointerCid || IsExternalTypedDataClassId(cid)) {
1047 }
1048 }
1049 return this;
1050}
intptr_t ToNullableCid()
virtual Representation representation() const
Definition: il.h:1260
void set_stores_inner_pointer(InnerPointerAccess value)
Definition: il.h:6453
CompileType * Type()
const intptr_t cid
bool IsExternalTypedDataClassId(intptr_t index)
Definition: class_id.h:447

◆ CanTriggerGC()

virtual bool dart::StoreFieldInstr::CanTriggerGC ( ) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 6461 of file il.h.

6461{ return false; }

◆ CanValueBeSmi()

compiler::Assembler::CanBeSmi dart::StoreFieldInstr::CanValueBeSmi ( ) const
inline

Definition at line 6500 of file il.h.

6500 {
6501 // Write barrier is skipped for nullable and non-nullable smis.
6502 ASSERT(value()->Type()->ToNullableCid() != kSmiCid);
6505 }
Type
Definition: SortBench.cpp:56

◆ ComputeCanDeoptimize()

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

Implements dart::Instruction.

Definition at line 6463 of file il.h.

6463{ return false; }

◆ DECLARE_ATTRIBUTES_NAMED()

dart::StoreFieldInstr::DECLARE_ATTRIBUTES_NAMED ( ("slot", "is_initialization")  ,
(&  slot,
is_initialization()   
)
inline

Definition at line 6417 of file il.h.

6420 { kInstancePos = 0, kValuePos = 1 };

◆ DeoptimizationTarget()

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

Reimplemented from dart::Instruction.

Definition at line 6466 of file il.h.

6466{ return GetDeoptId(); }
intptr_t GetDeoptId() const
Definition: il.h:1409

◆ DISALLOW_COPY_AND_ASSIGN()

dart::StoreFieldInstr::DISALLOW_COPY_AND_ASSIGN ( StoreFieldInstr  )

◆ HasUnknownSideEffects()

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

Implements dart::Instruction.

Definition at line 6471 of file il.h.

6471{ return false; }

◆ instance()

Value * dart::StoreFieldInstr::instance ( ) const
inline

Definition at line 6422 of file il.h.

6422{ return inputs_[kInstancePos]; }
EmbeddedArray< Value *, N > inputs_
Definition: il.h:1522

◆ is_initialization()

bool dart::StoreFieldInstr::is_initialization ( ) const
inline

Definition at line 6427 of file il.h.

6427{ return is_initialization_; }

◆ MayHaveVisibleEffect()

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

Reimplemented from dart::Instruction.

Definition at line 6473 of file il.h.

6473{ return true; }

◆ OffsetInBytes()

DECLARE_INSTRUCTION_SERIALIZABLE_FIELDS(StoreFieldInstr, TemplateInstruction, FIELD_LIST) private intptr_t dart::StoreFieldInstr::OffsetInBytes ( ) const
inline

Definition at line 6498 of file il.h.

6498{ return slot().offset_in_bytes(); }
intptr_t offset_in_bytes() const
Definition: slot.h:513

◆ RequiredInputRepresentation()

Representation dart::StoreFieldInstr::RequiredInputRepresentation ( intptr_t  index) const
virtual

Reimplemented from dart::Instruction.

Definition at line 1018 of file il.cc.

1019 {
1020 if (index == 0) {
1021 return slot_.has_untagged_instance() ? kUntagged : kTagged;
1022 }
1023 ASSERT_EQUAL(index, 1);
1024 return slot().representation();
1025}
#define ASSERT_EQUAL(expected, actual)
Definition: assert.h:309

◆ set_emit_store_barrier()

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

Definition at line 6446 of file il.h.

6446 {
6447 emit_store_barrier_ = value;
6448 }

◆ set_stores_inner_pointer()

void dart::StoreFieldInstr::set_stores_inner_pointer ( InnerPointerAccess  value)
inline

Definition at line 6453 of file il.h.

6453 {
6454 // We should never change this for a non-untagged field.
6455 ASSERT(stores_inner_pointer_ != InnerPointerAccess::kNotUntagged);
6456 // We only convert from may to cannot, never the other direction.
6458 stores_inner_pointer_ = value;
6459 }

◆ ShouldEmitStoreBarrier()

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

Definition at line 6429 of file il.h.

6429 {
6430 if (slot().has_untagged_instance()) {
6431 // The instance is not a Dart object, so not traversed by the GC.
6432 return false;
6433 }
6434 if (slot().representation() != kTagged) {
6435 // The target field is native and unboxed, so not traversed by the GC.
6436 return false;
6437 }
6438
6439 if (value()->definition()->Type()->IsBool()) {
6440 return false;
6441 }
6442 return value()->NeedsWriteBarrier() &&
6443 (emit_store_barrier_ == kEmitStoreBarrier);
6444 }
bool NeedsWriteBarrier()
Definition: il.cc:1390
@ kEmitStoreBarrier
Definition: il.h:6301

◆ slot()

const Slot & dart::StoreFieldInstr::slot ( ) const
inline

Definition at line 6423 of file il.h.

6423{ return slot_; }

◆ SpeculativeModeOfInput()

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

Reimplemented from dart::Instruction.

Definition at line 6409 of file il.h.

6409 {
6410 // Slots are unboxed based on statically inferrable type information.
6411 // Either sound non-nullable static types (JIT) or global type flow analysis
6412 // results (AOT).
6413 return slot().representation() != kTagged ? kNotSpeculative : kGuardInputs;
6414 }
@ kGuardInputs
Definition: il.h:972
@ kNotSpeculative
Definition: il.h:975

◆ stores_inner_pointer()

InnerPointerAccess dart::StoreFieldInstr::stores_inner_pointer ( ) const
inline

Definition at line 6450 of file il.h.

6450 {
6451 return stores_inner_pointer_;
6452 }

◆ token_pos()

virtual TokenPosition dart::StoreFieldInstr::token_pos ( ) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 6426 of file il.h.

6426{ return token_pos_; }

◆ value()

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

Definition at line 6424 of file il.h.

6424{ return inputs_[kValuePos]; }

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