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

#include <il.h>

Inheritance diagram for dart::GuardFieldLengthInstr:
dart::GuardFieldInstr dart::TemplateInstruction< 1, NoThrow, Pure >

Public Member Functions

 GuardFieldLengthInstr (Value *value, const Field &field, intptr_t deopt_id)
 
virtual InstructionCanonicalize (FlowGraph *flow_graph)
 
virtual bool AttributesEqual (const Instruction &other) const
 
- Public Member Functions inherited from dart::GuardFieldInstr
 GuardFieldInstr (Value *value, const Field &field, intptr_t deopt_id)
 
Valuevalue () const
 
const Fieldfield () const
 
virtual bool ComputeCanDeoptimize () const
 
virtual bool CanBecomeDeoptimizationTarget () const
 
- Public Member Functions inherited from dart::TemplateInstruction< 1, NoThrow, Pure >
 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

- Public Types inherited from dart::TemplateInstruction< 1, NoThrow, Pure >
using BaseClass = typename Pure< Instruction, PureInstruction >::Base
 
- Protected Attributes inherited from dart::TemplateInstruction< 1, NoThrow, Pure >
EmbeddedArray< Value *, Ninputs_
 

Detailed Description

Definition at line 6516 of file il.h.

Constructor & Destructor Documentation

◆ GuardFieldLengthInstr()

dart::GuardFieldLengthInstr::GuardFieldLengthInstr ( Value value,
const Field field,
intptr_t  deopt_id 
)
inline

Definition at line 6518 of file il.h.

6519 : GuardFieldInstr(value, field, deopt_id) {
6520 CheckField(field);
6521 }
const Field & field() const
Definition il.h:6476
Value * value() const
Definition il.h:6474
GuardFieldInstr(Value *value, const Field &field, intptr_t deopt_id)
Definition il.h:6468

Member Function Documentation

◆ AttributesEqual()

bool dart::GuardFieldLengthInstr::AttributesEqual ( const Instruction other) const
virtual

Definition at line 1054 of file il.cc.

1054 {
1055 return field().ptr() == other.AsGuardFieldLength()->field().ptr();
1056}
ObjectPtr ptr() const
Definition object.h:332

◆ Canonicalize()

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

Definition at line 3947 of file il.cc.

3947 {
3948 if (!field().needs_length_check()) {
3949 return nullptr; // Nothing to guard.
3950 }
3951
3952 const intptr_t expected_length = field().guarded_list_length();
3953 if (expected_length == Field::kUnknownFixedLength) {
3954 return this;
3955 }
3956
3957 // Check if length is statically known.
3958 StaticCallInstr* call = value()->definition()->AsStaticCall();
3959 if (call == nullptr) {
3960 return this;
3961 }
3962
3963 ConstantInstr* length = nullptr;
3964 if (call->is_known_list_constructor() &&
3965 LoadFieldInstr::IsFixedLengthArrayCid(call->Type()->ToCid())) {
3966 length = call->ArgumentAt(1)->AsConstant();
3967 } else if (call->function().recognized_kind() ==
3968 MethodRecognizer::kByteDataFactory) {
3969 length = call->ArgumentAt(1)->AsConstant();
3970 } else if (LoadFieldInstr::IsTypedDataViewFactory(call->function())) {
3971 length = call->ArgumentAt(3)->AsConstant();
3972 }
3973 if ((length != nullptr) && length->value().IsSmi() &&
3974 Smi::Cast(length->value()).Value() == expected_length) {
3975 return nullptr; // Expected length matched.
3976 }
3977
3978 return this;
3979}
@ kUnknownFixedLength
Definition object.h:4701
intptr_t guarded_list_length() const
Definition object.cc:12152
static bool IsFixedLengthArrayCid(intptr_t cid)
Definition il.cc:2659
static bool IsTypedDataViewFactory(const Function &function)
Definition il.cc:2674
Definition * definition() const
Definition il.h:103
size_t length
call(args)
Definition dom.py:159

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