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

Unified Diff: runtime/vm/flow_graph_optimizer.h

Issue 395943003: Support allocation sinking for compound objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: improve tests Created 6 years, 5 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/flow_graph_allocator.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.h
diff --git a/runtime/vm/flow_graph_optimizer.h b/runtime/vm/flow_graph_optimizer.h
index 3aecb910f784ab23227db1ab22ab68d93eddbc17..e9a74828a1696f5c1c5f72d8c68419705602bfe5 100644
--- a/runtime/vm/flow_graph_optimizer.h
+++ b/runtime/vm/flow_graph_optimizer.h
@@ -429,13 +429,54 @@ class AllocationSinking : public ZoneAllocated {
public:
explicit AllocationSinking(FlowGraph* flow_graph)
: flow_graph_(flow_graph),
+ candidates_(5),
materializations_(5) { }
+ const GrowableArray<AllocateObjectInstr*>& candidates() const {
+ return candidates_;
+ }
+
+ // Find the materialization insterted for the given allocation
+ // at the given exit.
+ MaterializeObjectInstr* MaterializationFor(Definition* alloc,
+ Instruction* exit);
+
void Optimize();
void DetachMaterializations();
private:
+ // Helper class to collect deoptimization exits that might need to
+ // rematerialize an object: that is either instructions that reference
+ // this object explicitly in their deoptimization environment or
+ // reference some other allocation sinking candidate that points to
+ // this object.
+ class ExitsCollector : public ValueObject {
+ public:
+ ExitsCollector() : exits_(10), worklist_(3) { }
+
+ const GrowableArray<Instruction*>& exits() const { return exits_; }
+
+ void CollectTransitively(Definition* alloc);
+
+ private:
+ // Collect immediate uses of this object in the environments.
+ // If this object is stored into other allocation sinking candidates
+ // put them onto worklist so that CollectTransitively will process them.
+ void Collect(Definition* alloc);
+
+ GrowableArray<Instruction*> exits_;
+ GrowableArray<Definition*> worklist_;
+ };
+
+ void CollectCandidates();
+
+ void NormalizeMaterializations();
+
+ void RemoveUnusedMaterializations();
+
+ void DiscoverFailedCandidates();
+
void InsertMaterializations(AllocateObjectInstr* alloc);
void CreateMaterializationAt(
@@ -444,11 +485,16 @@ class AllocationSinking : public ZoneAllocated {
const Class& cls,
const ZoneGrowableArray<const Object*>& fields);
+ void EliminateAllocation(AllocateObjectInstr* alloc);
+
Isolate* isolate() const { return flow_graph_->isolate(); }
FlowGraph* flow_graph_;
+ GrowableArray<AllocateObjectInstr*> candidates_;
GrowableArray<MaterializeObjectInstr*> materializations_;
+
+ ExitsCollector exits_collector_;
};
« no previous file with comments | « runtime/vm/flow_graph_allocator.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698