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

Unified Diff: runtime/vm/intermediate_language.h

Issue 11273111: Allow bound check elimination to eliminate checks when both array length and index boundaries are e… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address Florian's 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/hash_map_test.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 ccb0b2def5266170f6e7ddce541763bb2937540c..5402e9a23069c7b738c389cfdef8cdd3788ef049 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -1607,7 +1607,7 @@ class RangeBoundary : public ValueObject {
static RangeBoundary Max(RangeBoundary a, RangeBoundary b);
bool Overflowed() const {
- return !Smi::IsValid(value());
+ return IsConstant() && !Smi::IsValid(value());
}
RangeBoundary Clamp() const {
@@ -2367,7 +2367,8 @@ class StaticCallInstr : public TemplateDefinition<0> {
function_(function),
argument_names_(argument_names),
arguments_(arguments),
- result_cid_(kDynamicCid) {
+ result_cid_(kDynamicCid),
+ is_known_constructor_(false) {
ASSERT(function.IsZoneHandle());
ASSERT(argument_names.IsZoneHandle());
}
@@ -2394,6 +2395,11 @@ class StaticCallInstr : public TemplateDefinition<0> {
virtual intptr_t ResultCid() const { return result_cid_; }
void set_result_cid(intptr_t value) { result_cid_ = value; }
+ bool is_known_constructor() const { return is_known_constructor_; }
+ void set_is_known_constructor(bool is_known_constructor) {
+ is_known_constructor_ = is_known_constructor;
+ }
+
private:
const intptr_t token_pos_;
const Function& function_;
@@ -2401,6 +2407,10 @@ class StaticCallInstr : public TemplateDefinition<0> {
ZoneGrowableArray<PushArgumentInstr*>* arguments_;
intptr_t result_cid_; // For some library functions we know the result.
+ // Some library constructors have known semantics.
+ bool is_known_constructor_;
+
+
DISALLOW_COPY_AND_ASSIGN(StaticCallInstr);
};
@@ -3956,7 +3966,7 @@ class CheckArrayBoundInstr : public TemplateInstruction<2> {
intptr_t array_type() const { return array_type_; }
- bool IsRedundant();
+ bool IsRedundant(RangeBoundary length);
private:
intptr_t array_type_;
« no previous file with comments | « runtime/vm/hash_map_test.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698