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

#include <il.h>

Inheritance diagram for dart::TestCidsInstr:
dart::TemplateComparison< 1, NoThrow, Pure >

Public Member Functions

 TestCidsInstr (const InstructionSource &source, Token::Kind kind, Value *value, const ZoneGrowableArray< intptr_t > &cid_results, intptr_t deopt_id)
 
const ZoneGrowableArray< intptr_t > & cid_results () const
 
 DECLARE_COMPARISON_INSTRUCTION (TestCids)
 
virtual ComparisonInstrCopyWithNewOperands (Value *left, Value *right)
 
virtual CompileType ComputeType () const
 
virtual DefinitionCanonicalize (FlowGraph *flow_graph)
 
virtual bool ComputeCanDeoptimize () const
 
Valuevalue () const
 
virtual Representation RequiredInputRepresentation (intptr_t idx) const
 
virtual bool AttributesEqual (const Instruction &other) const
 
- Public Member Functions inherited from dart::TemplateComparison< 1, NoThrow, Pure >
 TemplateComparison (const InstructionSource &source, Token::Kind kind, 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::TemplateComparison< 1, NoThrow, Pure >
using BaseClass = typename Pure< ComparisonInstr, PureComparison >::Base
 
- Protected Attributes inherited from dart::TemplateComparison< 1, NoThrow, Pure >
EmbeddedArray< Value *, Ninputs_
 

Detailed Description

Definition at line 5177 of file il.h.

Constructor & Destructor Documentation

◆ TestCidsInstr()

dart::TestCidsInstr::TestCidsInstr ( const InstructionSource source,
Token::Kind  kind,
Value value,
const ZoneGrowableArray< intptr_t > &  cid_results,
intptr_t  deopt_id 
)

Definition at line 3833 of file il.cc.

3838 : TemplateComparison(source, kind, deopt_id), cid_results_(cid_results) {
3839 ASSERT((kind == Token::kIS) || (kind == Token::kISNOT));
3840 SetInputAt(0, value);
3841 set_operation_cid(kObjectCid);
3842#ifdef DEBUG
3843 ASSERT(cid_results[0] == kSmiCid);
3844 if (deopt_id == DeoptId::kNone) {
3845 // The entry for Smi can be special, but all other entries have
3846 // to match in the no-deopt case.
3847 for (intptr_t i = 4; i < cid_results.length(); i += 2) {
3848 ASSERT(cid_results[i + 1] == cid_results[3]);
3849 }
3850 }
3851#endif
3852}
intptr_t length() const
static constexpr intptr_t kNone
Definition deopt_id.h:27
TemplateComparison(const InstructionSource &source, Token::Kind kind, intptr_t deopt_id=DeoptId::kNone)
Definition il.h:3935
Value * value() const
Definition il.h:5201
const ZoneGrowableArray< intptr_t > & cid_results() const
Definition il.h:5185
#define ASSERT(E)
SkBitmap source
Definition examples.cpp:28

Member Function Documentation

◆ AttributesEqual()

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

Definition at line 6595 of file il.cc.

6595 {
6596 auto const other_instr = other.AsTestCids();
6598 return false;
6599 }
6600 if (cid_results().length() != other_instr->cid_results().length()) {
6601 return false;
6602 }
6603 for (intptr_t i = 0; i < cid_results().length(); i++) {
6604 if (cid_results()[i] != other_instr->cid_results()[i]) {
6605 return false;
6606 }
6607 }
6608 return true;
6609}
virtual bool AttributesEqual(const Instruction &other) const
Definition il.h:3867
size_t length

◆ Canonicalize()

Definition * dart::TestCidsInstr::Canonicalize ( FlowGraph flow_graph)
virtual

Definition at line 3854 of file il.cc.

3854 {
3855 CompileType* in_type = value()->Type();
3856 intptr_t cid = in_type->ToCid();
3857 if (cid == kDynamicCid) return this;
3858
3859 const ZoneGrowableArray<intptr_t>& data = cid_results();
3860 const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0;
3861 for (intptr_t i = 0; i < data.length(); i += 2) {
3862 if (data[i] == cid) {
3863 return (data[i + 1] == true_result)
3864 ? flow_graph->GetConstant(Bool::True())
3865 : flow_graph->GetConstant(Bool::False());
3866 }
3867 }
3868
3869 if (!CanDeoptimize()) {
3870 ASSERT(deopt_id() == DeoptId::kNone);
3871 return (data[data.length() - 1] == true_result)
3872 ? flow_graph->GetConstant(Bool::False())
3873 : flow_graph->GetConstant(Bool::True());
3874 }
3875
3876 // TODO(sra): Handle nullable input, possibly canonicalizing to a compare
3877 // against `null`.
3878 return this;
3879}
static const Bool & False()
Definition object.h:10778
static const Bool & True()
Definition object.h:10776
CompileType * Type()
@ kDynamicCid
Definition class_id.h:253
const intptr_t cid
static int8_t data[kExtLength]

◆ cid_results()

const ZoneGrowableArray< intptr_t > & dart::TestCidsInstr::cid_results ( ) const
inline

Definition at line 5185 of file il.h.

5185 {
5186 return cid_results_;
5187 }

◆ ComputeCanDeoptimize()

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

Definition at line 5197 of file il.h.

5197 {
5198 return GetDeoptId() != DeoptId::kNone;
5199 }

◆ ComputeType()

CompileType dart::TestCidsInstr::ComputeType ( ) const
virtual

Definition at line 1417 of file type_propagator.cc.

1417 {
1418 return CompileType::Bool();
1419}
static CompileType Bool()

◆ CopyWithNewOperands()

ComparisonInstr * dart::TestCidsInstr::CopyWithNewOperands ( Value left,
Value right 
)
virtual

Definition at line 6583 of file il.cc.

6584 {
6585 return new TestCidsInstr(source(), kind(), new_left, cid_results(),
6586 deopt_id());
6587}
TestCidsInstr(const InstructionSource &source, Token::Kind kind, Value *value, const ZoneGrowableArray< intptr_t > &cid_results, intptr_t deopt_id)
Definition il.cc:3833

◆ DECLARE_COMPARISON_INSTRUCTION()

dart::TestCidsInstr::DECLARE_COMPARISON_INSTRUCTION ( TestCids  )

◆ RequiredInputRepresentation()

virtual Representation dart::TestCidsInstr::RequiredInputRepresentation ( intptr_t  idx) const
inlinevirtual

Definition at line 5202 of file il.h.

5202 {
5203 return kTagged;
5204 }

◆ value()

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

Definition at line 5201 of file il.h.

5201{ return inputs_[0]; }
EmbeddedArray< Value *, N > inputs_
Definition il.h:3948

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