Index: runtime/vm/flow_graph_optimizer.h |
diff --git a/runtime/vm/flow_graph_optimizer.h b/runtime/vm/flow_graph_optimizer.h |
index ea072a0121f0e19dd434b42b3f192c54975e75b6..46111e91835bdeb1c541730f850deef765a7bf53 100644 |
--- a/runtime/vm/flow_graph_optimizer.h |
+++ b/runtime/vm/flow_graph_optimizer.h |
@@ -44,6 +44,9 @@ class FlowGraphOptimizer : public FlowGraphVisitor { |
void InferSmiRanges(); |
+ // Remove environments from the instructions which do not deoptimize. |
+ void EliminateEnvironments(); |
+ |
virtual void VisitStaticCall(StaticCallInstr* instr); |
virtual void VisitInstanceCall(InstanceCallInstr* instr); |
virtual void VisitRelationalOp(RelationalOpInstr* instr); |
@@ -318,6 +321,30 @@ class IfConverter : public AllStatic { |
}; |
+class AllocationSinking : public ZoneAllocated { |
+ public: |
+ explicit AllocationSinking(FlowGraph* flow_graph) |
+ : flow_graph_(flow_graph), |
+ materializations_(5) { } |
+ |
+ void Optimize(); |
+ |
+ void DetachMaterializations(); |
+ |
+ private: |
+ void InsertMaterializations(AllocateObjectInstr* alloc); |
+ |
+ void CreateMaterializationAt( |
+ Instruction* exit, |
+ AllocateObjectInstr* alloc, |
+ const Class& cls, |
+ const ZoneGrowableArray<const Field*>& fields); |
+ |
+ FlowGraph* flow_graph_; |
+ |
+ GrowableArray<MaterializeObjectInstr*> materializations_; |
+}; |
+ |
} // namespace dart |
#endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |