Flutter Engine
The Flutter Engine
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 1446 of file il.cc.

1446 {
1447 ASSERT(value->next_use() == nullptr);
1448 ASSERT(value->previous_use() == nullptr);
1449 Value* next = *list;
1450 ASSERT(value != next);
1451 *list = value;
1452 value->set_next_use(next);
1453 value->set_previous_use(nullptr);
1454 if (next != nullptr) next->set_previous_use(value);
1455}
static float next(float f)
#define ASSERT(E)
uint8_t value

◆ BindsToConstant() [1/2]

bool Value::BindsToConstant ( ) const

Definition at line 1183 of file il.cc.

1183 {
1184 return definition()->OriginalDefinition()->IsConstant();
1185}
Definition * OriginalDefinition()
Definition: il.cc:532

◆ BindsToConstant() [2/2]

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

Definition at line 1187 of file il.cc.

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

◆ BindsToConstantNull()

bool Value::BindsToConstantNull ( ) const

Definition at line 1196 of file il.cc.

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

◆ BindsToSmiConstant()

bool Value::BindsToSmiConstant ( ) const

Definition at line 1208 of file il.cc.

1208 {
1209 return BindsToConstant() && BoundConstant().IsSmi();
1210}
bool BindsToConstant() const
Definition: il.cc:1183
const Object & BoundConstant() const
Definition: il.cc:1201

◆ BindTo()

void Value::BindTo ( Definition definition)
inline

Definition at line 2718 of file il.h.

2718 {
2720 set_definition(def);
2721 def->AddInputUse(this);
2722}
void set_definition(Definition *definition)
Definition: il.h:104
void RemoveFromUseList()
Definition: il.cc:1457

◆ BindToEnvironment()

void Value::BindToEnvironment ( Definition definition)
inline

Definition at line 2724 of file il.h.

2724 {
2726 set_definition(def);
2727 def->AddEnvUse(this);
2728}

◆ BoundConstant()

const Object & Value::BoundConstant ( ) const

Definition at line 1201 of file il.cc.

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

◆ BoundSmiConstant()

intptr_t Value::BoundSmiConstant ( ) const

Definition at line 1212 of file il.cc.

1212 {
1214 return Smi::Cast(BoundConstant()).Value();
1215}
bool BindsToSmiConstant() const
Definition: il.cc:1208

◆ CanBe()

bool Value::CanBe ( const Object value)
inline

Definition at line 11887 of file il.h.

11887 {
11888 ConstantInstr* constant = definition()->AsConstant();
11889 return (constant == nullptr) || constant->value().ptr() == value.ptr();
11890}

◆ Copy()

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

Definition at line 134 of file il.h.

134{ return new (zone) Value(definition_); }
Value(Definition *definition)
Definition: il.h:95

◆ 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:362
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 }
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:31
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 633 of file il.cc.

633 {
634 return definition() == other.definition();
635}

◆ 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 1390 of file il.cc.

1390 {
1391 Value* value = this;
1392 do {
1393 if (value->Type()->IsNull() ||
1394 (value->Type()->ToNullableCid() == kSmiCid) ||
1395 (value->Type()->ToNullableCid() == kBoolCid)) {
1396 return false;
1397 }
1398
1399 // Strictly speaking, the incremental barrier can only be skipped for
1400 // immediate objects (Smis) or permanent objects (vm-isolate heap or
1401 // image pages). For AOT, we choose to skip the barrier for any constant on
1402 // the assumptions it will remain reachable through the object pool and it
1403 // is on a page created by snapshot loading that is marked so as to never be
1404 // evacuated.
1405 if (value->BindsToConstant()) {
1406 if (FLAG_precompiled_mode) {
1407 return false;
1408 } else {
1409 const Object& constant = value->BoundConstant();
1410 return constant.ptr()->IsHeapObject() && !constant.InVMIsolateHeap();
1411 }
1412 }
1413
1414 // Follow the chain of redefinitions as redefined value could have a more
1415 // accurate type (for example, AssertAssignable of Smi to a generic T).
1416 value = value->definition()->RedefinedValue();
1417 } while (value != nullptr);
1418
1419 return true;
1420}

◆ 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 1088 of file type_propagator.cc.

1088 {
1090}
GLenum type
static CompileType * ComputeRefinedType(CompileType *old_type, CompileType *new_type)
void SetReachingType(CompileType *type)

◆ RemoveFromUseList()

void Value::RemoveFromUseList ( )

Definition at line 1457 of file il.cc.

1457 {
1458 Definition* def = definition();
1459 Value* next = next_use();
1460 if (this == def->input_use_list()) {
1461 def->set_input_use_list(next);
1462 if (next != nullptr) next->set_previous_use(nullptr);
1463 } else if (this == def->env_use_list()) {
1464 def->set_env_use_list(next);
1465 if (next != nullptr) next->set_previous_use(nullptr);
1466 } else if (Value* prev = previous_use()) {
1467 prev->set_next_use(next);
1468 if (next != nullptr) next->set_previous_use(prev);
1469 }
1470
1471 set_previous_use(nullptr);
1472 set_next_use(nullptr);
1473}
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 1074 of file type_propagator.cc.

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

◆ ToCString()

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

◆ Type()

CompileType * Value::Type ( )

Definition at line 1067 of file type_propagator.cc.

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

◆ 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 Function 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: