Lines Matching defs:bound

95 ArrayBoundsCheckElimination::Bound *ArrayBoundsCheckElimination::AndOp(Bound *bound, Bound *b)
97 // Update lower bound
98 if (bound->lowerGate_ == b->lowerGate_) {
99 bound->lower_ = std::max(bound->lower_, b->lower_);
103 if (bound->lowerGate_ != Circuit::NullGate() && b->lowerGate_ != Circuit::NullGate()) {
104 auto boundLowerGateRegion = graphLinearizer_.GateToRegion(bound->lowerGate_);
117 bound->lower_ = b->lower_;
118 bound->lowerGate_ = b->lowerGate_;
122 // Update upper bound
123 if (bound->upperGate_ == b->upperGate_) {
124 bound->upper_ = std::min(bound->upper_, b->upper_);
128 if (bound->upperGate_ != Circuit::NullGate() && b->upperGate_ != Circuit::NullGate()) {
129 auto boundUpperGateRegion = graphLinearizer_.GateToRegion(bound->upperGate_);
142 bound->upper_ = b->upper_;
143 bound->upperGate_ = b->upperGate_;
147 return bound;
150 ArrayBoundsCheckElimination::Bound *ArrayBoundsCheckElimination::OrOp(Bound *bound, Bound *b)
152 // Update lower bound
153 if (bound->lowerGate_ != b->lowerGate_) {
154 bound->lowerGate_ = Circuit::NullGate();
155 bound->lower_ = INT_MIN;
157 bound->lower_ = std::min(bound->lower_, b->lower_);
159 // Update upper bound
160 if (bound->upperGate_ != b->upperGate_) {
161 bound->upperGate_ = Circuit::NullGate();
162 bound->upper_ = INT_MAX;
164 bound->upper_ = std::max(bound->upper_, b->upper_);
167 return bound;
220 Bound *bound = GetBound(y);
221 if (bound == nullptr) {
222 LOG_ECMA(FATAL) << "ArrayBoundsCheckElimination::DoBinaryArithmeticOp:bound is nullptr";
225 if (!bound->HasUpper() || !bound->HasLower()) {
229 int lower = bound->Lower();
230 int upper = bound->Upper();
238 return chunk_->New<Bound>(newLower, bound->LowerGate(), newUpper, bound->UpperGate());
241 Bound *bound = GetBound(x);
242 if (bound == nullptr) {
243 LOG_ECMA(FATAL) << "ArrayBoundsCheckElimination::DoBinaryArithmeticOp:bound is nullptr";
246 if (bound->LowerGate() == y) {
247 return chunk_->New<Bound>(TypedBinOp::TYPED_GREATEREQ, Circuit::NullGate(), bound->Lower());
270 Bound *bound = GetBound(x);
272 if (!bound->HasUpper() || !bound->HasLower()) {
276 int lower = bound->Lower();
277 int upper = bound->Upper();
285 return chunk_->New<Bound>(newLower, bound->LowerGate(), newUpper, bound->UpperGate());
303 Bound *bound = nullptr;
346 if (!bound) {
347 bound = curBound->Copy(chunk_);
349 bound = OrOp(bound, curBound);
352 bound = chunk_->New<Bound>();
358 bound->RemoveUpper();
361 bound->RemoveLower();
363 return bound;
471 Bound *bound = VisitGate(gate);
472 if (bound) {
473 bounds_[acc_.GetId(gate)]->push_back(bound);
484 void ArrayBoundsCheckElimination::UpdateBound(IntegerStack &pushed, GateRef gate, Bound *bound)
487 // No bound update for constants
498 bound = AndOp(bound, top);
500 bounds_[acc_.GetId(gate)]->push_back(bound);
528 Bound *bound = chunk_->New<Bound>(op, instrValue, constValue);
529 UpdateBound(pushed, x, bound);
578 bool ArrayBoundsCheckElimination::InArrayBound(Bound *bound, GateRef length, GateRef array)
580 if (!bound || array == Circuit::NullGate()) {
584 if (bound->Lower() >= 0 && bound->LowerGate() == Circuit::NullGate() &&
585 bound->Upper() < 0 && bound->UpperGate() != Circuit::NullGate()) {
586 if (length != Circuit::NullGate() && bound->UpperGate() == length) {
892 // Calculate lower bound
904 // Calculate upper bound
978 // Give IndexCheck a bound [0, Length - 1]