Index: runtime/vm/flow_graph_range_analysis.cc |
diff --git a/runtime/vm/flow_graph_range_analysis.cc b/runtime/vm/flow_graph_range_analysis.cc |
index fcf55ee2ddc130d8b68069537f81160bc2127510..bbd0b4c3ad754fa51eca0bc9fba93e9bec79810b 100644 |
--- a/runtime/vm/flow_graph_range_analysis.cc |
+++ b/runtime/vm/flow_graph_range_analysis.cc |
@@ -40,7 +40,6 @@ void RangeAnalysis::Analyze() { |
RemoveConstraints(); |
} |
- |
static Definition* UnwrapConstraint(Definition* defn) { |
while (defn->IsConstraint()) { |
defn = defn->AsConstraint()->value()->definition(); |
@@ -48,7 +47,6 @@ static Definition* UnwrapConstraint(Definition* defn) { |
return defn; |
} |
- |
// Simple induction variable is a variable that satisfies the following pattern: |
// |
// v1 <- phi(v0, v1 + 1) |
@@ -108,7 +106,6 @@ class InductionVariableInfo : public ZoneAllocated { |
PhiInstr* bound_; |
}; |
- |
static ConstraintInstr* FindBoundingConstraint(PhiInstr* phi, |
Definition* defn) { |
ConstraintInstr* limit = NULL; |
@@ -129,7 +126,6 @@ static ConstraintInstr* FindBoundingConstraint(PhiInstr* phi, |
return limit; |
} |
- |
static InductionVariableInfo* DetectSimpleInductionVariable(PhiInstr* phi) { |
if (phi->Type()->ToCid() != kSmiCid) { |
return NULL; |
@@ -165,7 +161,6 @@ static InductionVariableInfo* DetectSimpleInductionVariable(PhiInstr* phi) { |
return NULL; |
} |
- |
void RangeAnalysis::DiscoverSimpleInductionVariables() { |
GrowableArray<InductionVariableInfo*> loop_variables; |
@@ -211,7 +206,6 @@ void RangeAnalysis::DiscoverSimpleInductionVariables() { |
} |
} |
- |
void RangeAnalysis::CollectValues() { |
const GrowableArray<Definition*>& initial = |
*flow_graph_->graph_entry()->initial_definitions(); |
@@ -226,7 +220,6 @@ void RangeAnalysis::CollectValues() { |
!block_it.Done(); block_it.Advance()) { |
BlockEntryInstr* block = block_it.Current(); |
- |
if (block->IsGraphEntry() || block->IsCatchBlockEntry()) { |
const GrowableArray<Definition*>& initial = |
block->IsGraphEntry() |
@@ -270,7 +263,6 @@ void RangeAnalysis::CollectValues() { |
} |
} |
- |
// For a comparison operation return an operation for the equivalent flipped |
// comparison: a (op) b === b (op') a. |
static Token::Kind FlipComparison(Token::Kind op) { |
@@ -293,7 +285,6 @@ static Token::Kind FlipComparison(Token::Kind op) { |
} |
} |
- |
// Given a boundary (right operand) and a comparison operation return |
// a symbolic range constraint for the left operand of the comparison assuming |
// that it evaluated to true. |
@@ -324,7 +315,6 @@ Range* RangeAnalysis::ConstraintSmiRange(Token::Kind op, Definition* boundary) { |
} |
} |
- |
ConstraintInstr* RangeAnalysis::InsertConstraintFor(Value* use, |
Definition* defn, |
Range* constraint_range, |
@@ -351,7 +341,6 @@ ConstraintInstr* RangeAnalysis::InsertConstraintFor(Value* use, |
return constraint; |
} |
- |
bool RangeAnalysis::ConstrainValueAfterBranch(Value* use, Definition* defn) { |
BranchInstr* branch = use->instruction()->AsBranch(); |
RelationalOpInstr* rel_op = branch->comparison()->AsRelationalOp(); |
@@ -394,7 +383,6 @@ bool RangeAnalysis::ConstrainValueAfterBranch(Value* use, Definition* defn) { |
return false; |
} |
- |
void RangeAnalysis::InsertConstraintsFor(Definition* defn) { |
for (Value* use = defn->input_use_list(); use != NULL; |
use = use->next_use()) { |
@@ -411,7 +399,6 @@ void RangeAnalysis::InsertConstraintsFor(Definition* defn) { |
} |
} |
- |
void RangeAnalysis::ConstrainValueAfterCheckArrayBound(Value* use, |
Definition* defn) { |
CheckArrayBoundInstr* check = use->instruction()->AsCheckArrayBound(); |
@@ -431,7 +418,6 @@ void RangeAnalysis::ConstrainValueAfterCheckArrayBound(Value* use, |
InsertConstraintFor(use, defn, constraint_range, check); |
} |
- |
void RangeAnalysis::InsertConstraints() { |
for (intptr_t i = 0; i < values_.length(); i++) { |
InsertConstraintsFor(values_[i]); |
@@ -442,7 +428,6 @@ void RangeAnalysis::InsertConstraints() { |
} |
} |
- |
const Range* RangeAnalysis::GetSmiRange(Value* value) const { |
Definition* defn = value->definition(); |
const Range* range = defn->range(); |
@@ -464,7 +449,6 @@ const Range* RangeAnalysis::GetSmiRange(Value* value) const { |
return range; |
} |
- |
const Range* RangeAnalysis::GetIntRange(Value* value) const { |
Definition* defn = value->definition(); |
const Range* range = defn->range(); |
@@ -486,7 +470,6 @@ const Range* RangeAnalysis::GetIntRange(Value* value) const { |
return range; |
} |
- |
static bool AreEqualDefinitions(Definition* a, Definition* b) { |
a = UnwrapConstraint(a); |
b = UnwrapConstraint(b); |
@@ -495,13 +478,11 @@ static bool AreEqualDefinitions(Definition* a, Definition* b) { |
b->Dependencies().IsNone() && a->Equals(b)); |
} |
- |
static bool DependOnSameSymbol(const RangeBoundary& a, const RangeBoundary& b) { |
return a.IsSymbol() && b.IsSymbol() && |
AreEqualDefinitions(a.symbol(), b.symbol()); |
} |
- |
// Given the current range of a phi and a newly computed range check |
// if it is growing towards negative infinity, if it does widen it to |
// MinSmi. |
@@ -560,7 +541,6 @@ static RangeBoundary WidenMax(const Range* range, |
: RangeBoundary::MaxConstant(size); |
} |
- |
// Given the current range of a phi and a newly computed range check |
// if we can perform narrowing: use newly computed minimum to improve precision |
// of the computed range. We do it only if current minimum was widened and is |
@@ -578,7 +558,6 @@ static RangeBoundary NarrowMin(const Range* range, |
return range->min().IsMinimumOrBelow(size) ? new_range->min() : range->min(); |
} |
- |
// Given the current range of a phi and a newly computed range check |
// if we can perform narrowing: use newly computed maximum to improve precision |
// of the computed range. We do it only if current maximum was widened and is |
@@ -596,7 +575,6 @@ static RangeBoundary NarrowMax(const Range* range, |
return range->max().IsMaximumOrAbove(size) ? new_range->max() : range->max(); |
} |
- |
char RangeAnalysis::OpPrefix(JoinOperator op) { |
switch (op) { |
case WIDEN: |
@@ -610,7 +588,6 @@ char RangeAnalysis::OpPrefix(JoinOperator op) { |
return ' '; |
} |
- |
static RangeBoundary::RangeSize RangeSizeForPhi(Definition* phi) { |
ASSERT(phi->IsPhi()); |
if (phi->Type()->ToCid() == kSmiCid) { |
@@ -625,7 +602,6 @@ static RangeBoundary::RangeSize RangeSizeForPhi(Definition* phi) { |
} |
} |
- |
bool RangeAnalysis::InferRange(JoinOperator op, |
Definition* defn, |
intptr_t iteration) { |
@@ -660,7 +636,6 @@ bool RangeAnalysis::InferRange(JoinOperator op, |
return false; |
} |
- |
void RangeAnalysis::CollectDefinitions(BitVector* set) { |
for (BlockIterator block_it = flow_graph_->reverse_postorder_iterator(); |
!block_it.Done(); block_it.Advance()) { |
@@ -686,7 +661,6 @@ void RangeAnalysis::CollectDefinitions(BitVector* set) { |
} |
} |
- |
void RangeAnalysis::Iterate(JoinOperator op, intptr_t max_iterations) { |
// TODO(vegorov): switch to worklist if this becomes performance bottleneck. |
intptr_t iteration = 0; |
@@ -704,7 +678,6 @@ void RangeAnalysis::Iterate(JoinOperator op, intptr_t max_iterations) { |
} while (changed && (iteration < max_iterations)); |
} |
- |
void RangeAnalysis::InferRanges() { |
if (FLAG_trace_range_analysis) { |
FlowGraphPrinter::PrintGraph("Range Analysis (BEFORE)", flow_graph_); |
@@ -761,7 +734,6 @@ void RangeAnalysis::InferRanges() { |
} |
} |
- |
void RangeAnalysis::AssignRangesRecursively(Definition* defn) { |
if (!Range::IsUnknown(defn->range())) { |
return; |
@@ -785,7 +757,6 @@ void RangeAnalysis::AssignRangesRecursively(Definition* defn) { |
} |
} |
- |
// Scheduler is a helper class that inserts floating control-flow less |
// subgraphs into the flow graph. |
// It always attempts to schedule instructions into the loop preheader in the |
@@ -915,7 +886,6 @@ class Scheduler { |
GrowableArray<Instruction*> emitted_; |
}; |
- |
// If bounds check 0 <= index < length is not redundant we attempt to |
// replace it with a sequence of checks that guarantee |
// |
@@ -1082,7 +1052,6 @@ class BoundsCheckGeneralizer { |
Thread::kNoDeoptId); |
} |
- |
BinarySmiOpInstr* MakeBinaryOp(Token::Kind op_kind, |
Definition* left, |
intptr_t right) { |
@@ -1443,7 +1412,6 @@ class BoundsCheckGeneralizer { |
f->Print(" {%s}", Range::ToCString(index_bound->range())); |
} |
- |
static const char* IndexBoundToCString(Definition* index_bound) { |
char buffer[1024]; |
BufferFormatter f(buffer, sizeof(buffer)); |
@@ -1457,7 +1425,6 @@ class BoundsCheckGeneralizer { |
Scheduler scheduler_; |
}; |
- |
void RangeAnalysis::EliminateRedundantBoundsChecks() { |
if (FLAG_array_bounds_check_elimination) { |
const Function& function = flow_graph_->function(); |
@@ -1486,7 +1453,6 @@ void RangeAnalysis::EliminateRedundantBoundsChecks() { |
} |
} |
- |
void RangeAnalysis::MarkUnreachableBlocks() { |
for (intptr_t i = 0; i < constraints_.length(); i++) { |
if (Range::IsUnknown(constraints_[i]->range())) { |
@@ -1521,7 +1487,6 @@ void RangeAnalysis::MarkUnreachableBlocks() { |
} |
} |
- |
void RangeAnalysis::RemoveConstraints() { |
for (intptr_t i = 0; i < constraints_.length(); i++) { |
Definition* def = constraints_[i]->value()->definition(); |
@@ -1535,7 +1500,6 @@ void RangeAnalysis::RemoveConstraints() { |
} |
} |
- |
static void NarrowBinaryMintOp(BinaryMintOpInstr* mint_op) { |
if (RangeUtils::Fits(mint_op->range(), RangeBoundary::kRangeBoundaryInt32) && |
RangeUtils::Fits(mint_op->left()->definition()->range(), |
@@ -1553,7 +1517,6 @@ static void NarrowBinaryMintOp(BinaryMintOpInstr* mint_op) { |
} |
} |
- |
static void NarrowShiftMintOp(ShiftMintOpInstr* mint_op) { |
if (RangeUtils::Fits(mint_op->range(), RangeBoundary::kRangeBoundaryInt32) && |
RangeUtils::Fits(mint_op->left()->definition()->range(), |
@@ -1571,7 +1534,6 @@ static void NarrowShiftMintOp(ShiftMintOpInstr* mint_op) { |
} |
} |
- |
void RangeAnalysis::NarrowMintToInt32() { |
for (intptr_t i = 0; i < binary_mint_ops_.length(); i++) { |
NarrowBinaryMintOp(binary_mint_ops_[i]); |
@@ -1582,7 +1544,6 @@ void RangeAnalysis::NarrowMintToInt32() { |
} |
} |
- |
IntegerInstructionSelector::IntegerInstructionSelector(FlowGraph* flow_graph) |
: flow_graph_(flow_graph) { |
ASSERT(flow_graph_ != NULL); |
@@ -1591,7 +1552,6 @@ IntegerInstructionSelector::IntegerInstructionSelector(FlowGraph* flow_graph) |
new (zone_) BitVector(zone_, flow_graph_->current_ssa_temp_index()); |
} |
- |
void IntegerInstructionSelector::Select() { |
if (FLAG_trace_integer_ir_selection) { |
THR_Print("---- starting integer ir selection -------\n"); |
@@ -1607,7 +1567,6 @@ void IntegerInstructionSelector::Select() { |
} |
} |
- |
bool IntegerInstructionSelector::IsPotentialUint32Definition(Definition* def) { |
// TODO(johnmccutchan): Consider Smi operations, to avoid unnecessary tagging |
// & untagged of intermediate results. |
@@ -1616,7 +1575,6 @@ bool IntegerInstructionSelector::IsPotentialUint32Definition(Definition* def) { |
def->IsShiftMintOp() || def->IsUnaryMintOp(); |
} |
- |
void IntegerInstructionSelector::FindPotentialUint32Definitions() { |
if (FLAG_trace_integer_ir_selection) { |
THR_Print("++++ Finding potential Uint32 definitions:\n"); |
@@ -1642,7 +1600,6 @@ void IntegerInstructionSelector::FindPotentialUint32Definitions() { |
} |
} |
- |
// BinaryMintOp masks and stores into unsigned typed arrays that truncate the |
// value into a Uint32 range. |
bool IntegerInstructionSelector::IsUint32NarrowingDefinition(Definition* def) { |
@@ -1663,7 +1620,6 @@ bool IntegerInstructionSelector::IsUint32NarrowingDefinition(Definition* def) { |
return false; |
} |
- |
void IntegerInstructionSelector::FindUint32NarrowingDefinitions() { |
ASSERT(selected_uint32_defs_ != NULL); |
if (FLAG_trace_integer_ir_selection) { |
@@ -1681,7 +1637,6 @@ void IntegerInstructionSelector::FindUint32NarrowingDefinitions() { |
} |
} |
- |
bool IntegerInstructionSelector::AllUsesAreUint32Narrowing(Value* list_head) { |
for (Value::Iterator it(list_head); !it.Done(); it.Advance()) { |
Value* use = it.Current(); |
@@ -1694,7 +1649,6 @@ bool IntegerInstructionSelector::AllUsesAreUint32Narrowing(Value* list_head) { |
return true; |
} |
- |
bool IntegerInstructionSelector::CanBecomeUint32(Definition* def) { |
ASSERT(IsPotentialUint32Definition(def)); |
if (def->IsBoxInt64()) { |
@@ -1724,7 +1678,6 @@ bool IntegerInstructionSelector::CanBecomeUint32(Definition* def) { |
AllUsesAreUint32Narrowing(def->env_use_list()); |
} |
- |
void IntegerInstructionSelector::Propagate() { |
ASSERT(selected_uint32_defs_ != NULL); |
bool changed = true; |
@@ -1760,7 +1713,6 @@ void IntegerInstructionSelector::Propagate() { |
} |
} |
- |
Definition* IntegerInstructionSelector::ConstructReplacementFor( |
Definition* def) { |
// Should only see mint definitions. |
@@ -1800,7 +1752,6 @@ Definition* IntegerInstructionSelector::ConstructReplacementFor( |
return NULL; |
} |
- |
void IntegerInstructionSelector::ReplaceInstructions() { |
if (FLAG_trace_integer_ir_selection) { |
THR_Print("++++ Replacing instructions:\n"); |
@@ -1825,7 +1776,6 @@ void IntegerInstructionSelector::ReplaceInstructions() { |
} |
} |
- |
RangeBoundary RangeBoundary::FromDefinition(Definition* defn, int64_t offs) { |
if (defn->IsConstant() && defn->AsConstant()->value().IsSmi()) { |
return FromConstant(Smi::Cast(defn->AsConstant()->value()).Value() + offs); |
@@ -1833,7 +1783,6 @@ RangeBoundary RangeBoundary::FromDefinition(Definition* defn, int64_t offs) { |
return RangeBoundary(kSymbol, reinterpret_cast<intptr_t>(defn), offs); |
} |
- |
RangeBoundary RangeBoundary::LowerBound() const { |
if (IsInfinity()) { |
return NegativeInfinity(); |
@@ -1843,7 +1792,6 @@ RangeBoundary RangeBoundary::LowerBound() const { |
RangeBoundary::FromConstant(offset_), NegativeInfinity()); |
} |
- |
RangeBoundary RangeBoundary::UpperBound() const { |
if (IsInfinity()) { |
return PositiveInfinity(); |
@@ -1854,7 +1802,6 @@ RangeBoundary RangeBoundary::UpperBound() const { |
RangeBoundary::FromConstant(offset_), PositiveInfinity()); |
} |
- |
RangeBoundary RangeBoundary::Add(const RangeBoundary& a, |
const RangeBoundary& b, |
const RangeBoundary& overflow) { |
@@ -1870,7 +1817,6 @@ RangeBoundary RangeBoundary::Add(const RangeBoundary& a, |
return RangeBoundary::FromConstant(result); |
} |
- |
RangeBoundary RangeBoundary::Sub(const RangeBoundary& a, |
const RangeBoundary& b, |
const RangeBoundary& overflow) { |
@@ -1885,7 +1831,6 @@ RangeBoundary RangeBoundary::Sub(const RangeBoundary& a, |
return RangeBoundary::FromConstant(result); |
} |
- |
bool RangeBoundary::SymbolicAdd(const RangeBoundary& a, |
const RangeBoundary& b, |
RangeBoundary* result) { |
@@ -1904,7 +1849,6 @@ bool RangeBoundary::SymbolicAdd(const RangeBoundary& a, |
return false; |
} |
- |
bool RangeBoundary::SymbolicSub(const RangeBoundary& a, |
const RangeBoundary& b, |
RangeBoundary* result) { |
@@ -1921,7 +1865,6 @@ bool RangeBoundary::SymbolicSub(const RangeBoundary& a, |
return false; |
} |
- |
bool RangeBoundary::Equals(const RangeBoundary& other) const { |
if (IsConstant() && other.IsConstant()) { |
return ConstantValue() == other.ConstantValue(); |
@@ -1935,7 +1878,6 @@ bool RangeBoundary::Equals(const RangeBoundary& other) const { |
return false; |
} |
- |
RangeBoundary RangeBoundary::Shl(const RangeBoundary& value_boundary, |
int64_t shift_count, |
const RangeBoundary& overflow) { |
@@ -1954,7 +1896,6 @@ RangeBoundary RangeBoundary::Shl(const RangeBoundary& value_boundary, |
return overflow; |
} |
- |
static RangeBoundary CanonicalizeBoundary(const RangeBoundary& a, |
const RangeBoundary& overflow) { |
if (a.IsConstant() || a.IsInfinity()) { |
@@ -2016,14 +1957,12 @@ static RangeBoundary CanonicalizeBoundary(const RangeBoundary& a, |
return RangeBoundary::FromDefinition(symbol, offset); |
} |
- |
static bool CanonicalizeMaxBoundary(RangeBoundary* a) { |
if (!a->IsSymbol()) return false; |
Range* range = a->symbol()->range(); |
if ((range == NULL) || !range->max().IsSymbol()) return false; |
- |
if (Utils::WillAddOverflow(range->max().offset(), a->offset())) { |
*a = RangeBoundary::PositiveInfinity(); |
return true; |
@@ -2038,7 +1977,6 @@ static bool CanonicalizeMaxBoundary(RangeBoundary* a) { |
return true; |
} |
- |
static bool CanonicalizeMinBoundary(RangeBoundary* a) { |
if (!a->IsSymbol()) return false; |
@@ -2083,7 +2021,6 @@ static bool CanonicalizeForComparison(RangeBoundary* a, |
return false; |
} |
- |
RangeBoundary RangeBoundary::JoinMin(RangeBoundary a, |
RangeBoundary b, |
RangeBoundary::RangeSize size) { |
@@ -2110,7 +2047,6 @@ RangeBoundary RangeBoundary::JoinMin(RangeBoundary a, |
} |
} |
- |
RangeBoundary RangeBoundary::JoinMax(RangeBoundary a, |
RangeBoundary b, |
RangeBoundary::RangeSize size) { |
@@ -2137,7 +2073,6 @@ RangeBoundary RangeBoundary::JoinMax(RangeBoundary a, |
} |
} |
- |
RangeBoundary RangeBoundary::IntersectionMin(RangeBoundary a, RangeBoundary b) { |
ASSERT(!a.IsPositiveInfinity() && !b.IsPositiveInfinity()); |
ASSERT(!a.IsUnknown() && !b.IsUnknown()); |
@@ -2163,7 +2098,6 @@ RangeBoundary RangeBoundary::IntersectionMin(RangeBoundary a, RangeBoundary b) { |
return (inf_a >= inf_b) ? a : b; |
} |
- |
RangeBoundary RangeBoundary::IntersectionMax(RangeBoundary a, RangeBoundary b) { |
ASSERT(!a.IsNegativeInfinity() && !b.IsNegativeInfinity()); |
ASSERT(!a.IsUnknown() && !b.IsUnknown()); |
@@ -2189,38 +2123,32 @@ RangeBoundary RangeBoundary::IntersectionMax(RangeBoundary a, RangeBoundary b) { |
return (sup_a <= sup_b) ? a : b; |
} |
- |
int64_t RangeBoundary::ConstantValue() const { |
ASSERT(IsConstant()); |
return value_; |
} |
- |
bool Range::IsPositive() const { |
return OnlyGreaterThanOrEqualTo(0); |
} |
- |
bool Range::OnlyLessThanOrEqualTo(int64_t val) const { |
const RangeBoundary upper_bound = max().UpperBound(); |
return !upper_bound.IsPositiveInfinity() && |
(upper_bound.ConstantValue() <= val); |
} |
- |
bool Range::OnlyGreaterThanOrEqualTo(int64_t val) const { |
const RangeBoundary lower_bound = min().LowerBound(); |
return !lower_bound.IsNegativeInfinity() && |
(lower_bound.ConstantValue() >= val); |
} |
- |
// Inclusive. |
bool Range::IsWithin(int64_t min_int, int64_t max_int) const { |
return OnlyGreaterThanOrEqualTo(min_int) && OnlyLessThanOrEqualTo(max_int); |
} |
- |
bool Range::Overlaps(int64_t min_int, int64_t max_int) const { |
RangeBoundary lower = min().LowerBound(); |
RangeBoundary upper = max().UpperBound(); |
@@ -2234,7 +2162,6 @@ bool Range::Overlaps(int64_t min_int, int64_t max_int) const { |
return false; |
} |
- |
bool Range::IsUnsatisfiable() const { |
// Infinity case: [+inf, ...] || [..., -inf] |
if (min().IsPositiveInfinity() || max().IsNegativeInfinity()) { |
@@ -2249,19 +2176,16 @@ bool Range::IsUnsatisfiable() const { |
return DependOnSameSymbol(min(), max()) && min().offset() > max().offset(); |
} |
- |
void Range::Clamp(RangeBoundary::RangeSize size) { |
min_ = min_.Clamp(size); |
max_ = max_.Clamp(size); |
} |
- |
void Range::ClampToConstant(RangeBoundary::RangeSize size) { |
min_ = min_.LowerBound().Clamp(size); |
max_ = max_.UpperBound().Clamp(size); |
} |
- |
void Range::Shl(const Range* left, |
const Range* right, |
RangeBoundary* result_min, |
@@ -2290,7 +2214,6 @@ void Range::Shl(const Range* left, |
: RangeBoundary::NegativeInfinity()); |
} |
- |
void Range::Shr(const Range* left, |
const Range* right, |
RangeBoundary* result_min, |
@@ -2311,7 +2234,6 @@ void Range::Shr(const Range* left, |
left_max, left_max.ConstantValue() > 0 ? right_min : right_max); |
} |
- |
void Range::And(const Range* left_range, |
const Range* right_range, |
RangeBoundary* result_min, |
@@ -2336,14 +2258,12 @@ void Range::And(const Range* left_range, |
BitwiseOp(left_range, right_range, result_min, result_max); |
} |
- |
static int BitSize(const Range* range) { |
const int64_t min = Range::ConstantMin(range).ConstantValue(); |
const int64_t max = Range::ConstantMax(range).ConstantValue(); |
return Utils::Maximum(Utils::BitLength(min), Utils::BitLength(max)); |
} |
- |
void Range::BitwiseOp(const Range* left_range, |
const Range* right_range, |
RangeBoundary* result_min, |
@@ -2361,7 +2281,6 @@ void Range::BitwiseOp(const Range* left_range, |
RangeBoundary::FromConstant((static_cast<uint64_t>(1) << bitsize) - 1); |
} |
- |
static bool IsArrayLength(Definition* defn) { |
if (defn == NULL) { |
return false; |
@@ -2370,7 +2289,6 @@ static bool IsArrayLength(Definition* defn) { |
return (load != NULL) && load->IsImmutableLengthLoad(); |
} |
- |
void Range::Add(const Range* left_range, |
const Range* right_range, |
RangeBoundary* result_min, |
@@ -2401,7 +2319,6 @@ void Range::Add(const Range* left_range, |
} |
} |
- |
void Range::Sub(const Range* left_range, |
const Range* right_range, |
RangeBoundary* result_min, |
@@ -2432,7 +2349,6 @@ void Range::Sub(const Range* left_range, |
} |
} |
- |
void Range::Mul(const Range* left_range, |
const Range* right_range, |
RangeBoundary* result_min, |
@@ -2479,19 +2395,16 @@ void Range::Mul(const Range* left_range, |
*result_max = RangeBoundary::PositiveInfinity(); |
} |
- |
// Both the a and b ranges are >= 0. |
bool Range::OnlyPositiveOrZero(const Range& a, const Range& b) { |
return a.OnlyGreaterThanOrEqualTo(0) && b.OnlyGreaterThanOrEqualTo(0); |
} |
- |
// Both the a and b ranges are <= 0. |
bool Range::OnlyNegativeOrZero(const Range& a, const Range& b) { |
return a.OnlyLessThanOrEqualTo(0) && b.OnlyLessThanOrEqualTo(0); |
} |
- |
// Return the maximum absolute value included in range. |
int64_t Range::ConstantAbsMax(const Range* range) { |
if (range == NULL) { |
@@ -2502,7 +2415,6 @@ int64_t Range::ConstantAbsMax(const Range* range) { |
return Utils::Maximum(abs_min, abs_max); |
} |
- |
// Return the minimum absolute value included in range. |
int64_t Range::ConstantAbsMin(const Range* range) { |
if (range == NULL) { |
@@ -2513,7 +2425,6 @@ int64_t Range::ConstantAbsMin(const Range* range) { |
return Utils::Minimum(abs_min, abs_max); |
} |
- |
void Range::BinaryOp(const Token::Kind op, |
const Range* left_range, |
const Range* right_range, |
@@ -2571,7 +2482,6 @@ void Range::BinaryOp(const Token::Kind op, |
*result = Range(min, max); |
} |
- |
void Definition::set_range(const Range& range) { |
if (range_ == NULL) { |
range_ = new Range(); |
@@ -2579,7 +2489,6 @@ void Definition::set_range(const Range& range) { |
*range_ = range; |
} |
- |
void Definition::InferRange(RangeAnalysis* analysis, Range* range) { |
if (Type()->ToCid() == kSmiCid) { |
*range = Range::Full(RangeBoundary::kRangeBoundarySmi); |
@@ -2595,12 +2504,10 @@ void Definition::InferRange(RangeAnalysis* analysis, Range* range) { |
} |
} |
- |
static bool DependsOnSymbol(const RangeBoundary& a, Definition* symbol) { |
return a.IsSymbol() && (UnwrapConstraint(a.symbol()) == symbol); |
} |
- |
// Given the range and definition update the range so that |
// it covers both original range and definitions range. |
// |
@@ -2658,14 +2565,12 @@ static void Join(Range* range, |
} |
} |
- |
// A definition dominates a phi if its block dominates the phi's block |
// and the two blocks are different. |
static bool DominatesPhi(BlockEntryInstr* a, BlockEntryInstr* phi_block) { |
return a->Dominates(phi_block) && (a != phi_block); |
} |
- |
// When assigning range to a phi we must take care to avoid self-reference |
// cycles when phi's range depends on the phi itself. |
// To prevent such cases we impose additional restriction on symbols that |
@@ -2688,7 +2593,6 @@ static RangeBoundary EnsureAcyclicSymbol(BlockEntryInstr* phi_block, |
return limit; |
} |
- |
static const Range* GetInputRange(RangeAnalysis* analysis, |
RangeBoundary::RangeSize size, |
Value* input) { |
@@ -2705,7 +2609,6 @@ static const Range* GetInputRange(RangeAnalysis* analysis, |
} |
} |
- |
void PhiInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
const RangeBoundary::RangeSize size = RangeSizeForPhi(this); |
for (intptr_t i = 0; i < InputCount(); i++) { |
@@ -2721,7 +2624,6 @@ void PhiInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
EnsureAcyclicSymbol(phi_block, range->max(), RangeBoundary::MaxSmi())); |
} |
- |
void ConstantInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
if (value_.IsSmi()) { |
int64_t value = Smi::Cast(value_).Value(); |
@@ -2737,7 +2639,6 @@ void ConstantInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
} |
} |
- |
void ConstraintInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
const Range* value_range = analysis->GetSmiRange(value()); |
if (Range::IsUnknown(value_range)) { |
@@ -2758,7 +2659,6 @@ void ConstraintInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
*range = result; |
} |
- |
void LoadFieldInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
switch (recognized_kind()) { |
case MethodRecognizer::kObjectArrayLength: |
@@ -2781,7 +2681,6 @@ void LoadFieldInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
} |
} |
- |
void LoadIndexedInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
switch (class_id()) { |
case kTypedDataInt8ArrayCid: |
@@ -2825,7 +2724,6 @@ void LoadIndexedInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
} |
} |
- |
void LoadCodeUnitsInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
ASSERT(RawObject::IsStringClassId(class_id())); |
switch (class_id()) { |
@@ -2842,7 +2740,6 @@ void LoadCodeUnitsInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
} |
} |
- |
void IfThenElseInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
const intptr_t min = Utils::Minimum(if_true_, if_false_); |
const intptr_t max = Utils::Maximum(if_true_, if_false_); |
@@ -2850,7 +2747,6 @@ void IfThenElseInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
Range(RangeBoundary::FromConstant(min), RangeBoundary::FromConstant(max)); |
} |
- |
static RangeBoundary::RangeSize RepresentationToRangeSize(Representation r) { |
switch (r) { |
case kTagged: |
@@ -2865,7 +2761,6 @@ static RangeBoundary::RangeSize RepresentationToRangeSize(Representation r) { |
} |
} |
- |
void BinaryIntegerOpInstr::InferRangeHelper(const Range* left_range, |
const Range* right_range, |
Range* range) { |
@@ -2891,7 +2786,6 @@ void BinaryIntegerOpInstr::InferRangeHelper(const Range* left_range, |
range->Clamp(range_size); |
} |
- |
static void CacheRange(Range** slot, |
const Range* range, |
RangeBoundary::RangeSize size) { |
@@ -2908,7 +2802,6 @@ static void CacheRange(Range** slot, |
} |
} |
- |
void BinarySmiOpInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
const Range* right_smi_range = analysis->GetSmiRange(right()); |
// TODO(vegorov) completely remove this once GetSmiRange is eliminated. |
@@ -2920,19 +2813,16 @@ void BinarySmiOpInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
InferRangeHelper(analysis->GetSmiRange(left()), right_smi_range, range); |
} |
- |
void BinaryInt32OpInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
InferRangeHelper(analysis->GetSmiRange(left()), |
analysis->GetSmiRange(right()), range); |
} |
- |
void BinaryMintOpInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
InferRangeHelper(left()->definition()->range(), |
right()->definition()->range(), range); |
} |
- |
void ShiftMintOpInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
CacheRange(&shift_range_, right()->definition()->range(), |
RangeBoundary::kRangeBoundaryInt64); |
@@ -2940,7 +2830,6 @@ void ShiftMintOpInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
right()->definition()->range(), range); |
} |
- |
void BoxIntegerInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
const Range* value_range = value()->definition()->range(); |
if (!Range::IsUnknown(value_range)) { |
@@ -2948,7 +2837,6 @@ void BoxIntegerInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
} |
} |
- |
void UnboxInt32Instr::InferRange(RangeAnalysis* analysis, Range* range) { |
if (value()->Type()->ToCid() == kSmiCid) { |
const Range* value_range = analysis->GetSmiRange(value()); |
@@ -2967,7 +2855,6 @@ void UnboxInt32Instr::InferRange(RangeAnalysis* analysis, Range* range) { |
} |
} |
- |
void UnboxUint32Instr::InferRange(RangeAnalysis* analysis, Range* range) { |
const Range* value_range = NULL; |
@@ -2991,7 +2878,6 @@ void UnboxUint32Instr::InferRange(RangeAnalysis* analysis, Range* range) { |
} |
} |
- |
void UnboxInt64Instr::InferRange(RangeAnalysis* analysis, Range* range) { |
const Range* value_range = value()->definition()->range(); |
if (value_range != NULL) { |
@@ -3002,7 +2888,6 @@ void UnboxInt64Instr::InferRange(RangeAnalysis* analysis, Range* range) { |
} |
} |
- |
void UnboxedIntConverterInstr::InferRange(RangeAnalysis* analysis, |
Range* range) { |
ASSERT((from() == kUnboxedInt32) || (from() == kUnboxedMint) || |
@@ -3027,7 +2912,6 @@ void UnboxedIntConverterInstr::InferRange(RangeAnalysis* analysis, |
} |
} |
- |
bool CheckArrayBoundInstr::IsRedundant(const RangeBoundary& length) { |
Range* index_range = index()->definition()->range(); |
@@ -3081,5 +2965,4 @@ bool CheckArrayBoundInstr::IsRedundant(const RangeBoundary& length) { |
return false; |
} |
- |
} // namespace dart |