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

Unified Diff: runtime/vm/flow_graph_range_analysis.h

Issue 619903002: Generalize bounds checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months 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 fa07e6037826d31a0915fa74e35026a9d06e51f5..8383adc70429d7898de7351120626b82b7ada7bb 100644
--- a/runtime/vm/flow_graph_range_analysis.h
+++ b/runtime/vm/flow_graph_range_analysis.h
@@ -490,6 +490,10 @@ class RangeUtils : public AllStatic {
static bool IsWithin(Range* range, int64_t min, int64_t max) {
return !Range::IsUnknown(range) && range->IsWithin(min, max);
}
+
+ static bool IsPositive(Range* range) {
+ return !Range::IsUnknown(range) && range->IsPositive();
+ }
};
@@ -510,6 +514,14 @@ class RangeAnalysis : public ValueObject {
// as a reaching type.
const Range* GetSmiRange(Value* value) const;
+ static bool IsIntegerDefinition(Definition* defn) {
+ return (defn->Type()->ToCid() == kSmiCid) ||
+ defn->IsMintDefinition() ||
+ defn->IsInt32Definition();
+ }
+
+ void AssignRangesRecursively(Definition* defn);
+
private:
enum JoinOperator {
NONE,
@@ -539,7 +551,7 @@ class RangeAnalysis : public ValueObject {
Range* constraint,
Instruction* after);
- void ConstrainValueAfterBranch(Value* use, Definition* defn);
+ bool ConstrainValueAfterBranch(Value* use, Definition* defn);
void ConstrainValueAfterCheckArrayBound(Value* use, Definition* defn);
// Replace uses of the definition def that are dominated by instruction dom
@@ -553,7 +565,7 @@ class RangeAnalysis : public ValueObject {
void InferRanges();
// Collect integer definition in the reverse postorder.
- void CollectDefinitions(BlockEntryInstr* block, BitVector* set);
+ void CollectDefinitions(BitVector* set);
// Recompute ranges of all definitions until they stop changing.
// Apply the given JoinOperator when computing Phi ranges.
@@ -570,6 +582,8 @@ class RangeAnalysis : public ValueObject {
// Convert mint operations that stay within int32 range into Int32 operations.
void NarrowMintToInt32();
+ void DiscoverSimpleInductionVariables();
+
// Remove artificial Constraint instructions and replace them with actual
// unconstrained definitions.
void RemoveConstraints();

Powered by Google App Engine
This is Rietveld 408576698