Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 >

Public Types

enum class  Kind { kInitializing , kOther }
 
- Public Types inherited from dart::TemplateInstruction< 2, NoThrow >
using BaseClass = typename NoCSE< Instruction, PureInstruction >::Base
 

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
 

Additional Inherited Members

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

Detailed Description

Definition at line 6283 of file il.h.

Member Enumeration Documentation

◆ Kind

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

Definition at line 6285 of file il.h.

6285 {
6286 // Store is known to be the first store into a slot of an object after
6287 // object was allocated and before it escapes (e.g. stores in constructor
6288 // initializer list).
6290
6291 // All other stores.
6292 kOther,
6293 };

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 6295 of file il.h.

6305 slot_(slot),
6306 emit_store_barrier_(emit_store_barrier),
6307 memory_order_(memory_order),
6308 token_pos_(source.token_pos),
6309 is_initialization_(kind == Kind::kInitializing),
6310 stores_inner_pointer_(stores_inner_pointer) {
6311 switch (stores_inner_pointer) {
6313 ASSERT(slot.representation() != kUntagged);
6314 break;
6316 ASSERT(slot.representation() == kUntagged);
6318 break;
6320 ASSERT(slot.representation() == kUntagged);
6321 break;
6322 }
6323 SetInputAt(kInstancePos, instance);
6324 SetInputAt(kValuePos, value);
6325 }
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:6406
Value * value() const
Definition il.h:6375
Value * instance() const
Definition il.h:6373
const Slot & slot() const
Definition il.h:6374
TemplateInstruction(intptr_t deopt_id=DeoptId::kNone)
Definition il.h:1501
#define ASSERT(E)
SkBitmap source
Definition examples.cpp:28

◆ 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 6328 of file il.h.

6337 instance,
6338 value,
6339 emit_store_barrier,
6341 source,
6342 kind,
6343 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:6295

◆ 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 6346 of file il.h.

6353 : StoreFieldInstr(Slot::Get(field, parsed_function),
6354 instance,
6355 value,
6356 emit_store_barrier,
6357 source,
6358 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

Definition at line 1025 of file il.cc.

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

◆ CanTriggerGC()

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

Definition at line 6417 of file il.h.

6417{ return false; }

◆ CanValueBeSmi()

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

Definition at line 6456 of file il.h.

6456 {
6457 // Write barrier is skipped for nullable and non-nullable smis.
6458 ASSERT(value()->Type()->ToNullableCid() != kSmiCid);
6461 }

◆ ComputeCanDeoptimize()

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

Definition at line 6419 of file il.h.

6419{ return false; }

◆ DECLARE_ATTRIBUTES_NAMED()

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

Definition at line 6368 of file il.h.

6371 { kInstancePos = 0, kValuePos = 1 };

◆ DeoptimizationTarget()

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

Definition at line 6422 of file il.h.

6422{ return GetDeoptId(); }

◆ DISALLOW_COPY_AND_ASSIGN()

dart::StoreFieldInstr::DISALLOW_COPY_AND_ASSIGN ( StoreFieldInstr  )

◆ HasUnknownSideEffects()

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

Definition at line 6427 of file il.h.

6427{ return false; }

◆ instance()

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

Definition at line 6373 of file il.h.

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

◆ is_initialization()

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

Definition at line 6378 of file il.h.

6378{ return is_initialization_; }

◆ MayHaveVisibleEffect()

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

Definition at line 6429 of file il.h.

6429{ return true; }

◆ OffsetInBytes()

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

Definition at line 6454 of file il.h.

6454{ 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

Definition at line 1016 of file il.cc.

1017 {
1018 if (index == 0) {
1019 return slot_.has_untagged_instance() ? kUntagged : kTagged;
1020 }
1021 ASSERT_EQUAL(index, 1);
1022 return slot().representation();
1023}
#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 6402 of file il.h.

6402 {
6403 emit_store_barrier_ = value;
6404 }

◆ set_stores_inner_pointer()

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

Definition at line 6409 of file il.h.

6409 {
6410 // We should never change this for a non-untagged field.
6411 ASSERT(stores_inner_pointer_ != InnerPointerAccess::kNotUntagged);
6412 // We only convert from may to cannot, never the other direction.
6414 stores_inner_pointer_ = value;
6415 }

◆ ShouldEmitStoreBarrier()

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

Definition at line 6380 of file il.h.

6380 {
6381 if (slot().has_untagged_instance()) {
6382 // The instance is not a Dart object, so not traversed by the GC.
6383 return false;
6384 }
6385 if (slot().representation() != kTagged) {
6386 // The target field is native and unboxed, so not traversed by the GC.
6387 return false;
6388 }
6389 if (instance()->definition() == value()->definition()) {
6390 // `x.slot = x` cannot create an old->new or old&marked->old&unmarked
6391 // reference.
6392 return false;
6393 }
6394
6395 if (value()->definition()->Type()->IsBool()) {
6396 return false;
6397 }
6398 return value()->NeedsWriteBarrier() &&
6399 (emit_store_barrier_ == kEmitStoreBarrier);
6400 }
bool NeedsWriteBarrier()
Definition il.cc:1388
@ kEmitStoreBarrier
Definition il.h:6252

◆ slot()

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

Definition at line 6374 of file il.h.

6374{ return slot_; }

◆ SpeculativeModeOfInput()

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

Definition at line 6360 of file il.h.

6360 {
6361 // Slots are unboxed based on statically inferrable type information.
6362 // Either sound non-nullable static types (JIT) or global type flow analysis
6363 // results (AOT).
6364 return slot().representation() != kTagged ? kNotSpeculative : kGuardInputs;
6365 }

◆ stores_inner_pointer()

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

Definition at line 6406 of file il.h.

6406 {
6407 return stores_inner_pointer_;
6408 }

◆ token_pos()

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

Definition at line 6377 of file il.h.

6377{ return token_pos_; }

◆ value()

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

Definition at line 6375 of file il.h.

6375{ return inputs_[kValuePos]; }

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