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

Unified Diff: runtime/vm/intermediate_language.h

Issue 184523002: Allocation sinking for contexts. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: added new test Created 6 years, 1 month 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 41687)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -3861,6 +3861,39 @@
};
+class AllocateUninitializedContextInstr
+ : public TemplateDefinition<0, NoThrow> {
+ public:
+ AllocateUninitializedContextInstr(intptr_t token_pos,
+ intptr_t num_context_variables)
+ : token_pos_(token_pos),
+ num_context_variables_(num_context_variables),
+ identity_(AliasIdentity::Unknown()) {}
+
+ DECLARE_INSTRUCTION(AllocateUninitializedContext)
+ virtual CompileType ComputeType() const;
+
+ virtual intptr_t token_pos() const { return token_pos_; }
+ intptr_t num_context_variables() const { return num_context_variables_; }
+
+ virtual void PrintOperandsTo(BufferFormatter* f) const;
+
+ virtual bool CanDeoptimize() const { return false; }
+
+ virtual EffectSet Effects() const { return EffectSet::None(); }
+
+ virtual AliasIdentity Identity() const { return identity_; }
+ virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; }
+
+ private:
+ const intptr_t token_pos_;
+ const intptr_t num_context_variables_;
+ AliasIdentity identity_;
+
+ DISALLOW_COPY_AND_ASSIGN(AllocateUninitializedContextInstr);
+};
+
+
// This instruction captures the state of the object which had its allocation
// removed during the AllocationSinking pass.
// It does not produce any real code only deoptimization information.
@@ -3867,11 +3900,11 @@
class MaterializeObjectInstr : public Definition {
public:
MaterializeObjectInstr(AllocateObjectInstr* allocation,
- const Class& cls,
const ZoneGrowableArray<const Object*>& slots,
ZoneGrowableArray<Value*>* values)
: allocation_(allocation),
- cls_(cls),
+ cls_(allocation->cls()),
+ num_variables_(-1),
slots_(slots),
values_(values),
locations_(NULL),
@@ -3884,13 +3917,37 @@
}
}
- AllocateObjectInstr* allocation() const { return allocation_; }
+ MaterializeObjectInstr(AllocateUninitializedContextInstr* allocation,
+ const ZoneGrowableArray<const Object*>& slots,
+ ZoneGrowableArray<Value*>* values)
+ : allocation_(allocation),
+ cls_(Class::ZoneHandle(Object::context_class())),
+ num_variables_(allocation->num_context_variables()),
+ slots_(slots),
+ values_(values),
+ locations_(NULL),
+ visited_for_liveness_(false),
+ registers_remapped_(false) {
+ ASSERT(slots_.length() == values_->length());
+ for (intptr_t i = 0; i < InputCount(); i++) {
+ InputAt(i)->set_instruction(this);
+ InputAt(i)->set_use_index(i);
+ }
+ }
+
+ Definition* allocation() const { return allocation_; }
const Class& cls() const { return cls_; }
+
+ intptr_t num_variables() const {
+ return num_variables_;
+ }
+
intptr_t FieldOffsetAt(intptr_t i) const {
return slots_[i]->IsField()
? Field::Cast(*slots_[i]).Offset()
: Smi::Cast(*slots_[i]).Value();
}
+
const Location& LocationAt(intptr_t i) {
return locations_[i];
}
@@ -3937,8 +3994,9 @@
(*values_)[i] = value;
}
- AllocateObjectInstr* allocation_;
+ Definition* allocation_;
const Class& cls_;
+ intptr_t num_variables_;
const ZoneGrowableArray<const Object*>& slots_;
ZoneGrowableArray<Value*>* values_;
Location* locations_;
@@ -4228,7 +4286,7 @@
AllocateContextInstr(intptr_t token_pos,
intptr_t num_context_variables)
: token_pos_(token_pos),
- num_context_variables_(num_context_variables) {}
+ num_context_variables_(num_context_variables) { }
DECLARE_INSTRUCTION(AllocateContext)
virtual CompileType ComputeType() const;
@@ -4274,34 +4332,6 @@
};
-class AllocateUninitializedContextInstr
- : public TemplateDefinition<0, NoThrow> {
- public:
- AllocateUninitializedContextInstr(intptr_t token_pos,
- intptr_t num_context_variables)
- : token_pos_(token_pos),
- num_context_variables_(num_context_variables) {}
-
- DECLARE_INSTRUCTION(AllocateUninitializedContext)
- virtual CompileType ComputeType() const;
-
- virtual intptr_t token_pos() const { return token_pos_; }
- intptr_t num_context_variables() const { return num_context_variables_; }
-
- virtual void PrintOperandsTo(BufferFormatter* f) const;
-
- virtual bool CanDeoptimize() const { return false; }
-
- virtual EffectSet Effects() const { return EffectSet::None(); }
-
- private:
- const intptr_t token_pos_;
- const intptr_t num_context_variables_;
-
- DISALLOW_COPY_AND_ASSIGN(AllocateUninitializedContextInstr);
-};
-
-
class CloneContextInstr : public TemplateDefinition<1, NoThrow> {
public:
CloneContextInstr(intptr_t token_pos, Value* context_value)
« runtime/vm/debugger.cc ('K') | « runtime/vm/il_printer.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698