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

Unified Diff: runtime/vm/intermediate_language.h

Issue 14979007: - Canonicalize array bounds checks to avoid deopting when comparing (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | « no previous file | 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
===================================================================
--- runtime/vm/intermediate_language.h (revision 22689)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -6152,13 +6152,13 @@
intptr_t array_type,
InstanceCallInstr* instance_call)
: array_type_(array_type) {
- SetInputAt(0, length);
- SetInputAt(1, index);
+ SetInputAt(locLength, length);
+ SetInputAt(locIndex, index);
deopt_id_ = instance_call->deopt_id();
}
- Value* length() const { return inputs_[0]; }
- Value* index() const { return inputs_[1]; }
+ Value* length() const { return inputs_[locLength]; }
+ Value* index() const { return inputs_[locIndex]; }
intptr_t array_type() const { return array_type_; }
@@ -6170,6 +6170,8 @@
bool IsRedundant(RangeBoundary length);
+ virtual Instruction* Canonicalize(FlowGraph* flow_graph);
+
// Returns the length offset for array and string types.
static intptr_t LengthOffsetFor(intptr_t class_id);
@@ -6183,6 +6185,11 @@
virtual bool MayThrow() const { return false; }
private:
+ // Give a name to the location/input indices.
+ enum {
+ locLength = 0,
+ locIndex = 1
srdjan 2013/05/14 18:11:47 Optional: prefix constant with k, call it kLengthP
Ivan Posva 2013/05/14 18:30:30 Done + simplified the code where we use the length
+ };
intptr_t array_type_;
DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr);
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698