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

Unified Diff: runtime/vm/intermediate_language.h

Issue 10911214: Split array loads/stores for growable arrays into two IL instructions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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/intermediate_language.h
===================================================================
--- runtime/vm/intermediate_language.h (revision 12196)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -967,10 +967,12 @@
// Returns true if the propagated cid has changed.
bool SetPropagatedCid(intptr_t cid);
- // Returns true if the definition may have side effects.
+ // Returns true if the definition is affected by side effects.
+ // Only instructions that are not affected by side effects can participate
+ // in redundancy elimination or loop invariant code motion.
// TODO(fschneider): Make this abstract and implement for all definitions
// instead of returning the safe default (true).
- virtual bool HasSideEffect() const { return true; }
+ virtual bool AffectedBySideEffect() const { return true; }
Value* input_use_list() { return input_use_list_; }
void set_input_use_list(Value* head) { input_use_list_ = head; }
@@ -2228,6 +2230,9 @@
public:
LoadIndexedInstr(Value* array, Value* index, intptr_t receiver_type)
: receiver_type_(receiver_type) {
+ ASSERT(receiver_type == kArrayCid ||
+ receiver_type == kImmutableArrayCid ||
+ receiver_type == kGrowableObjectArrayCid);
ASSERT(array != NULL);
ASSERT(index != NULL);
inputs_[0] = array;
@@ -2259,6 +2264,9 @@
Value* value,
intptr_t receiver_type)
: receiver_type_(receiver_type) {
+ ASSERT(receiver_type == kArrayCid ||
+ receiver_type == kImmutableArrayCid ||
+ receiver_type == kGrowableObjectArrayCid);
ASSERT(array != NULL);
ASSERT(index != NULL);
ASSERT(value != NULL);
@@ -2498,10 +2506,12 @@
public:
LoadVMFieldInstr(Value* value,
intptr_t offset_in_bytes,
- const AbstractType& type)
+ const AbstractType& type,
+ bool immutable = false)
srdjan 2012/09/12 07:06:40 I think setting immutable_ via a setter (similar t
Florian Schneider 2012/09/12 08:27:29 Done. Making it const for now.
: offset_in_bytes_(offset_in_bytes),
type_(type),
- result_cid_(kDynamicCid) {
+ result_cid_(kDynamicCid),
+ immutable_(immutable) {
ASSERT(value != NULL);
ASSERT(type.IsZoneHandle()); // May be null if field is not an instance.
inputs_[0] = value;
@@ -2520,10 +2530,15 @@
virtual bool CanDeoptimize() const { return false; }
virtual intptr_t ResultCid() const { return result_cid_; }
+ bool AttributesEqual(Definition* other) const;
+
+ virtual bool AffectedBySideEffect() const { return !immutable_; }
+
private:
const intptr_t offset_in_bytes_;
const AbstractType& type_;
intptr_t result_cid_;
+ bool immutable_;
DISALLOW_COPY_AND_ASSIGN(LoadVMFieldInstr);
};
@@ -2776,7 +2791,7 @@
virtual bool AttributesEqual(Definition* other) const { return true; }
- virtual bool HasSideEffect() const { return false; }
+ virtual bool AffectedBySideEffect() const { return false; }
Value* left() const { return inputs_[0]; }
@@ -2802,7 +2817,7 @@
intptr_t token_pos() const { return token_pos_; }
virtual bool CanDeoptimize() const { return false; }
- virtual bool HasSideEffect() const { return false; }
+ virtual bool AffectedBySideEffect() const { return false; }
virtual bool AttributesEqual(Definition* other) const { return true; }
virtual intptr_t ResultCid() const;
@@ -2843,7 +2858,7 @@
return kUnboxedDouble;
}
- virtual bool HasSideEffect() const { return false; }
+ virtual bool AffectedBySideEffect() const { return false; }
virtual bool AttributesEqual(Definition* other) const { return true; }
DECLARE_INSTRUCTION(UnboxDouble)
@@ -2876,7 +2891,7 @@
virtual void PrintOperandsTo(BufferFormatter* f) const;
virtual bool CanDeoptimize() const { return false; }
- virtual bool HasSideEffect() const { return false; }
+ virtual bool AffectedBySideEffect() const { return false; }
virtual bool AttributesEqual(Definition* other) const {
return op_kind() == other->AsUnboxedDoubleBinaryOp()->op_kind();
@@ -3136,7 +3151,7 @@
virtual bool AttributesEqual(Definition* other) const;
- virtual bool HasSideEffect() const { return false; }
+ virtual bool AffectedBySideEffect() const { return false; }
Value* value() const { return inputs_[0]; }
@@ -3170,7 +3185,7 @@
virtual bool AttributesEqual(Definition* other) const { return true; }
- virtual bool HasSideEffect() const { return false; }
+ virtual bool AffectedBySideEffect() const { return false; }
virtual Definition* Canonicalize();
@@ -3203,7 +3218,7 @@
virtual bool AttributesEqual(Definition* other) const;
- virtual bool HasSideEffect() const { return false; }
+ virtual bool AffectedBySideEffect() const { return false; }
Value* array() const { return inputs_[0]; }
Value* index() const { return inputs_[1]; }

Powered by Google App Engine
This is Rietveld 408576698