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

Unified Diff: runtime/vm/intermediate_language.h

Issue 14935005: Implement a variation of scalar replacement for non-escaping allocations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments 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 | « 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
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 923009867878d09d11cb66089f559614bc6e4e02..87220a8a848815de1b73c23b20017c79ab71e8f4 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -586,7 +586,7 @@ class EmbeddedArray<T, 0> {
M(Float32x4Clamp) \
M(Float32x4With) \
M(Float32x4ToUint32x4) \
-
+ M(MaterializeObject) \
#define FORWARD_DECLARATION(type) class type##Instr;
FOR_EACH_INSTRUCTION(FORWARD_DECLARATION)
@@ -3502,6 +3502,66 @@ class AllocateObjectInstr : public TemplateDefinition<0> {
};
+// 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.
+class MaterializeObjectInstr : public Definition {
+ public:
+ MaterializeObjectInstr(const Class& cls,
+ const ZoneGrowableArray<const Field*>& fields,
+ ZoneGrowableArray<Value*>* values)
+ : cls_(cls), fields_(fields), values_(values), locations_(NULL) {
+ ASSERT(fields_.length() == values_->length());
+ for (intptr_t i = 0; i < InputCount(); i++) {
+ InputAt(i)->set_instruction(this);
+ InputAt(i)->set_use_index(i);
+ }
+ }
+
+ const Class& cls() const { return cls_; }
+ const Field& FieldAt(intptr_t i) const {
+ return *fields_[i];
+ }
+ const Location& LocationAt(intptr_t i) {
+ return locations_[i];
+ }
+
+ DECLARE_INSTRUCTION(MaterializeObject)
+ virtual void PrintOperandsTo(BufferFormatter* f) const;
+
+ virtual intptr_t InputCount() const {
+ return values_->length();
+ }
+
+ virtual Value* InputAt(intptr_t i) const {
+ return (*values_)[i];
+ }
+
+ virtual bool CanDeoptimize() const { return false; }
+ virtual EffectSet Effects() const { return EffectSet::None(); }
+
+ LocationSummary* locs() {
+ UNREACHABLE();
+ return NULL;
+ }
+
+ Location* locations() { return locations_; }
+ void set_locations(Location* locations) { locations_ = locations; }
+
+ private:
+ virtual void RawSetInputAt(intptr_t i, Value* value) {
+ (*values_)[i] = value;
+ }
+
+ const Class& cls_;
+ const ZoneGrowableArray<const Field*>& fields_;
+ ZoneGrowableArray<Value*>* values_;
+ Location* locations_;
+
+ DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr);
+};
+
+
class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> {
public:
AllocateObjectWithBoundsCheckInstr(ConstructorCallNode* node,
« 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