Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: runtime/vm/flow_graph_range_analysis.h

Issue 682993008: Improve precision of range analysis by allowing it to track ranges across all int typed phis. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/flow_graph_range_analysis.h
diff --git a/runtime/vm/flow_graph_range_analysis.h b/runtime/vm/flow_graph_range_analysis.h
index 8383adc70429d7898de7351120626b82b7ada7bb..a140e5024629d6e40769b0fee6ba9d4c3d0e0133 100644
--- a/runtime/vm/flow_graph_range_analysis.h
+++ b/runtime/vm/flow_graph_range_analysis.h
@@ -502,7 +502,8 @@ class RangeAnalysis : public ValueObject {
public:
explicit RangeAnalysis(FlowGraph* flow_graph)
: flow_graph_(flow_graph),
- smi_range_(Range::Full(RangeBoundary::kRangeBoundarySmi)) { }
+ smi_range_(Range::Full(RangeBoundary::kRangeBoundarySmi)),
+ int64_range_(Range::Full(RangeBoundary::kRangeBoundaryInt64)) { }
// Infer ranges for all values and remove overflow checks from binary smi
// operations when proven redundant.
@@ -510,14 +511,17 @@ class RangeAnalysis : public ValueObject {
// Helper that should be used to access ranges of inputs during range
// inference.
- // Returns meaningful results for uses of non-smi definitions that have smi
- // as a reaching type.
+ // Returns meaningful results for uses of non-smi/non-int definitions that
+ // have smi/int as a reaching type.
+ // For Int typed definitions we use full Int64 range as a safe approximation
+ // even though they might contain Bigint values because we only support
+ // 64-bit operations in the optimized code - which means that Bigint will
+ // cause deoptimization.
const Range* GetSmiRange(Value* value) const;
+ const Range* GetIntRange(Value* value) const;
static bool IsIntegerDefinition(Definition* defn) {
- return (defn->Type()->ToCid() == kSmiCid) ||
- defn->IsMintDefinition() ||
- defn->IsInt32Definition();
+ return defn->Type()->IsInt();
}
void AssignRangesRecursively(Definition* defn);
@@ -597,6 +601,8 @@ class RangeAnalysis : public ValueObject {
// Range object representing full Smi range.
Range smi_range_;
+ Range int64_range_;
+
// Value that are known to be smi or mint.
GrowableArray<Definition*> values_;

Powered by Google App Engine
This is Rietveld 408576698