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

#include <il.h>

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

Public Member Functions

 TestRangeInstr (const InstructionSource &source, Value *value, uword lower, uword upper, Representation value_representation)
 
 DECLARE_COMPARISON_INSTRUCTION (TestRange)
 
uword lower () const
 
uword upper () const
 
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 5221 of file il.h.

Constructor & Destructor Documentation

◆ TestRangeInstr()

dart::TestRangeInstr::TestRangeInstr ( const InstructionSource source,
Value value,
uword  lower,
uword  upper,
Representation  value_representation 
)

Definition at line 3881 of file il.cc.

3887 lower_(lower),
3888 upper_(upper),
3889 value_representation_(value_representation) {
3890 ASSERT(lower < upper);
3891 ASSERT(value_representation == kTagged ||
3892 value_representation == kUnboxedUword);
3893 SetInputAt(0, value);
3894 set_operation_cid(kObjectCid);
3895}
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
uword upper() const
Definition il.h:5232
uword lower() const
Definition il.h:5231
Value * value() const
Definition il.h:5242
#define ASSERT(E)
SkBitmap source
Definition examples.cpp:28
static constexpr Representation kUnboxedUword
Definition locations.h:171

Member Function Documentation

◆ AttributesEqual()

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

Definition at line 6611 of file il.cc.

6611 {
6612 auto const other_instr = other.AsTestRange();
6614 return false;
6615 }
6616 return lower_ == other_instr->lower_ && upper_ == other_instr->upper_ &&
6617 value_representation_ == other_instr->value_representation_;
6618}
virtual bool AttributesEqual(const Instruction &other) const
Definition il.h:3867

◆ Canonicalize()

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

Definition at line 3897 of file il.cc.

3897 {
3898 if (value()->BindsToSmiConstant()) {
3899 uword val = Smi::Cast(value()->BoundConstant()).Value();
3900 bool in_range = lower_ <= val && val <= upper_;
3901 ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT));
3902 return flow_graph->GetConstant(
3903 Bool::Get(in_range == (kind() == Token::kIS)));
3904 }
3905
3906 const Range* range = value()->definition()->range();
3907 if (range != nullptr) {
3908 if (range->IsWithin(lower_, upper_)) {
3909 return flow_graph->GetConstant(Bool::Get(kind() == Token::kIS));
3910 }
3911 if (!range->Overlaps(lower_, upper_)) {
3912 return flow_graph->GetConstant(Bool::Get(kind() != Token::kIS));
3913 }
3914 }
3915
3916 if (LoadClassIdInstr* load_cid = value()->definition()->AsLoadClassId()) {
3917 uword lower, upper;
3918 load_cid->InferRange(&lower, &upper);
3919 if (lower >= lower_ && upper <= upper_) {
3920 return flow_graph->GetConstant(Bool::Get(kind() == Token::kIS));
3921 } else if (lower > upper_ || upper < lower_) {
3922 return flow_graph->GetConstant(Bool::Get(kind() != Token::kIS));
3923 }
3924 }
3925
3926 return this;
3927}
static const Bool & Get(bool value)
Definition object.h:10780
Range * range() const
Definition il.h:2618
Definition * definition() const
Definition il.h:103
uintptr_t uword
Definition globals.h:501

◆ ComputeCanDeoptimize()

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

Definition at line 5240 of file il.h.

5240{ return false; }

◆ ComputeType()

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

Definition at line 1421 of file type_propagator.cc.

1421 {
1422 return CompileType::Bool();
1423}
static CompileType Bool()

◆ CopyWithNewOperands()

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

Definition at line 6589 of file il.cc.

6590 {
6591 return new TestRangeInstr(source(), new_left, lower_, upper_,
6592 value_representation_);
6593}
TestRangeInstr(const InstructionSource &source, Value *value, uword lower, uword upper, Representation value_representation)
Definition il.cc:3881

◆ DECLARE_COMPARISON_INSTRUCTION()

dart::TestRangeInstr::DECLARE_COMPARISON_INSTRUCTION ( TestRange  )

◆ lower()

uword dart::TestRangeInstr::lower ( ) const
inline

Definition at line 5231 of file il.h.

5231{ return lower_; }

◆ RequiredInputRepresentation()

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

Definition at line 5243 of file il.h.

5243 {
5244 return value_representation_;
5245 }

◆ upper()

uword dart::TestRangeInstr::upper ( ) const
inline

Definition at line 5232 of file il.h.

5232{ return upper_; }

◆ value()

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

Definition at line 5242 of file il.h.

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

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