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

#include <il.h>

Inheritance diagram for dart::Cids:
dart::ZoneAllocated dart::CallTargets

Public Member Functions

 Cids (Zone *zone)
 
bool Equals (const Cids &other) const
 
bool HasClassId (intptr_t cid) const
 
void Add (CidRange *target)
 
CidRangeoperator[] (intptr_t index) const
 
CidRangeAt (int index) const
 
intptr_t length () const
 
void SetLength (intptr_t len)
 
bool is_empty () const
 
void Sort (int compare(CidRange *const *a, CidRange *const *b))
 
bool IsMonomorphic () const
 
intptr_t MonomorphicReceiverCid () const
 
intptr_t ComputeLowestCid () const
 
intptr_t ComputeHighestCid () 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 CidsCreateForArgument (Zone *zone, const BinaryFeedback &binary_feedback, int argument_number)
 
static CidsCreateMonomorphic (Zone *zone, intptr_t cid)
 

Protected Attributes

GrowableArray< CidRange * > cid_ranges_
 

Detailed Description

Definition at line 730 of file il.h.

Constructor & Destructor Documentation

◆ Cids()

dart::Cids::Cids ( Zone zone)
inlineexplicit

Definition at line 732 of file il.h.

732: cid_ranges_(zone, 6) {}
GrowableArray< CidRange * > cid_ranges_
Definition il.h:768

Member Function Documentation

◆ Add()

void dart::Cids::Add ( CidRange target)
inline

Definition at line 746 of file il.h.

746{ cid_ranges_.Add(target); }
uint32_t * target

◆ At()

CidRange * dart::Cids::At ( int  index) const
inline

Definition at line 750 of file il.h.

750{ return cid_ranges_[index]; }

◆ ComputeHighestCid()

intptr_t dart::Cids::ComputeHighestCid ( ) const

Definition at line 672 of file il.cc.

672 {
673 intptr_t max = -1;
674 for (intptr_t i = 0; i < cid_ranges_.length(); ++i) {
675 max = Utils::Maximum(max, cid_ranges_[i]->cid_end);
676 }
677 return max;
678}
static constexpr T Maximum(T x, T y)
Definition utils.h:26
static float max(float r, float g, float b)
Definition hsl.cpp:49

◆ ComputeLowestCid()

intptr_t dart::Cids::ComputeLowestCid ( ) const

Definition at line 664 of file il.cc.

664 {
665 intptr_t min = kIntptrMax;
666 for (intptr_t i = 0; i < cid_ranges_.length(); ++i) {
667 min = Utils::Minimum(min, cid_ranges_[i]->cid_start);
668 }
669 return min;
670}
static T Minimum(T x, T y)
Definition utils.h:21
static float min(float r, float g, float b)
Definition hsl.cpp:48
constexpr intptr_t kIntptrMax
Definition globals.h:557

◆ CreateForArgument()

Cids * dart::Cids::CreateForArgument ( Zone zone,
const BinaryFeedback binary_feedback,
int  argument_number 
)
static

Definition at line 695 of file il.cc.

697 {
698 Cids* cids = new (zone) Cids(zone);
699 for (intptr_t i = 0; i < binary_feedback.feedback_.length(); i++) {
700 ASSERT((argument_number == 0) || (argument_number == 1));
701 const intptr_t cid = argument_number == 0
702 ? binary_feedback.feedback_[i].first
703 : binary_feedback.feedback_[i].second;
704 cids->Add(new (zone) CidRange(cid, cid));
705 }
706
707 if (cids->length() != 0) {
708 cids->Sort(OrderById);
709
710 // Merge adjacent class id ranges.
711 int dest = 0;
712 for (int src = 1; src < cids->length(); src++) {
713 if (cids->cid_ranges_[dest]->cid_end + 1 >=
714 cids->cid_ranges_[src]->cid_start) {
715 cids->cid_ranges_[dest]->cid_end = cids->cid_ranges_[src]->cid_end;
716 } else {
717 dest++;
718 if (src != dest) cids->cid_ranges_[dest] = cids->cid_ranges_[src];
719 }
720 }
721 cids->SetLength(dest + 1);
722 }
723
724 return cids;
725}
Cids(Zone *zone)
Definition il.h:732
#define ASSERT(E)
static int OrderById(CidRange *const *a, CidRange *const *b)
Definition il.cc:635
const intptr_t cid
dest
Definition zip.py:79

◆ CreateMonomorphic()

Cids * dart::Cids::CreateMonomorphic ( Zone zone,
intptr_t  cid 
)
static

Definition at line 689 of file il.cc.

689 {
690 Cids* cids = new (zone) Cids(zone);
691 cids->Add(new (zone) CidRange(cid, cid));
692 return cids;
693}

◆ Equals()

bool dart::Cids::Equals ( const Cids other) const

Definition at line 653 of file il.cc.

653 {
654 if (length() != other.length()) return false;
655 for (int i = 0; i < length(); i++) {
656 if (cid_ranges_[i]->cid_start != other.cid_ranges_[i]->cid_start ||
657 cid_ranges_[i]->cid_end != other.cid_ranges_[i]->cid_end) {
658 return false;
659 }
660 }
661 return true;
662}
intptr_t length() const
Definition il.h:752

◆ HasClassId()

bool dart::Cids::HasClassId ( intptr_t  cid) const

Definition at line 680 of file il.cc.

680 {
681 for (int i = 0; i < length(); i++) {
682 if (cid_ranges_[i]->Contains(cid)) {
683 return true;
684 }
685 }
686 return false;
687}
bool Contains(const Container &container, const Value &value)

◆ is_empty()

bool dart::Cids::is_empty ( ) const
inline

Definition at line 756 of file il.h.

756{ return cid_ranges_.is_empty(); }

◆ IsMonomorphic()

bool dart::Cids::IsMonomorphic ( ) const

Definition at line 799 of file il.cc.

799 {
800 if (length() != 1) return false;
801 return cid_ranges_[0]->IsSingleCid();
802}

◆ length()

intptr_t dart::Cids::length ( ) const
inline

Definition at line 752 of file il.h.

752{ return cid_ranges_.length(); }

◆ MonomorphicReceiverCid()

intptr_t dart::Cids::MonomorphicReceiverCid ( ) const

Definition at line 804 of file il.cc.

804 {
806 return cid_ranges_[0]->cid_start;
807}
bool IsMonomorphic() const
Definition il.cc:799

◆ operator[]()

CidRange & dart::Cids::operator[] ( intptr_t  index) const
inline

Definition at line 748 of file il.h.

748{ return *cid_ranges_[index]; }

◆ SetLength()

void dart::Cids::SetLength ( intptr_t  len)
inline

Definition at line 754 of file il.h.

754{ cid_ranges_.SetLength(len); }

◆ Sort()

void dart::Cids::Sort ( int   compareCidRange *const *a, CidRange *const *b)
inline

Definition at line 758 of file il.h.

758 {
759 cid_ranges_.Sort(compare);
760 }
static bool compare(const SkBitmap &ref, const SkIRect &iref, const SkBitmap &test, const SkIRect &itest)
Definition BlurTest.cpp:100

Member Data Documentation

◆ cid_ranges_

GrowableArray<CidRange*> dart::Cids::cid_ranges_
protected

Definition at line 768 of file il.h.


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