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

#include <il.h>

Inheritance diagram for dart::Value:
dart::ZoneAllocated

Classes

class  Iterator
 

Public Member Functions

 Value (Definition *definition)
 
Definitiondefinition () const
 
void set_definition (Definition *definition)
 
Valueprevious_use () const
 
void set_previous_use (Value *previous)
 
Valuenext_use () const
 
void set_next_use (Value *next)
 
bool IsSingleUse () const
 
Instructioninstruction () const
 
void set_instruction (Instruction *instruction)
 
intptr_t use_index () const
 
void set_use_index (intptr_t index)
 
void RemoveFromUseList ()
 
void BindTo (Definition *definition)
 
void BindToEnvironment (Definition *definition)
 
ValueCopy (Zone *zone)
 
ValueCopyWithType (Zone *zone)
 
ValueCopyWithType ()
 
CompileTypeType ()
 
CompileTypereaching_type () const
 
void SetReachingType (CompileType *type)
 
void RefineReachingType (CompileType *type)
 
const char * ToCString () const
 
bool IsSmiValue ()
 
bool BindsToConstant () const
 
bool BindsToConstant (ConstantInstr **constant_defn) const
 
bool BindsToConstantNull () const
 
const ObjectBoundConstant () const
 
bool BindsToSmiConstant () const
 
intptr_t BoundSmiConstant () const
 
bool NeedsWriteBarrier ()
 
bool Equals (const Value &other) const
 
bool CanBe (const Object &value)
 
- 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)
 

Static Public Member Functions

static void AddToList (Value *value, Value **list)
 

Friends

class FlowGraphPrinter
 

Detailed Description

Definition at line 75 of file il.h.

Constructor & Destructor Documentation

◆ Value()

dart::Value::Value ( Definition definition)
inlineexplicit

Definition at line 95 of file il.h.

96 : definition_(definition),
97 previous_use_(nullptr),
98 next_use_(nullptr),
99 instruction_(nullptr),
100 use_index_(-1),
101 reaching_type_(nullptr) {}
Definition * definition() const
Definition il.h:103

Member Function Documentation

◆ AddToList()

void Value::AddToList ( Value value,
Value **  list 
)
static

Definition at line 1437 of file il.cc.

1437 {
1438 ASSERT(value->next_use() == nullptr);
1439 ASSERT(value->previous_use() == nullptr);
1440 Value* next = *list;
1441 ASSERT(value != next);
1442 *list = value;
1443 value->set_next_use(next);
1444 value->set_previous_use(nullptr);
1445 if (next != nullptr) next->set_previous_use(value);
1446}
static float next(float f)
#define ASSERT(E)
uint8_t value

◆ BindsToConstant() [1/2]

bool Value::BindsToConstant ( ) const

Definition at line 1181 of file il.cc.

1181 {
1182 return definition()->OriginalDefinition()->IsConstant();
1183}
Definition * OriginalDefinition()
Definition il.cc:530

◆ BindsToConstant() [2/2]

bool Value::BindsToConstant ( ConstantInstr **  constant_defn) const

Definition at line 1185 of file il.cc.

1185 {
1186 if (auto constant = definition()->OriginalDefinition()->AsConstant()) {
1187 *constant_defn = constant;
1188 return true;
1189 }
1190 return false;
1191}

◆ BindsToConstantNull()

bool Value::BindsToConstantNull ( ) const

Definition at line 1194 of file il.cc.

1194 {
1195 ConstantInstr* constant = definition()->OriginalDefinition()->AsConstant();
1196 return (constant != nullptr) && constant->value().IsNull();
1197}

◆ BindsToSmiConstant()

bool Value::BindsToSmiConstant ( ) const

Definition at line 1206 of file il.cc.

1206 {
1207 return BindsToConstant() && BoundConstant().IsSmi();
1208}
bool BindsToConstant() const
Definition il.cc:1181
const Object & BoundConstant() const
Definition il.cc:1199

◆ BindTo()

void Value::BindTo ( Definition definition)
inline

Definition at line 2700 of file il.h.

