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

Unified Diff: runtime/vm/intermediate_language.h

Issue 11262033: Simple array bounds check elimination on top of range analysis framework. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments Created 8 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
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.h
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 8c4839bf0c7b8a18a4db90d2e0088802d109bbae..83f3b8c2f027ee96177842a26d2a5f139e573efb 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -1583,9 +1583,7 @@ class RangeBoundary : public ValueObject {
return RangeBoundary(kConstant, val, 0);
}
- static RangeBoundary FromDefinition(Definition* defn, intptr_t offs = 0) {
- return RangeBoundary(kSymbol, reinterpret_cast<intptr_t>(defn), offs);
- }
+ static RangeBoundary FromDefinition(Definition* defn, intptr_t offs = 0);
static RangeBoundary MinSmi() {
return FromConstant(Smi::kMinValue);
@@ -1606,19 +1604,9 @@ class RangeBoundary : public ValueObject {
return FromConstant(Smi::kMaxValue + 1);
}
- static RangeBoundary Min(RangeBoundary a, RangeBoundary b) {
- const intptr_t min_a = a.LowerBound().value();
- const intptr_t min_b = b.LowerBound().value();
-
- return RangeBoundary::FromConstant(Utils::Minimum(min_a, min_b));
- }
-
- static RangeBoundary Max(RangeBoundary a, RangeBoundary b) {
- const intptr_t max_a = a.UpperBound().value();
- const intptr_t max_b = b.UpperBound().value();
+ static RangeBoundary Min(RangeBoundary a, RangeBoundary b);
- return RangeBoundary::FromConstant(Utils::Maximum(max_a, max_b));
- }
+ static RangeBoundary Max(RangeBoundary a, RangeBoundary b);
bool Overflowed() const {
return !Smi::IsValid(value());
@@ -1650,10 +1638,15 @@ class RangeBoundary : public ValueObject {
return reinterpret_cast<Definition*>(value_);
}
+ intptr_t offset() const {
+ return offset_;
+ }
+
RangeBoundary LowerBound() const;
RangeBoundary UpperBound() const;
void PrintTo(BufferFormatter* f) const;
+ const char* ToCString() const;
static RangeBoundary Add(const RangeBoundary& a,
const RangeBoundary& b,
@@ -2948,7 +2941,8 @@ class LoadFieldInstr : public TemplateDefinition<1> {
: offset_in_bytes_(offset_in_bytes),
type_(type),
result_cid_(kDynamicCid),
- immutable_(immutable) {
+ immutable_(immutable),
+ recognized_kind_(MethodRecognizer::kUnknown) {
ASSERT(value != NULL);
ASSERT(type.IsZoneHandle()); // May be null if field is not an instance.
inputs_[0] = value;
@@ -2974,12 +2968,24 @@ class LoadFieldInstr : public TemplateDefinition<1> {
virtual bool AffectedBySideEffect() const { return !immutable_; }
+ virtual void InferRange();
+
+ void set_recognized_kind(MethodRecognizer::Kind kind) {
+ recognized_kind_ = kind;
+ }
+
+ MethodRecognizer::Kind recognized_kind() const {
+ return recognized_kind_;
+ }
+
private:
const intptr_t offset_in_bytes_;
const AbstractType& type_;
intptr_t result_cid_;
const bool immutable_;
+ MethodRecognizer::Kind recognized_kind_;
+
DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr);
};
@@ -3986,6 +3992,8 @@ class CheckArrayBoundInstr : public TemplateInstruction<2> {
intptr_t array_type() const { return array_type_; }
+ bool IsRedundant();
+
private:
intptr_t array_type_;
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698