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

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: addressed comments 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
« 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
===================================================================
--- 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; }
@@ -2226,8 +2228,7 @@
class LoadIndexedInstr : public TemplateDefinition<2> {
public:
- LoadIndexedInstr(Value* array, Value* index, intptr_t receiver_type)
- : receiver_type_(receiver_type) {
+ LoadIndexedInstr(Value* array, Value* index) {
ASSERT(array != NULL);
ASSERT(index != NULL);
inputs_[0] = array;
@@ -2240,25 +2241,17 @@
Value* array() const { return inputs_[0]; }
Value* index() const { return inputs_[1]; }
- intptr_t receiver_type() const { return receiver_type_; }
-
virtual bool CanDeoptimize() const { return false; }
virtual intptr_t ResultCid() const { return kDynamicCid; }
private:
- intptr_t receiver_type_;
-
DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr);
};
class StoreIndexedInstr : public TemplateDefinition<3> {
public:
- StoreIndexedInstr(Value* array,
- Value* index,
- Value* value,
- intptr_t receiver_type)
- : receiver_type_(receiver_type) {
+ StoreIndexedInstr(Value* array, Value* index, Value* value) {
ASSERT(array != NULL);
ASSERT(index != NULL);
ASSERT(value != NULL);
@@ -2274,14 +2267,10 @@
Value* index() const { return inputs_[1]; }
Value* value() const { return inputs_[2]; }
- intptr_t receiver_type() const { return receiver_type_; }
-
virtual bool CanDeoptimize() const { return false; }
virtual intptr_t ResultCid() const { return kDynamicCid; }
private:
- intptr_t receiver_type_;
-
DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr);
};
@@ -2498,10 +2487,12 @@
public:
LoadVMFieldInstr(Value* value,
intptr_t offset_in_bytes,
- const AbstractType& type)
+ const AbstractType& type,
+ bool immutable = false)
: 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 +2511,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_;
+ const bool immutable_;
DISALLOW_COPY_AND_ASSIGN(LoadVMFieldInstr);
};
@@ -2776,7 +2772,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 +2798,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 +2839,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 +2872,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 +3132,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 +3166,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 +3199,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]; }
« 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