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

#include <il.h>

Inheritance diagram for dart::EqualityCompareInstr:
dart::TemplateComparison< 2, NoThrow, Pure >

Public Member Functions

 EqualityCompareInstr (const InstructionSource &source, Token::Kind kind, Value *left, Value *right, intptr_t cid, intptr_t deopt_id, bool null_aware=false, SpeculativeMode speculative_mode=kGuardInputs)
 
virtual ComparisonInstrCopyWithNewOperands (Value *left, Value *right)
 
virtual CompileType ComputeType () const
 
virtual bool ComputeCanDeoptimize () const
 
bool is_null_aware () const
 
void set_null_aware (bool value)
 
virtual Representation RequiredInputRepresentation (intptr_t idx) const
 
virtual SpeculativeMode SpeculativeModeOfInput (intptr_t index) const
 
virtual bool AttributesEqual (const Instruction &other) const
 
virtual DefinitionCanonicalize (FlowGraph *flow_graph)
 
- Public Member Functions inherited from dart::TemplateComparison< 2, 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< 2, NoThrow, Pure >
using BaseClass = typename Pure< ComparisonInstr, PureComparison >::Base
 
- Protected Attributes inherited from dart::TemplateComparison< 2, NoThrow, Pure >
EmbeddedArray< Value *, Ninputs_
 

Detailed Description

Definition at line 5265 of file il.h.

Constructor & Destructor Documentation

◆ EqualityCompareInstr()

dart::EqualityCompareInstr::EqualityCompareInstr ( const InstructionSource source,
Token::Kind  kind,
Value left,
Value right,
intptr_t  cid,
intptr_t  deopt_id,
bool  null_aware = false,
SpeculativeMode  speculative_mode = kGuardInputs 
)
inline

Definition at line 5267 of file il.h.

5275 : TemplateComparison(source, kind, deopt_id),
5276 null_aware_(null_aware),
5277 speculative_mode_(speculative_mode) {
5279 SetInputAt(0, left);
5280 SetInputAt(1, right);
5281 set_operation_cid(cid);
5282 }
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
TemplateComparison(const InstructionSource &source, Token::Kind kind, intptr_t deopt_id=DeoptId::kNone)
Definition il.h:3935
static bool IsEqualityOperator(Kind tok)
Definition token.h:236
#define ASSERT(E)
SkBitmap source
Definition examples.cpp:28
const intptr_t cid

Member Function Documentation

◆ AttributesEqual()

virtual bool dart::EqualityCompareInstr::AttributesEqual ( const Instruction other) const
inlinevirtual

Definition at line 5308 of file il.h.

5308 {
5309 return ComparisonInstr::AttributesEqual(other) &&
5310 (null_aware_ == other.AsEqualityCompare()->null_aware_) &&
5311 (speculative_mode_ == other.AsEqualityCompare()->speculative_mode_);
5312 }
virtual bool AttributesEqual(const Instruction &other) const
Definition il.h:3867

◆ Canonicalize()

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

Definition at line 3736 of file il.cc.

3736 {
3737 if (is_null_aware()) {
3738 ASSERT(operation_cid() == kMintCid);
3739 // Select more efficient instructions based on operand types.
3740 CompileType* left_type = left()->Type();
3741 CompileType* right_type = right()->Type();
3742 if (left_type->IsNull() || left_type->IsNullableSmi() ||
3743 right_type->IsNull() || right_type->IsNullableSmi()) {
3744 auto replacement = new StrictCompareInstr(
3745 source(),
3746 (kind() == Token::kEQ) ? Token::kEQ_STRICT : Token::kNE_STRICT,
3747 left()->CopyWithType(), right()->CopyWithType(),
3748 /*needs_number_check=*/false, DeoptId::kNone);
3749 flow_graph->InsertBefore(this, replacement, env(), FlowGraph::kValue);
3750 return replacement;
3751 } else {
3752 // Null-aware EqualityCompare takes boxed inputs, so make sure
3753 // unmatched representations are still allowed when converting
3754 // EqualityCompare to the unboxed instruction.
3755 if (!left_type->is_nullable() && !right_type->is_nullable() &&
3756 flow_graph->unmatched_representations_allowed()) {
3757 set_null_aware(false);
3758 }
3759 }
3760 } else {
3761 if ((operation_cid() == kMintCid) && IsSingleUseUnboxOrConstant(left()) &&
3763 (left()->Type()->IsNullableSmi() || right()->Type()->IsNullableSmi()) &&
3764 flow_graph->unmatched_representations_allowed()) {
3765 auto replacement = new StrictCompareInstr(
3766 source(),
3767 (kind() == Token::kEQ) ? Token::kEQ_STRICT : Token::kNE_STRICT,
3768 left()->CopyWithType(), right()->CopyWithType(),
3769 /*needs_number_check=*/false, DeoptId::kNone);
3770 flow_graph->InsertBefore(this, replacement, env(), FlowGraph::kValue);
3771 return replacement;
3772 }
3773 }
3774 return this;
3775}
bool is_null_aware() const
Definition il.h:5292
void set_null_aware(bool value)
Definition il.h:5293
static constexpr const char * kNone
static bool IsSingleUseUnboxOrConstant(Value *use)
Definition il.cc:3731
Definition __init__.py:1

◆ ComputeCanDeoptimize()

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

Definition at line 5290 of file il.h.

5290{ return false; }

◆ ComputeType()

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

Definition at line 1425 of file type_propagator.cc.

1425 {
1426 // Used for numeric comparisons only.
1427 return CompileType::Bool();
1428}
static CompileType Bool()

◆ CopyWithNewOperands()

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

Definition at line 6558 of file il.cc.

6559 {
6560 return new EqualityCompareInstr(source(), kind(), new_left, new_right,
6561 operation_cid(), deopt_id(), is_null_aware(),
6562 speculative_mode_);
6563}
EqualityCompareInstr(const InstructionSource &source, Token::Kind kind, Value *left, Value *right, intptr_t cid, intptr_t deopt_id, bool null_aware=false, SpeculativeMode speculative_mode=kGuardInputs)
Definition il.h:5267

◆ is_null_aware()

bool dart::EqualityCompareInstr::is_null_aware ( ) const
inline

Definition at line 5292 of file il.h.

5292{ return null_aware_; }

◆ RequiredInputRepresentation()

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

Definition at line 5295 of file il.h.

5295 {
5296 ASSERT((idx == 0) || (idx == 1));
5297 if (is_null_aware()) return kTagged;
5298 if (operation_cid() == kDoubleCid) return kUnboxedDouble;
5299 if (operation_cid() == kMintCid) return kUnboxedInt64;
5300 if (operation_cid() == kIntegerCid) return kUnboxedUword;
5301 return kTagged;
5302 }
static constexpr Representation kUnboxedUword
Definition locations.h:171

◆ set_null_aware()

void dart::EqualityCompareInstr::set_null_aware ( bool  value)
inline

Definition at line 5293 of file il.h.

5293{ null_aware_ = value; }
uint8_t value

◆ SpeculativeModeOfInput()

virtual SpeculativeMode dart::EqualityCompareInstr::SpeculativeModeOfInput ( intptr_t  index) const
inlinevirtual

Definition at line 5304 of file il.h.

5304 {
5305 return speculative_mode_;
5306 }

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