Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
dart::CheckClassInstr Class Reference

#include <il.h>

Inheritance diagram for dart::CheckClassInstr:
dart::TemplateInstruction< 1, NoThrow > dart::Instruction dart::ZoneAllocated

Public Member Functions

 CheckClassInstr (Value *value, intptr_t deopt_id, const Cids &cids, const InstructionSource &source)
 
virtual bool ComputeCanDeoptimize () const
 
virtual TokenPosition token_pos () const
 
Valuevalue () const
 
const Cidscids () const
 
virtual InstructionCanonicalize (FlowGraph *flow_graph)
 
bool IsNullCheck () const
 
bool IsDeoptIfNull () const
 
bool IsDeoptIfNotNull () const
 
bool IsBitTest () const
 
intptr_t ComputeCidMask () const
 
virtual bool AllowsCSE () const
 
virtual bool HasUnknownSideEffects () const
 
virtual bool AttributesEqual (const Instruction &other) const
 
DECLARE_INSTRUCTION_SERIALIZABLE_FIELDS(CheckClassInstr, TemplateInstruction, FIELD_LIST) private void EmitBitTest (FlowGraphCompiler *compiler, intptr_t min, intptr_t max, intptr_t mask, compiler::Label *deopt)
 
void EmitNullCheck (FlowGraphCompiler *compiler, compiler::Label *deopt)
 
 DISALLOW_COPY_AND_ASSIGN (CheckClassInstr)
 
- Public Member Functions inherited from dart::TemplateInstruction< 1, NoThrow >
 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
 
