OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_ESCAPE_ANALYSIS_H_ | 5 #ifndef V8_COMPILER_ESCAPE_ANALYSIS_H_ |
6 #define V8_COMPILER_ESCAPE_ANALYSIS_H_ | 6 #define V8_COMPILER_ESCAPE_ANALYSIS_H_ |
7 | 7 |
8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 // Forward declarations. | 15 // Forward declarations. |
16 class CommonOperatorBuilder; | 16 class CommonOperatorBuilder; |
17 class EscapeAnalysis; | 17 class EscapeAnalysis; |
18 class VirtualState; | 18 class VirtualState; |
| 19 class VirtualObject; |
19 | 20 |
20 | 21 |
21 // EscapeStatusAnalysis determines for each allocation whether it escapes. | 22 // EscapeStatusAnalysis determines for each allocation whether it escapes. |
22 class EscapeStatusAnalysis { | 23 class EscapeStatusAnalysis { |
23 public: | 24 public: |
24 ~EscapeStatusAnalysis(); | 25 ~EscapeStatusAnalysis(); |
25 | 26 |
26 enum EscapeStatusFlag { | 27 enum EscapeStatusFlag { |
27 kUnknown = 0u, | 28 kUnknown = 0u, |
28 kVirtual = 1u << 0, | 29 kVirtual = 1u << 0, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 class EscapeAnalysis { | 75 class EscapeAnalysis { |
75 public: | 76 public: |
76 EscapeAnalysis(Graph* graph, CommonOperatorBuilder* common, Zone* zone); | 77 EscapeAnalysis(Graph* graph, CommonOperatorBuilder* common, Zone* zone); |
77 ~EscapeAnalysis(); | 78 ~EscapeAnalysis(); |
78 | 79 |
79 void Run(); | 80 void Run(); |
80 | 81 |
81 Node* GetReplacement(Node* at, NodeId id); | 82 Node* GetReplacement(Node* at, NodeId id); |
82 bool IsVirtual(Node* node); | 83 bool IsVirtual(Node* node); |
83 bool IsEscaped(Node* node); | 84 bool IsEscaped(Node* node); |
| 85 Node* GetOrCreateObjectState(Node* effect, Node* node); |
| 86 Node* GetEffect(Node* node); |
84 | 87 |
85 private: | 88 private: |
86 void RunObjectAnalysis(); | 89 void RunObjectAnalysis(); |
87 bool Process(Node* node); | 90 bool Process(Node* node); |
88 void ProcessLoadField(Node* node); | 91 void ProcessLoadField(Node* node); |
89 void ProcessStoreField(Node* node); | 92 void ProcessStoreField(Node* node); |
90 void ProcessAllocation(Node* node); | 93 void ProcessAllocation(Node* node); |
91 void ProcessFinishRegion(Node* node); | 94 void ProcessFinishRegion(Node* node); |
92 void ProcessCall(Node* node); | 95 void ProcessCall(Node* node); |
93 void ProcessStart(Node* node); | 96 void ProcessStart(Node* node); |
94 bool ProcessEffectPhi(Node* node); | 97 bool ProcessEffectPhi(Node* node); |
95 void ForwardVirtualState(Node* node); | 98 void ForwardVirtualState(Node* node); |
96 bool IsEffectBranchPoint(Node* node); | 99 bool IsEffectBranchPoint(Node* node); |
97 bool IsDanglingEffectNode(Node* node); | 100 bool IsDanglingEffectNode(Node* node); |
98 int OffsetFromAccess(Node* node); | 101 int OffsetFromAccess(Node* node); |
99 | 102 |
| 103 VirtualObject* GetVirtualObject(Node* at, NodeId id); |
| 104 |
| 105 void RecordEffectForFrameStateUses(Node* node, Node* effect); |
| 106 |
100 void DebugPrint(); | 107 void DebugPrint(); |
101 | 108 |
102 Graph* graph() const { return graph_; } | 109 Graph* graph() const { return graph_; } |
103 CommonOperatorBuilder* common() const { return common_; } | 110 CommonOperatorBuilder* common() const { return common_; } |
104 Zone* zone() const { return zone_; } | 111 Zone* zone() const { return zone_; } |
105 | 112 |
106 Graph* const graph_; | 113 Graph* const graph_; |
107 CommonOperatorBuilder* const common_; | 114 CommonOperatorBuilder* const common_; |
108 Zone* const zone_; | 115 Zone* const zone_; |
109 ZoneVector<VirtualState*> virtual_states_; | 116 ZoneVector<VirtualState*> virtual_states_; |
110 EscapeStatusAnalysis escape_status_; | 117 EscapeStatusAnalysis escape_status_; |
| 118 ZoneVector<Node*> effects_; |
111 | 119 |
112 DISALLOW_COPY_AND_ASSIGN(EscapeAnalysis); | 120 DISALLOW_COPY_AND_ASSIGN(EscapeAnalysis); |
113 }; | 121 }; |
114 | 122 |
115 } // namespace compiler | 123 } // namespace compiler |
116 } // namespace internal | 124 } // namespace internal |
117 } // namespace v8 | 125 } // namespace v8 |
118 | 126 |
119 #endif // V8_COMPILER_ESCAPE_ANALYSIS_H_ | 127 #endif // V8_COMPILER_ESCAPE_ANALYSIS_H_ |
OLD | NEW |