2700 {
2702 set_definition(def);
2703 def->AddInputUse(this);
2704}
void set_definition(Definition *definition)
Definition il.h:104
void RemoveFromUseList()
Definition il.cc:1448

◆ BindToEnvironment()

void Value::BindToEnvironment ( Definition definition)
inline

Definition at line 2706 of file il.h.

2706 {
2708 set_definition(def);
2709 def->AddEnvUse(this);
2710}

◆ BoundConstant()

const Object & Value::BoundConstant ( ) const

Definition at line 1199 of file il.cc.

1199 {
1201 ConstantInstr* constant = definition()->OriginalDefinition()->AsConstant();
1202 ASSERT(constant != nullptr);
1203 return constant->value();
1204}

◆ BoundSmiConstant()

intptr_t Value::BoundSmiConstant ( ) const

Definition at line 1210 of file il.cc.

1210 {
1212 return Smi::Cast(BoundConstant()).Value();
1213}
bool BindsToSmiConstant() const
Definition il.cc:1206

◆ CanBe()

bool Value::CanBe ( const Object value)
inline

Definition at line 11833 of file il.h.

11833 {
11834 ConstantInstr* constant = definition()->AsConstant();
11835 return (constant == nullptr) || constant->value().ptr() == value.ptr();
11836}

◆ Copy()

Value * dart::Value::Copy ( Zone zone)
inline

Definition at line 134 of file il.h.

134{ return new (zone) Value(definition_); }

◆ CopyWithType() [1/2]

Value * dart::Value::CopyWithType ( )
inline

Definition at line 143 of file il.h.

143{ return CopyWithType(Thread::Current()->zone()); }
static Thread * Current()
Definition thread.h:361
Value * CopyWithType()
Definition il.h:143

◆ CopyWithType() [2/2]

Value * dart::Value::CopyWithType ( Zone zone)
inline

Definition at line 138 of file il.h.

138 {
139 Value* copy = new (zone) Value(definition_);
140 copy->reaching_type_ = reaching_type_;
141 return copy;
142 }
Definition copy.py:1

◆ definition()

Definition * dart::Value::definition ( ) const
inline

Definition at line 103 of file il.h.

103{ return definition_; }

◆ Equals()

bool Value::Equals ( const Value other) const

Definition at line 631 of file il.cc.

631 {
632 return definition() == other.definition();
633}

◆ instruction()

Instruction * dart::Value::instruction ( ) const
inline

Definition at line 121 of file il.h.

121{ return instruction_; }

◆ IsSingleUse()

bool dart::Value::IsSingleUse ( ) const
inline

Definition at line 117 of file il.h.

117 {
118 return (next_use_ == nullptr) && (previous_use_ == nullptr);
119 }

◆ IsSmiValue()

bool dart::Value::IsSmiValue ( )
inline

Definition at line 157 of file il.h.

157{ return Type()->ToCid() == kSmiCid; }
CompileType * Type()

◆ NeedsWriteBarrier()

bool Value::NeedsWriteBarrier ( )

Definition at line 1388 of file il.cc.

1388 {
1389 Value* value = this;
1390 do {
1391 if (value->Type()->IsNull() ||
1392 (value->Type()->ToNullableCid() == kSmiCid) ||
1393 (value->Type()->ToNullableCid() == kBoolCid)) {
1394 return false;
1395 }
1396
1397 // Strictly speaking, the incremental barrier can only be skipped for
1398 // immediate objects (Smis) or permanent objects (vm-isolate heap or
1399 // image pages). Here we choose to skip the barrier for any constant on
1400 // the assumption it will remain reachable through the object pool.
1401 if (value->BindsToConstant()) {
1402 return false;
1403 }
1404
1405 // Follow the chain of redefinitions as redefined value could have a more
1406 // accurate type (for example, AssertAssignable of Smi to a generic T).
1407 value = value->definition()->RedefinedValue();
1408 } while (value != nullptr);
1409
1410 return true;
1411}

◆ next_use()

Value * dart::Value::next_use ( ) const
inline