- Public Member Functions inherited from dart::Instruction
 Instruction (const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
 
 Instruction (intptr_t deopt_id=DeoptId::kNone)
 
virtual ~Instruction ()
 
virtual Tag tag () const =0
 
virtual intptr_t statistics_tag () const
 
intptr_t deopt_id () const
 
virtual TokenPosition token_pos () const
 
InstructionSource source () const
 
virtual intptr_t InputCount () const =0
 
virtual ValueInputAt (intptr_t i) const =0
 
void SetInputAt (intptr_t i, Value *value)
 
InputsIterable inputs ()
 
void UnuseAllInputs ()
 
virtual intptr_t ArgumentCount () const
 
ValueArgumentValueAt (intptr_t index) const
 
DefinitionArgumentAt (intptr_t index) const
 
virtual void SetMoveArguments (MoveArgumentsArray *move_arguments)
 
virtual MoveArgumentsArrayGetMoveArguments () const
 
virtual void ReplaceInputsWithMoveArguments (MoveArgumentsArray *move_arguments)
 
bool HasMoveArguments () const
 
void RepairArgumentUsesInEnvironment () const
 
virtual bool ComputeCanDeoptimize () const =0
 
virtual bool ComputeCanDeoptimizeAfterCall () const
 
bool CanDeoptimize () const
 
virtual void Accept (InstructionVisitor *visitor)=0
 
Instructionprevious () const
 
void set_previous (Instruction *instr)
 
Instructionnext () const
 
void set_next (Instruction *instr)
 
void LinkTo (Instruction *next)
 
InstructionRemoveFromGraph (bool return_previous=true)
 
virtual intptr_t SuccessorCount () const
 
virtual BlockEntryInstrSuccessorAt (intptr_t index) const
 
SuccessorsIterable successors () const
 
void Goto (JoinEntryInstr *entry)
 
virtual const char * DebugName () const =0
 
void CheckField (const Field &field) const
 
const char * ToCString () const
 
 DECLARE_INSTRUCTION_TYPE_CHECK (BlockEntryWithInitialDefs, BlockEntryWithInitialDefs) template< typename T > T *Cast()
 
template<typename T >
const TCast () const
 
LocationSummarylocs ()
 
bool HasLocs () const
 
virtual LocationSummaryMakeLocationSummary (Zone *zone, bool is_optimizing) const =0
 
void InitializeLocationSummary (Zone *zone, bool optimizing)
 
virtual void EmitNativeCode (FlowGraphCompiler *compiler)
 
Environmentenv () const
 
void SetEnvironment (Environment *deopt_env)
 
void RemoveEnvironment ()
 
void ReplaceInEnvironment (Definition *current, Definition *replacement)
 
virtual intptr_t NumberOfInputsConsumedBeforeCall () const
 
intptr_t GetPassSpecificId (CompilerPass::Id pass) const
 
void SetPassSpecificId (CompilerPass::Id pass, intptr_t id)
 
bool HasPassSpecificId (CompilerPass::Id pass) const
 
bool HasUnmatchedInputRepresentations () const
 
virtual Representation RequiredInputRepresentation (intptr_t idx) const
 
SpeculativeMode SpeculativeModeOfInputs () const
 
virtual SpeculativeMode SpeculativeModeOfInput (intptr_t index) const
 
virtual Representation representation () const
 
bool WasEliminated () const
 
virtual intptr_t DeoptimizationTarget () const
 
virtual InstructionCanonicalize (FlowGraph *flow_graph)
 
void InsertBefore (Instruction *next)
 
void InsertAfter (Instruction *prev)
 
InstructionAppendInstruction (Instruction *tail)
 
virtual bool AllowsCSE () const
 
virtual bool HasUnknownSideEffects () const =0
 
virtual bool CanCallDart () const
 
virtual bool CanTriggerGC () const
 
virtual BlockEntryInstrGetBlock ()
 
virtual intptr_t inlining_id () const
 
virtual void set_inlining_id (intptr_t value)
 
virtual bool has_inlining_id () const
 
virtual uword Hash () const
 
bool Equals (const Instruction &other) const
 
virtual bool AttributesEqual (const Instruction &other) const
 
void InheritDeoptTarget (Zone *zone, Instruction *other)
 
bool NeedsEnvironment () const
 
virtual bool CanBecomeDeoptimizationTarget () const
 
void InheritDeoptTargetAfter (FlowGraph *flow_graph, Definition *call, Definition *result)
 
virtual bool MayThrow () const =0
 
virtual bool MayHaveVisibleEffect () const
 
virtual bool CanEliminate (const BlockEntryInstr *block) const
 
bool CanEliminate ()
 
bool IsDominatedBy (Instruction *dom)
 
void ClearEnv ()
 
void Unsupported (FlowGraphCompiler *compiler)
 
virtual bool UseSharedSlowPathStub (bool is_optimizing) const
 
Location::Kind RegisterKindForResult () const
 
- 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 bool IsCompactCidRange (const Cids &cids)
 
- Static Public Member Functions inherited from dart::Instruction
static const ICDataGetICData (const ZoneGrowableArray< const ICData * > &ic_data_array, intptr_t deopt_id, bool is_static_call)
 
static LocationSummaryMakeCallSummary (Zone *zone, const Instruction *instr, LocationSummary *locs=nullptr)
 
static bool SlowPathSharingSupported (bool is_optimizing)
 

Additional Inherited Members

- Public Types inherited from dart::TemplateInstruction< 1, NoThrow >
using BaseClass = typename NoCSE< Instruction, PureInstruction >::Base
 
- Public Types inherited from dart::Instruction
enum  Tag { FOR_EACH_INSTRUCTION =(DECLARE_TAG) kNumInstructions }
 
enum  SpeculativeMode { kGuardInputs , kNotSpeculative }
 
using InputsIterable = InstructionIndexedPropertyIterable< InputsTrait >
 
using SuccessorsIterable = InstructionIndexedPropertyIterable< SuccessorsTrait >
 
- Static Public Attributes inherited from dart::Instruction
static const intptr_t kInstructionAttrs [kNumInstructions]
 
- Protected Member Functions inherited from dart::Instruction
intptr_t GetDeoptId () const
 
virtual void CopyDeoptIdFrom (const Instruction &instr)
 
void WriteExtraWithoutInputs (FlowGraphSerializer *s)
 
void ReadExtraWithoutInputs (FlowGraphDeserializer *d)
 
- Protected Attributes inherited from dart::TemplateInstruction< 1, NoThrow >
EmbeddedArray< Value *, Ninputs_
 

Detailed Description

Definition at line 10581 of file il.h.

Constructor & Destructor Documentation

◆ CheckClassInstr()

dart::CheckClassInstr::CheckClassInstr ( Value value,
intptr_t  deopt_id,
const Cids cids,
const InstructionSource source 
)

Definition at line 840 of file il.cc.

845 cids_(cids),
846 is_bit_test_(IsCompactCidRange(cids)),
847 token_pos_(source.token_pos) {
848 // Expected useful check data.
849 const intptr_t number_of_checks = cids.length();
850 ASSERT(number_of_checks > 0);
851 SetInputAt(0, value);
852 // Otherwise use CheckSmiInstr.
853 ASSERT(number_of_checks != 1 || !cids[0].IsSingleCid() ||
854 cids[0].cid_start != kSmiCid);
855}
Value * value() const
Definition: il.h:10594
const Cids & cids() const
Definition: il.h:10596
static bool IsCompactCidRange(const Cids &cids)
Definition: il.cc:885
intptr_t length() const
Definition: il.h:758
void SetInputAt(intptr_t i, Value *value)
Definition: il.h:1014
InstructionSource source() const
Definition: il.h:1008
intptr_t deopt_id() const
Definition: il.h:993
TemplateInstruction(intptr_t deopt_id=DeoptId::kNone)
Definition: il.h:1507
#define ASSERT(E)
const TokenPosition token_pos

Member Function Documentation

◆ AllowsCSE()

virtual bool dart::CheckClassInstr::AllowsCSE ( ) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 10609 of file il.h.

10609{ return true; }

◆ AttributesEqual()

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

Reimplemented from dart::Instruction.

Definition at line 857 of file il.cc.

857 {
858 auto const other_check = other.AsCheckClass();
859 ASSERT(other_check != nullptr);
860 return cids().Equals(other_check->cids());
861}
bool Equals(const Cids &other) const
Definition: il.cc:655

◆ Canonicalize()

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

Reimplemented from dart::Instruction.

Definition at line 3800 of file il.cc.

3800 {
3801 const intptr_t value_cid = value()->Type()->ToCid();
3802 if (value_cid == kDynamicCid) {
3803 return this;
3804 }
3805
3806 return cids().HasClassId(value_cid) ? nullptr : this;
3807}
bool HasClassId(intptr_t cid) const
Definition: il.cc:682
CompileType * Type()
@ kDynamicCid
Definition: class_id.h:253

◆ cids()

const Cids & dart::CheckClassInstr::cids ( ) const
inline

Definition at line 10596 of file il.h.

10596{ return cids_; }

◆ ComputeCanDeoptimize()

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

Implements dart::Instruction.

Definition at line 10590 of file il.h.

10590{ return true; }

◆ ComputeCidMask()

intptr_t dart::CheckClassInstr::ComputeCidMask ( ) const

Definition at line 903 of file il.cc.

903 {
904 ASSERT(IsBitTest());
905 const uintptr_t one = 1;
906 intptr_t min = cids_.ComputeLowestCid();
907 intptr_t mask = 0;
908 for (intptr_t i = 0; i < cids_.length(); ++i) {
909 uintptr_t run;
910 uintptr_t range = one + cids_[i].Extent();
911 if (range >= static_cast<uintptr_t>(compiler::target::kBitsPerWord)) {
912 run = -1;
913 } else {
914 run = (one << range) - 1;
915 }
916 mask |= run << (cids_[i].cid_start - min);
917 }
918 return mask;
919}
bool IsBitTest() const
Definition: il.cc:899
static float min(float r, float g, float b)
Definition: hsl.cpp:48
static constexpr word kBitsPerWord
Definition: runtime_api.h:291
Definition: run.py:1
def run(cmd)
Definition: run.py:14

◆ DISALLOW_COPY_AND_ASSIGN()

dart::CheckClassInstr::DISALLOW_COPY_AND_ASSIGN ( CheckClassInstr  )

◆ EmitBitTest()

DECLARE_INSTRUCTION_SERIALIZABLE_FIELDS(CheckClassInstr, TemplateInstruction, FIELD_LIST) private void dart::CheckClassInstr::EmitBitTest ( FlowGraphCompiler compiler,
intptr_t  min,
intptr_t  max,
intptr_t  mask,
compiler::Label deopt 
)

◆ EmitNullCheck()

void dart::CheckClassInstr::EmitNullCheck ( FlowGraphCompiler compiler,
compiler::Label deopt 
)

◆ HasUnknownSideEffects()

virtual bool dart::CheckClassInstr::HasUnknownSideEffects ( ) const
inlinevirtual

Implements dart::Instruction.

Definition at line 10610 of file il.h.

10610{ return false; }

◆ IsBitTest()

bool dart::CheckClassInstr::IsBitTest ( ) const

Definition at line 899 of file il.cc.

899 {
900 return is_bit_test_;
901}

◆ IsCompactCidRange()

bool dart::CheckClassInstr::IsCompactCidRange ( const Cids cids)
static

Definition at line 885 of file il.cc.

885 {
886 const intptr_t number_of_checks = cids.length();
887 // If there are only two checks, the extra register pressure needed for the
888 // dense-cid-range code is not justified.
889 if (number_of_checks <= 2) return false;
890
891 // TODO(fschneider): Support smis in dense cid checks.
892 if (cids.HasClassId(kSmiCid)) return false;
893
894 intptr_t min = cids.ComputeLowestCid();
895 intptr_t max = cids.ComputeHighestCid();
897}
intptr_t ComputeLowestCid() const
Definition: il.cc:666
intptr_t ComputeHighestCid() const
Definition: il.cc:674
static float max(float r, float g, float b)
Definition: hsl.cpp:49

◆ IsDeoptIfNotNull()

bool dart::CheckClassInstr::IsDeoptIfNotNull ( ) const

Definition at line 877 of file il.cc.

877 {
878 if (!cids().IsMonomorphic()) {
879 return false;
880 }
881 const intptr_t cid = cids().MonomorphicReceiverCid();
882 return cid == kNullCid;
883}
intptr_t MonomorphicReceiverCid() const
Definition: il.cc:806
@ kNullCid
Definition: class_id.h:252
const intptr_t cid

◆ IsDeoptIfNull()

bool dart::CheckClassInstr::IsDeoptIfNull ( ) const

Definition at line 863 of file il.cc.

863 {
864 if (!cids().IsMonomorphic()) {
865 return false;
866 }
867 CompileType* in_type = value()->Type();
868 const intptr_t cid = cids().MonomorphicReceiverCid();
869 // Performance check: use CheckSmiInstr instead.
870 ASSERT(cid != kSmiCid);
871 return in_type->is_nullable() && (in_type->ToNullableCid() == cid);
872}

◆ IsNullCheck()

bool dart::CheckClassInstr::IsNullCheck ( ) const
inline

Definition at line 10600 of file il.h.

10600{ return IsDeoptIfNull() || IsDeoptIfNotNull(); }
bool IsDeoptIfNull() const
Definition: il.cc:863
bool IsDeoptIfNotNull() const
Definition: il.cc:877

◆ token_pos()

virtual TokenPosition dart::CheckClassInstr::token_pos ( ) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 10592 of file il.h.

10592{ return token_pos_; }

◆ value()

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

Definition at line 10594 of file il.h.

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

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