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

Unified Diff: src/compiler/escape-analysis.h

Issue 1606613002: [turbofan] Memory improvements for escape analysis (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@stage-fix
Patch Set: Rebase Created 4 years, 11 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 | « no previous file | src/compiler/escape-analysis.cc » ('j') | src/compiler/escape-analysis.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/escape-analysis.h
diff --git a/src/compiler/escape-analysis.h b/src/compiler/escape-analysis.h
index 67ec9e1b370d7886b72f63b40791ed39cecfa46f..6f552f0fa982c3b5f919c35522cf8128b18f96ec 100644
--- a/src/compiler/escape-analysis.h
+++ b/src/compiler/escape-analysis.h
@@ -22,30 +22,54 @@ class VirtualObject;
// EscapeStatusAnalysis determines for each allocation whether it escapes.
class EscapeStatusAnalysis {
public:
+ typedef NodeId Alias;
~EscapeStatusAnalysis();
- enum EscapeStatusFlag {
+ enum Status {
kUnknown = 0u,
kTracked = 1u << 0,
kEscaped = 1u << 1,
kOnStack = 1u << 2,
kVisited = 1u << 3,
+ kDanglingComputed = 1u << 4,
Jarin 2016/01/22 13:36:11 Could we have some comments that gives some explan
sigurds 2016/01/25 10:34:56 Done.
+ kDangling = 1u << 5,
+ kBranchPointComputed = 1u << 6,
+ kBranchPoint = 1u << 7,
};
- typedef base::Flags<EscapeStatusFlag, unsigned char> EscapeStatusFlags;
+ typedef base::Flags<Status, unsigned char> StatusFlags;
- void Run();
+ void RunStatusAnalysis();
bool IsVirtual(Node* node);
bool IsEscaped(Node* node);
bool IsAllocation(Node* node);
-
void DebugPrint();
- friend class EscapeAnalysis;
-
- private:
+ protected:
EscapeStatusAnalysis(EscapeAnalysis* object_analysis, Graph* graph,
Zone* zone);
+ void EnqueueForStatusAnalysis(Node* node);
+ bool SetEscaped(Node* node);
+ bool IsEffectBranchPoint(Node* node);
+ bool IsDanglingEffectNode(Node* node);
+ void ResizeStatusVector();
+ size_t GetStatusVectorSize();
+ bool IsVirtual(NodeId id);
+
+ Graph* graph() const { return graph_; }
+ Zone* zone() const { return zone_; }
+ void AssignAliases();
+ Alias GetAlias(NodeId id) const { return aliases_[id]; }
+ const ZoneVector<Alias>& GetAliasMap() const { return aliases_; }
+ Alias AliasCount() const { return next_free_alias_; }
+ static const Alias kNotReachable;
+ static const Alias kUntrackable;
+
+ bool IsNotReachable(Node* node);
+
+ ZoneVector<Node*> stack_;
+
+ private:
void Process(Node* node);
void ProcessAllocate(Node* node);
void ProcessFinishRegion(Node* node);
@@ -57,27 +81,26 @@ class EscapeStatusAnalysis {
bool CheckUsesForEscape(Node* node, Node* rep, bool phi_escaping = false);
void RevisitUses(Node* node);
void RevisitInputs(Node* node);
- bool SetEscaped(Node* node);
- bool IsVirtual(NodeId id);
+
+ Alias NextAlias() { return next_free_alias_++; }
+
bool HasEntry(Node* node);
- void Resize();
- size_t size();
- bool IsAllocationPhi(Node* node);
- Graph* graph() const { return graph_; }
- Zone* zone() const { return zone_; }
+ bool IsAllocationPhi(Node* node);
EscapeAnalysis* object_analysis_;
Graph* const graph_;
Zone* const zone_;
- ZoneVector<EscapeStatusFlags> status_;
- ZoneDeque<Node*> queue_;
+ ZoneVector<StatusFlags> status_;
+ Alias next_free_alias_;
+ ZoneVector<Node*> status_stack_;
+ ZoneVector<Alias> aliases_;
DISALLOW_COPY_AND_ASSIGN(EscapeStatusAnalysis);
};
-DEFINE_OPERATORS_FOR_FLAGS(EscapeStatusAnalysis::EscapeStatusFlags)
+DEFINE_OPERATORS_FOR_FLAGS(EscapeStatusAnalysis::StatusFlags)
// Forward Declaration.
@@ -86,10 +109,8 @@ class MergeCache;
// EscapeObjectAnalysis simulates stores to determine values of loads if
// an object is virtual and eliminated.
-class EscapeAnalysis {
+class EscapeAnalysis : private EscapeStatusAnalysis {
Jarin 2016/01/22 13:36:11 Is there a good reason to inherit? Is it just to s
sigurds 2016/01/25 10:34:56 Done.
public:
- typedef NodeId Alias;
-
EscapeAnalysis(Graph* graph, CommonOperatorBuilder* common, Zone* zone);
~EscapeAnalysis();
@@ -104,7 +125,6 @@ class EscapeAnalysis {
private:
void RunObjectAnalysis();
- void AssignAliases();
bool Process(Node* node);
void ProcessLoadField(Node* node);
void ProcessStoreField(Node* node);
@@ -120,10 +140,10 @@ class EscapeAnalysis {
VirtualState* states);
void ForwardVirtualState(Node* node);
- bool IsEffectBranchPoint(Node* node);
- bool IsDanglingEffectNode(Node* node);
int OffsetFromAccess(Node* node);
-
+ VirtualState* CopyForModificationAt(VirtualState* state, Node* node);
+ VirtualObject* CopyForModificationAt(VirtualObject* obj, VirtualState* state,
+ Node* node);
VirtualObject* GetVirtualObject(Node* at, NodeId id);
VirtualObject* ResolveVirtualObject(VirtualState* state, Node* node);
Node* GetReplacementIfSame(ZoneVector<VirtualObject*>& objs);
@@ -142,24 +162,12 @@ class EscapeAnalysis {
void DebugPrintState(VirtualState* state);
void DebugPrintObject(VirtualObject* state, Alias id);
- Alias NextAlias() { return next_free_alias_++; }
- Alias AliasCount() const { return next_free_alias_; }
-
- Graph* graph() const { return graph_; }
CommonOperatorBuilder* common() const { return common_; }
- Zone* zone() const { return zone_; }
- static const Alias kNotReachable;
- static const Alias kUntrackable;
- Graph* const graph_;
CommonOperatorBuilder* const common_;
- Zone* const zone_;
ZoneVector<VirtualState*> virtual_states_;
ZoneVector<Node*> replacements_;
- EscapeStatusAnalysis escape_status_;
MergeCache* cache_;
- ZoneVector<Alias> aliases_;
- Alias next_free_alias_;
DISALLOW_COPY_AND_ASSIGN(EscapeAnalysis);
};
« no previous file with comments | « no previous file | src/compiler/escape-analysis.cc » ('j') | src/compiler/escape-analysis.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698