Index: src/compiler/escape-analysis.h |
diff --git a/src/compiler/escape-analysis.h b/src/compiler/escape-analysis.h |
index c3f236d556b73942f6c4a0c7227d5af599766263..32505def5b82b28db4791a12ba21b84a8e552797 100644 |
--- a/src/compiler/escape-analysis.h |
+++ b/src/compiler/escape-analysis.h |
@@ -5,7 +5,6 @@ |
#ifndef V8_COMPILER_ESCAPE_ANALYSIS_H_ |
#define V8_COMPILER_ESCAPE_ANALYSIS_H_ |
-#include "src/base/flags.h" |
#include "src/compiler/graph.h" |
namespace v8 { |
@@ -14,107 +13,16 @@ namespace compiler { |
// Forward declarations. |
class CommonOperatorBuilder; |
-class EscapeAnalysis; |
+class EscapeStatusAnalysis; |
+class MergeCache; |
class VirtualState; |
class VirtualObject; |
-// EscapeStatusAnalysis determines for each allocation whether it escapes. |
-class EscapeStatusAnalysis { |
- public: |
- typedef NodeId Alias; |
- ~EscapeStatusAnalysis(); |
- |
- enum Status { |
- kUnknown = 0u, |
- kTracked = 1u << 0, |
- kEscaped = 1u << 1, |
- kOnStack = 1u << 2, |
- kVisited = 1u << 3, |
- // A node is dangling, if it is a load of some kind, and does not have |
- // an effect successor. |
- kDanglingComputed = 1u << 4, |
- kDangling = 1u << 5, |
- // A node is is an effect branch point, if it has more than 2 non-dangling |
- // effect successors. |
- kBranchPointComputed = 1u << 6, |
- kBranchPoint = 1u << 7, |
- kInQueue = 1u << 8 |
- }; |
- typedef base::Flags<Status, uint16_t> StatusFlags; |
- |
- void RunStatusAnalysis(); |
- |
- bool IsVirtual(Node* node); |
- bool IsEscaped(Node* node); |
- bool IsAllocation(Node* node); |
- |
- bool IsInQueue(NodeId id); |
- void SetInQueue(NodeId id, bool on_stack); |
- |
- void DebugPrint(); |
- |
- 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); |
- |
- private: |
- void Process(Node* node); |
- void ProcessAllocate(Node* node); |
- void ProcessFinishRegion(Node* node); |
- void ProcessStoreField(Node* node); |
- void ProcessStoreElement(Node* node); |
- bool CheckUsesForEscape(Node* node, bool phi_escaping = false) { |
- return CheckUsesForEscape(node, node, phi_escaping); |
- } |
- bool CheckUsesForEscape(Node* node, Node* rep, bool phi_escaping = false); |
- void RevisitUses(Node* node); |
- void RevisitInputs(Node* node); |
- |
- Alias NextAlias() { return next_free_alias_++; } |
- |
- bool HasEntry(Node* node); |
- |
- bool IsAllocationPhi(Node* node); |
- |
- ZoneVector<Node*> stack_; |
- EscapeAnalysis* object_analysis_; |
- Graph* const graph_; |
- Zone* const zone_; |
- ZoneVector<StatusFlags> status_; |
- Alias next_free_alias_; |
- ZoneVector<Node*> status_stack_; |
- ZoneVector<Alias> aliases_; |
- |
- DISALLOW_COPY_AND_ASSIGN(EscapeStatusAnalysis); |
-}; |
- |
-DEFINE_OPERATORS_FOR_FLAGS(EscapeStatusAnalysis::StatusFlags) |
- |
-// Forward Declaration. |
-class MergeCache; |
- |
// EscapeObjectAnalysis simulates stores to determine values of loads if |
// an object is virtual and eliminated. |
class EscapeAnalysis { |
public: |
- using Alias = EscapeStatusAnalysis::Alias; |
+ typedef NodeId Alias; |
EscapeAnalysis(Graph* graph, CommonOperatorBuilder* common, Zone* zone); |
~EscapeAnalysis(); |
@@ -164,23 +72,16 @@ class EscapeAnalysis { |
void DebugPrintState(VirtualState* state); |
void DebugPrintObject(VirtualObject* state, Alias id); |
- Graph* graph() const { return status_analysis_.graph(); } |
- Zone* zone() const { return status_analysis_.zone(); } |
+ Alias GetAlias(NodeId id) const; |
+ Alias AliasCount() const; |
+ |
+ Graph* graph() const; |
+ Zone* zone() const { return zone_; } |
CommonOperatorBuilder* common() const { return common_; } |
- bool IsEffectBranchPoint(Node* node) { |
- return status_analysis_.IsEffectBranchPoint(node); |
- } |
- bool IsDanglingEffectNode(Node* node) { |
- return status_analysis_.IsDanglingEffectNode(node); |
- } |
- bool IsNotReachable(Node* node) { |
- return status_analysis_.IsNotReachable(node); |
- } |
- Alias GetAlias(NodeId id) const { return status_analysis_.GetAlias(id); } |
- Alias AliasCount() const { return status_analysis_.AliasCount(); } |
- |
- EscapeStatusAnalysis status_analysis_; |
+ |
+ Zone* const zone_; |
CommonOperatorBuilder* const common_; |
+ EscapeStatusAnalysis* status_analysis_; |
ZoneVector<VirtualState*> virtual_states_; |
ZoneVector<Node*> replacements_; |
MergeCache* cache_; |