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

Unified Diff: runtime/vm/intermediate_language.h

Issue 10894034: Make constants computations instead of values. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 1ee3947788d864b7dcff369f626a3bdb5c9ccd82..05e20a30361ee37ed2a462e155ce45adfbed12d9 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -53,7 +53,6 @@ class LocalVariable;
// typename and classname.
#define FOR_EACH_VALUE(M) \
M(Use, UseVal) \
- M(Constant, ConstantVal) \
// M is a two argument macro. It is applied to each concrete instruction's
@@ -104,7 +103,7 @@ class LocalVariable;
M(SmiToDouble, SmiToDoubleComp) \
M(CheckClass, CheckClassComp) \
M(CheckSmi, CheckSmiComp) \
- M(Materialize, MaterializeComp) \
+ M(Constant, ConstantComp) \
M(CheckEitherNonSmi, CheckEitherNonSmiComp) \
M(UnboxedDoubleBinaryOp, UnboxedDoubleBinaryOpComp) \
M(UnboxDouble, UnboxDoubleComp) \
@@ -460,57 +459,29 @@ class UseVal : public Value {
};
-class ConstantVal : public Value {
+#undef DECLARE_VALUE
+
+
+class ConstantComp : public TemplateComputation<0> {
public:
- explicit ConstantVal(const Object& value)
- : value_(value) {
- ASSERT(value.IsZoneHandle());
- ASSERT(value.IsSmi() || value.IsOld());
- }
+ explicit ConstantComp(const Object& value) : value_(value) { }
- DECLARE_VALUE(Constant)
+ DECLARE_COMPUTATION(Constant)
const Object& value() const { return value_; }
- // Returns true if the value represents a constant.
- virtual bool BindsToConstant() const { return true; }
- virtual const Object& BoundConstant() const { return value(); }
-
- // Returns true if the value represents constant null.
- virtual bool BindsToConstantNull() const { return value().IsNull(); }
+ virtual void PrintOperandsTo(BufferFormatter* f) const;
virtual bool CanDeoptimize() const { return false; }
virtual intptr_t ResultCid() const;
- virtual Value* CopyValue() { return this; }
+ virtual bool AttributesEqual(Computation* other) const;
private:
const Object& value_;
- DISALLOW_COPY_AND_ASSIGN(ConstantVal);
-};
-
-#undef DECLARE_VALUE
-
-
-class MaterializeComp : public TemplateComputation<0> {
- public:
- explicit MaterializeComp(ConstantVal* constant_val)
- : constant_val_(constant_val) { }
-
- DECLARE_COMPUTATION(Materialize)
-
- virtual void PrintOperandsTo(BufferFormatter* f) const;
-
- virtual bool CanDeoptimize() const { return false; }
-
- ConstantVal* constant_val() const { return constant_val_; }
-
- virtual intptr_t ResultCid() const;
-
- private:
- ConstantVal* constant_val_;
+ DISALLOW_COPY_AND_ASSIGN(ConstantComp);
};
@@ -2612,12 +2583,7 @@ class BackwardInstructionIterator : public ValueObject {
class GraphEntryInstr : public BlockEntryInstr {
public:
- explicit GraphEntryInstr(TargetEntryInstr* normal_entry)
- : BlockEntryInstr(),
- normal_entry_(normal_entry),
- catch_entries_(),
- start_env_(NULL),
- spill_slot_count_(0) { }
+ explicit GraphEntryInstr(TargetEntryInstr* normal_entry);
DECLARE_INSTRUCTION(GraphEntry)
@@ -2647,6 +2613,8 @@ class GraphEntryInstr : public BlockEntryInstr {
Environment* start_env() const { return start_env_; }
void set_start_env(Environment* env) { start_env_ = env; }
+ Definition* constant_null() const { return constant_null_; }
+
intptr_t spill_slot_count() const { return spill_slot_count_; }
void set_spill_slot_count(intptr_t count) {
ASSERT(count >= 0);
@@ -2657,6 +2625,7 @@ class GraphEntryInstr : public BlockEntryInstr {
TargetEntryInstr* normal_entry_;
GrowableArray<TargetEntryInstr*> catch_entries_;
Environment* start_env_;
+ Definition* constant_null_;
intptr_t spill_slot_count_;
DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr);

Powered by Google App Engine
This is Rietveld 408576698