V8 Project
v8::internal::BitVector Class Reference

#include <data-flow.h>

+ Inheritance diagram for v8::internal::BitVector:
+ Collaboration diagram for v8::internal::BitVector:

Classes

class  BASE_EMBEDDED
 

Public Member Functions

 BitVector (int length, Zone *zone)
 
 BitVector (const BitVector &other, Zone *zone)
 
BitVectoroperator= (const BitVector &rhs)
 
void CopyFrom (const BitVector &other)
 
bool Contains (int i) const
 
void Add (int i)
 
void Remove (int i)
 
void Union (const BitVector &other)
 
bool UnionIsChanged (const BitVector &other)
 
void Intersect (const BitVector &other)
 
bool IntersectIsChanged (const BitVector &other)
 
void Subtract (const BitVector &other)
 
void Clear ()
 
bool IsEmpty () const
 
bool Equals (const BitVector &other)
 
int Count () const
 
int length () const
 
- Public Member Functions inherited from v8::internal::ZoneObject
 INLINE (void *operator new(size_t size, Zone *zone))
 
void operator delete (void *, size_t)
 
void operator delete (void *pointer, Zone *zone)
 

Static Public Member Functions

static int SizeFor (int length)
 

Private Attributes

int length_
 
int data_length_
 
uint32_tdata_
 

Detailed Description

Definition at line 18 of file data-flow.h.

Constructor & Destructor Documentation

◆ BitVector() [1/2]

v8::internal::BitVector::BitVector ( int  length,
Zone zone 
)
inline

Definition at line 65 of file data-flow.h.

66  : length_(length),
68  data_(zone->NewArray<uint32_t>(data_length_)) {
69  DCHECK(length > 0);
70  Clear();
71  }
static int SizeFor(int length)
Definition: data-flow.h:80
#define DCHECK(condition)
Definition: logging.h:205

References Clear(), DCHECK, and length().

+ Here is the call graph for this function:

◆ BitVector() [2/2]

v8::internal::BitVector::BitVector ( const BitVector other,
Zone zone 
)
inline

Definition at line 73 of file data-flow.h.

74  : length_(other.length()),
76  data_(zone->NewArray<uint32_t>(data_length_)) {
77  CopyFrom(other);
78  }
void CopyFrom(const BitVector &other)
Definition: data-flow.h:89

References CopyFrom().

+ Here is the call graph for this function:

Member Function Documentation

◆ Add()

void v8::internal::BitVector::Add ( int  i)
inline

Definition at line 105 of file data-flow.h.

105  {
106  DCHECK(i >= 0 && i < length());
107  data_[i / 32] |= (1U << (i % 32));
108  }

References data_, DCHECK, and length().

Referenced by v8::internal::HInferRepresentationPhase::AddToWorklist(), v8::internal::HRangeAnalysisPhase::AddToWorklist(), v8::internal::compiler::ComputeLoopInfo(), v8::internal::HInferTypesPhase::InferTypes(), v8::internal::HEnvironmentLivenessAnalysisPhase::Run(), v8::internal::HInferRepresentationPhase::Run(), v8::internal::compiler::ScheduleVerifier::Run(), and v8::internal::HEnvironmentLivenessAnalysisPhase::UpdateLivenessAtInstruction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Clear()

void v8::internal::BitVector::Clear ( )
inline

Definition at line 158 of file data-flow.h.

158  {
159  for (int i = 0; i < data_length_; i++) {
160  data_[i] = 0;
161  }
162  }

References data_, and data_length_.

Referenced by BitVector(), v8::internal::HRangeAnalysisPhase::PropagateMinusZeroChecks(), v8::internal::HEnvironmentLivenessAnalysisPhase::UpdateLivenessAtBlockEnd(), and v8::internal::HEnvironmentLivenessAnalysisPhase::UpdateLivenessAtInstruction().

+ Here is the caller graph for this function:

◆ Contains()

bool v8::internal::BitVector::Contains ( int  i) const
inline

Definition at line 99 of file data-flow.h.

99  {
100  DCHECK(i >= 0 && i < length());
101  uint32_t block = data_[i / 32];
102  return (block & (1U << (i % 32))) != 0;
103  }

References data_, DCHECK, and length().

Referenced by v8::internal::HInferRepresentationPhase::AddToWorklist(), v8::internal::HRangeAnalysisPhase::AddToWorklist(), v8::internal::compiler::Scheduler::ComputeSpecialRPO(), v8::internal::HInferTypesPhase::InferTypes(), v8::internal::HEnvironmentLivenessAnalysisPhase::Run(), v8::internal::HInferRepresentationPhase::Run(), v8::internal::compiler::ScheduleVerifier::Run(), v8::internal::HEnvironmentLivenessAnalysisPhase::UpdateLivenessAtInstruction(), and v8::internal::HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsInSuccessors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CopyFrom()

void v8::internal::BitVector::CopyFrom ( const BitVector other)
inline

Definition at line 89 of file data-flow.h.

89  {
90  DCHECK(other.length() <= length());
91  for (int i = 0; i < other.data_length_; i++) {
92  data_[i] = other.data_[i];
93  }
94  for (int i = other.data_length_; i < data_length_; i++) {
95  data_[i] = 0;
96  }
97  }

References data_, data_length_, DCHECK, and length().

Referenced by BitVector(), v8::internal::BASE_EMBEDDED< Visitor >::EnsureCapacity(), operator=(), and v8::internal::compiler::ScheduleVerifier::Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Count()

int v8::internal::BitVector::Count ( ) const

Definition at line 44 of file data-flow.cc.

44  {
45  int count = 0;
46  for (int i = 0; i < data_length_; i++) {
47  int data = data_[i];
48  if (data != 0) count += base::bits::CountPopulation32(data);
49  }
50  return count;
51 }
uint32_t CountPopulation32(uint32_t value)
Definition: bits.h:22