Definition at line 114 of file il.h.

114{ return next_use_; }

◆ previous_use()

Value * dart::Value::previous_use ( ) const
inline

Definition at line 111 of file il.h.

111{ return previous_use_; }

◆ reaching_type()

CompileType * dart::Value::reaching_type ( ) const
inline

Definition at line 147 of file il.h.

147{ return reaching_type_; }

◆ RefineReachingType()

void Value::RefineReachingType ( CompileType type)

Definition at line 1089 of file type_propagator.cc.

1089 {
1091}
static CompileType * ComputeRefinedType(CompileType *old_type, CompileType *new_type)
void SetReachingType(CompileType *type)

◆ RemoveFromUseList()

void Value::RemoveFromUseList ( )

Definition at line 1448 of file il.cc.

1448 {
1449 Definition* def = definition();
1450 Value* next = next_use();
1451 if (this == def->input_use_list()) {
1452 def->set_input_use_list(next);
1453 if (next != nullptr) next->set_previous_use(nullptr);
1454 } else if (this == def->env_use_list()) {
1455 def->set_env_use_list(next);
1456 if (next != nullptr) next->set_previous_use(nullptr);
1457 } else if (Value* prev = previous_use()) {
1458 prev->set_next_use(next);
1459 if (next != nullptr) next->set_previous_use(prev);
1460 }
1461
1462 set_previous_use(nullptr);
1463 set_next_use(nullptr);
1464}
static float prev(float f)
void set_previous_use(Value *previous)
Definition il.h:112
void set_next_use(Value *next)
Definition il.h:115
Value * previous_use() const
Definition il.h:111
Value * next_use() const
Definition il.h:114

◆ set_definition()

void dart::Value::set_definition ( Definition definition)
inline

Definition at line 104 of file il.h.

104 {
105 definition_ = definition;
106 // Clone the reaching type if there was one and the owner no longer matches
107 // this value's definition.
108 SetReachingType(reaching_type_);
109 }

◆ set_instruction()

void dart::Value::set_instruction ( Instruction instruction)
inline

Definition at line 122 of file il.h.

122{ instruction_ = instruction; }
Instruction * instruction() const
Definition il.h:121

◆ set_next_use()

void dart::Value::set_next_use ( Value next)
inline

Definition at line 115 of file il.h.

115{ next_use_ = next; }

◆ set_previous_use()

void dart::Value::set_previous_use ( Value previous)
inline

Definition at line 112 of file il.h.

112{ previous_use_ = previous; }

◆ set_use_index()

void dart::Value::set_use_index ( intptr_t  index)
inline

Definition at line 125 of file il.h.

125{ use_index_ = index; }

◆ SetReachingType()

void Value::SetReachingType ( CompileType type)

Definition at line 1075 of file type_propagator.cc.

1075 {
1076 // If [type] is owned but not by the definition which flows into this use
1077 // then we need to disconnect the type from original owner by cloning it.
1078 // This is done to prevent situations when [type] is updated by its owner
1079 // but [owner] is no longer connected to this use through def-use chain
1080 // and as a result type propagator does not recompute type of the current
1081 // instruction.
1082 if (type != nullptr && type->owner() != nullptr &&
1083 type->owner() != definition()) {
1084 type = new CompileType(*type);
1085 }
1086 reaching_type_ = type;
1087}

◆ ToCString()

const char * dart::Value::ToCString ( ) const

◆ Type()

CompileType * Value::Type ( )

Definition at line 1068 of file type_propagator.cc.

1068 {
1069 if (reaching_type_ == nullptr) {
1070 reaching_type_ = definition()->Type();
1071 }
1072 return reaching_type_;
1073}
CompileType * Type()
Definition il.h:2503

◆ use_index()

intptr_t dart::Value::use_index ( ) const
inline

Definition at line 124 of file il.h.

124{ return use_index_; }

Friends And Related Symbol Documentation

◆ FlowGraphPrinter

friend class FlowGraphPrinter
friend

Definition at line 187 of file il.h.


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