if (this->IsBitset()) return BitsetType::Min(this->AsBitset());
if (this->IsUnion()) {
double min = +V8_INFINITY;
- for (int i = 0; i < this->AsUnion()->Length(); ++i) {
+ for (int i = 0, n = this->AsUnion()->Length(); i < n; ++i) {
min = std::min(min, this->AsUnion()->Get(i)->Min());
}
return min;
if (this->IsBitset()) return BitsetType::Max(this->AsBitset());
if (this->IsUnion()) {
double max = -V8_INFINITY;
- for (int i = 0; i < this->AsUnion()->Length(); ++i) {
+ for (int i = 0, n = this->AsUnion()->Length(); i < n; ++i) {
max = std::max(max, this->AsUnion()->Get(i)->Max());
}
return max;
if (type->IsBitset()) return type->AsBitset();
if (type->IsUnion()) {
int bitset = kNone;
- for (int i = 0; i < type->AsUnion()->Length(); ++i) {
+ for (int i = 0, n = type->AsUnion()->Length(); i < n; ++i) {
bitset |= type->AsUnion()->Get(i)->BitsetLub();
}
return bitset;
!this_fun->Receiver()->Equals(that_fun->Receiver())) {
return false;
}
- for (int i = 0; i < this_fun->Arity(); ++i) {
+ for (int i = 0, n = this_fun->Arity(); i < n; ++i) {
if (!this_fun->Parameter(i)->Equals(that_fun->Parameter(i))) return false;
}
return true;
// (T1 \/ ... \/ Tn) <= T if (T1 <= T) /\ ... /\ (Tn <= T)
if (this->IsUnion()) {
- UnionHandle unioned = handle(this->AsUnion());
- for (int i = 0; i < unioned->Length(); ++i) {
- if (!unioned->Get(i)->Is(that)) return false;
+ for (int i = 0, n = this->AsUnion()->Length(); i < n; ++i) {
+ if (!this->AsUnion()->Get(i)->Is(that)) return false;
}
return true;
}
// T <= (T1 \/ ... \/ Tn) if (T <= T1) \/ ... \/ (T <= Tn)
if (that->IsUnion()) {
- for (int i = 0; i < that->AsUnion()->Length(); ++i) {
+ for (int i = 0, n = that->AsUnion()->Length(); i < n; ++i) {
if (this->Is(that->AsUnion()->Get(i))) return true;
if (i > 1 && this->IsRange()) return false; // Shortcut.
}
// (T1 \/ ... \/ Tn) overlaps T if (T1 overlaps T) \/ ... \/ (Tn overlaps T)
if (this->IsUnion()) {
- UnionHandle unioned = handle(this->AsUnion());
- for (int i = 0; i < unioned->Length(); ++i) {
- if (unioned->Get(i)->Maybe(that)) return true;
+ for (int i = 0, n = this->AsUnion()->Length(); i < n; ++i) {
+ if (this->AsUnion()->Get(i)->Maybe(that)) return true;
}
return false;
}
// T overlaps (T1 \/ ... \/ Tn) if (T overlaps T1) \/ ... \/ (T overlaps Tn)
if (that->IsUnion()) {
- for (int i = 0; i < that->AsUnion()->Length(); ++i) {
+ for (int i = 0, n = that->AsUnion()->Length(); i < n; ++i) {
if (this->Maybe(that->AsUnion()->Get(i))) return true;
}
return false;
TypeHandle lhs, TypeHandle rhs,
UnionHandle result, int size, Region* region) {
if (lhs->IsUnion()) {
- for (int i = 0; i < lhs->AsUnion()->Length(); ++i) {
+ for (int i = 0, n = lhs->AsUnion()->Length(); i < n; ++i) {
size = IntersectAux(lhs->AsUnion()->Get(i), rhs, result, size, region);
}
return size;
}
if (rhs->IsUnion()) {
- for (int i = 0; i < rhs->AsUnion()->Length(); ++i) {
+ for (int i = 0, n = rhs->AsUnion()->Length(); i < n; ++i) {
size = IntersectAux(lhs, rhs->AsUnion()->Get(i), result, size, region);
}
return size;
TypeHandle type, UnionHandle result, int size, Region* region) {
if (type->IsBitset() || type->IsRange()) return size;
if (type->IsUnion()) {
- for (int i = 0; i < type->AsUnion()->Length(); ++i) {
+ for (int i = 0, n = type->AsUnion()->Length(); i < n; ++i) {
size = AddToUnion(type->AsUnion()->Get(i), result, size, region);
}
return size;
if (this->IsClass()) {
return 1;
} else if (this->IsUnion()) {
- UnionHandle unioned = handle(this->AsUnion());
int result = 0;
- for (int i = 0; i < unioned->Length(); ++i) {
- if (unioned->Get(i)->IsClass()) ++result;
+ for (int i = 0, n = this->AsUnion()->Length(); i < n; ++i) {
+ if (this->AsUnion()->Get(i)->IsClass()) ++result;
}
return result;
} else {
if (this->IsConstant()) {
return 1;
} else if (this->IsUnion()) {
- UnionHandle unioned = handle(this->AsUnion());
int result = 0;
- for (int i = 0; i < unioned->Length(); ++i) {
- if (unioned->Get(i)->IsConstant()) ++result;
+ for (int i = 0, n = this->AsUnion()->Length(); i < n; ++i) {
+ if (this->AsUnion()->Get(i)->IsConstant()) ++result;
}
return result;
} else {
DisallowHeapAllocation no_allocation;
++index_;
if (type_->IsUnion()) {
- UnionHandle unioned = Config::template cast<UnionType>(type_);
- for (; index_ < unioned->Length(); ++index_) {
- if (matches(unioned->Get(index_))) return;
+ for (int n = type_->AsUnion()->Length(); index_ < n; ++index_) {
+ if (matches(type_->AsUnion()->Get(index_))) return;
}
} else if (index_ == 0 && matches(type_)) {
return;
os << ")";
} else if (this->IsUnion()) {
os << "(";
- UnionHandle unioned = handle(this->AsUnion());
- for (int i = 0; i < unioned->Length(); ++i) {
- TypeHandle type_i = unioned->Get(i);
+ for (int i = 0, n = this->AsUnion()->Length(); i < n; ++i) {
+ TypeHandle type_i = this->AsUnion()->Get(i);
if (i > 0) os << " | ";
type_i->PrintTo(os, dim);
}