References v8::base::bits::CountPopulation32(), data_, and data_length_.

+ Here is the call graph for this function:

◆ Equals()

bool v8::internal::BitVector::Equals ( const BitVector other)
inline

Definition at line 171 of file data-flow.h.

171  {
172  for (int i = 0; i < data_length_; i++) {
173  if (data_[i] != other.data_[i]) return false;
174  }
175  return true;
176  }

References data_, and data_length_.

Referenced by v8::internal::HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsInSuccessors().

+ Here is the caller graph for this function:

◆ Intersect()

void v8::internal::BitVector::Intersect ( const BitVector other)
inline

Definition at line 133 of file data-flow.h.

133  {
134  DCHECK(other.length() == length());
135  for (int i = 0; i < data_length_; i++) {
136  data_[i] &= other.data_[i];
137  }
138  }

References data_, data_length_, DCHECK, and length().

+ Here is the call graph for this function:

◆ IntersectIsChanged()

bool v8::internal::BitVector::IntersectIsChanged ( const BitVector other)
inline

Definition at line 140 of file data-flow.h.

140  {
141  DCHECK(other.length() == length());
142  bool changed = false;
143  for (int i = 0; i < data_length_; i++) {
144  uint32_t old_data = data_[i];
145  data_[i] &= other.data_[i];
146  if (data_[i] != old_data) changed = true;
147  }
148  return changed;
149  }

References data_, data_length_, DCHECK, and length().

Referenced by v8::internal::compiler::ScheduleVerifier::Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsEmpty()

bool v8::internal::BitVector::IsEmpty ( ) const
inline

Definition at line 164 of file data-flow.h.

164  {
165  for (int i = 0; i < data_length_; i++) {
166  if (data_[i] != 0) return false;
167  }
168  return true;
169  }

References data_, and data_length_.

Referenced by v8::internal::compiler::Frame::DidAllocateDoubleRegisters(), v8::internal::HInferTypesPhase::InferTypes(), v8::internal::HRangeAnalysisPhase::PropagateMinusZeroChecks(), and v8::internal::HEnvironmentLivenessAnalysisPhase::Run().

+ Here is the caller graph for this function:

◆ length()

int v8::internal::BitVector::length ( ) const
inline

Definition at line 180 of file data-flow.h.

180 { return length_; }

References length_.

Referenced by Add(), BitVector(), Contains(), CopyFrom(), Intersect(), IntersectIsChanged(), Remove(), SizeFor(), Subtract(), Union(), UnionIsChanged(), and v8::internal::HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsInSuccessors().

+ Here is the caller graph for this function:

◆ operator=()

BitVector& v8::internal::BitVector::operator= ( const BitVector rhs)
inline

Definition at line 84 of file data-flow.h.

84  {
85  if (this != &rhs) CopyFrom(rhs);
86  return *this;
87  }

References CopyFrom().

+ Here is the call graph for this function:

◆ Remove()

void v8::internal::BitVector::Remove ( int  i)
inline

Definition at line 110 of file data-flow.h.

110  {
111  DCHECK(i >= 0 && i < length());
112  data_[i / 32] &= ~(1U << (i % 32));
113  }

References data_, DCHECK, and length().

Referenced by v8::internal::HInferTypesPhase::InferTypes(), v8::internal::HEnvironmentLivenessAnalysisPhase::Run(), v8::internal::HInferRepresentationPhase::Run(), v8::internal::compiler::ScheduleVerifier::Run(), and v8::internal::HEnvironmentLivenessAnalysisPhase::UpdateLivenessAtInstruction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SizeFor()

static int v8::internal::BitVector::SizeFor ( int  length)
inlinestatic

Definition at line 80 of file data-flow.h.

80  {
81  return 1 + ((length - 1) / 32);
82  }

References length().

+ Here is the call graph for this function:

◆ Subtract()

void v8::internal::BitVector::Subtract ( const BitVector other)
inline

Definition at line 151 of file data-flow.h.

151  {
152  DCHECK(other.length() == length());
153  for (int i = 0; i < data_length_; i++) {
154  data_[i] &= ~other.data_[i];
155  }
156  }

References data_, data_length_, DCHECK, and length().

+ Here is the call graph for this function:

◆ Union()

void v8::internal::BitVector::Union ( const BitVector other)
inline

Definition at line 115 of file data-flow.h.

115  {
116  DCHECK(other.length() == length());
117  for (int i = 0; i < data_length_; i++) {
118  data_[i] |= other.data_[i];
119  }
120  }

References data_, data_length_, DCHECK, and length().

Referenced by v8::internal::HEnvironmentLivenessAnalysisPhase::UpdateLivenessAtBlockEnd(), and v8::internal::HEnvironmentLivenessAnalysisPhase::UpdateLivenessAtInstruction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UnionIsChanged()

bool v8::internal::BitVector::UnionIsChanged ( const BitVector other)
inline

Definition at line 122 of file data-flow.h.

122  {
123  DCHECK(other.length() == length());
124  bool changed = false;
125  for (int i = 0; i < data_length_; i++) {
126  uint32_t old_data = data_[i];
127  data_[i] |= other.data_[i];
128  if (data_[i] != old_data) changed = true;
129  }
130  return changed;
131  }

References data_, data_length_, DCHECK, and length().

+ Here is the call graph for this function:

Member Data Documentation

◆ data_

uint32_t* v8::internal::BitVector::data_
private

◆ data_length_

int v8::internal::BitVector::data_length_
private

◆ length_

int v8::internal::BitVector::length_
private

Definition at line 187 of file data-flow.h.

Referenced by length().


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