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 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 | 100 |
101 // EscapeObjectAnalysis simulates stores to determine values of loads if | 101 // EscapeObjectAnalysis simulates stores to determine values of loads if |
102 // an object is virtual and eliminated. | 102 // an object is virtual and eliminated. |
103 class EscapeAnalysis { | 103 class EscapeAnalysis { |
104 public: | 104 public: |
105 EscapeAnalysis(Graph* graph, CommonOperatorBuilder* common, Zone* zone); | 105 EscapeAnalysis(Graph* graph, CommonOperatorBuilder* common, Zone* zone); |
106 ~EscapeAnalysis(); | 106 ~EscapeAnalysis(); |
107 | 107 |
108 void Run(); | 108 void Run(); |
109 | 109 |
110 Node* GetReplacement(Node* at, NodeId id); | 110 Node* GetReplacement(NodeId id); |
Michael Starzinger
2015/12/14 13:38:32
nit/suggestion: For the public interface it might
sigurds
2015/12/14 13:48:00
I agree, I changed the interface.
| |
111 bool IsVirtual(Node* node); | 111 bool IsVirtual(Node* node); |
112 bool IsEscaped(Node* node); | 112 bool IsEscaped(Node* node); |
113 | 113 |
114 private: | 114 private: |
115 void RunObjectAnalysis(); | 115 void RunObjectAnalysis(); |
116 bool Process(Node* node); | 116 bool Process(Node* node); |
117 void ProcessLoadField(Node* node); | 117 void ProcessLoadField(Node* node); |
118 void ProcessStoreField(Node* node); | 118 void ProcessStoreField(Node* node); |
119 void ProcessLoadElement(Node* node); | 119 void ProcessLoadElement(Node* node); |
120 void ProcessStoreElement(Node* node); | 120 void ProcessStoreElement(Node* node); |
121 void ProcessAllocationUsers(Node* node); | 121 void ProcessAllocationUsers(Node* node); |
122 void ProcessAllocation(Node* node); | 122 void ProcessAllocation(Node* node); |
123 void ProcessFinishRegion(Node* node); | 123 void ProcessFinishRegion(Node* node); |
124 void ProcessCall(Node* node); | 124 void ProcessCall(Node* node); |
125 void ProcessStart(Node* node); | 125 void ProcessStart(Node* node); |
126 bool ProcessEffectPhi(Node* node); | 126 bool ProcessEffectPhi(Node* node); |
127 void ProcessLoadFromPhi(int offset, Node* from, Node* node, | 127 void ProcessLoadFromPhi(int offset, Node* from, Node* node, |
128 VirtualState* states); | 128 VirtualState* states); |
129 | 129 |
130 void ForwardVirtualState(Node* node); | 130 void ForwardVirtualState(Node* node); |
131 | 131 |
132 bool IsEffectBranchPoint(Node* node); | 132 bool IsEffectBranchPoint(Node* node); |
133 bool IsDanglingEffectNode(Node* node); | 133 bool IsDanglingEffectNode(Node* node); |
134 int OffsetFromAccess(Node* node); | 134 int OffsetFromAccess(Node* node); |
135 | 135 |
136 VirtualObject* GetVirtualObject(Node* at, NodeId id); | 136 VirtualObject* GetVirtualObject(Node* at, NodeId id); |
137 VirtualObject* ResolveVirtualObject(VirtualState* state, Node* node); | |
138 Node* GetReplacementIfSame(ZoneVector<VirtualObject*>& objs); | |
137 | 139 |
138 bool SetEscaped(Node* node); | 140 bool SetEscaped(Node* node); |
141 Node* replacement(NodeId id); | |
142 Node* replacement(Node* node); | |
143 Node* ResolveReplacement(Node* node); | |
144 bool SetReplacement(Node* node, Node* rep); | |
145 bool UpdateReplacement(VirtualState* state, Node* node, Node* rep); | |
139 | 146 |
140 void DebugPrint(); | 147 void DebugPrint(); |
141 void DebugPrintState(VirtualState* state); | 148 void DebugPrintState(VirtualState* state); |
142 void DebugPrintObject(VirtualObject* state, NodeId id); | 149 void DebugPrintObject(VirtualObject* state, NodeId id); |
143 | 150 |
144 Graph* graph() const { return graph_; } | 151 Graph* graph() const { return graph_; } |
145 CommonOperatorBuilder* common() const { return common_; } | 152 CommonOperatorBuilder* common() const { return common_; } |
146 Zone* zone() const { return zone_; } | 153 Zone* zone() const { return zone_; } |
147 | 154 |
148 Graph* const graph_; | 155 Graph* const graph_; |
149 CommonOperatorBuilder* const common_; | 156 CommonOperatorBuilder* const common_; |
150 Zone* const zone_; | 157 Zone* const zone_; |
151 ZoneVector<VirtualState*> virtual_states_; | 158 ZoneVector<VirtualState*> virtual_states_; |
159 ZoneVector<Node*> replacements_; | |
152 EscapeStatusAnalysis escape_status_; | 160 EscapeStatusAnalysis escape_status_; |
153 MergeCache cache_; | 161 MergeCache cache_; |
154 | 162 |
155 DISALLOW_COPY_AND_ASSIGN(EscapeAnalysis); | 163 DISALLOW_COPY_AND_ASSIGN(EscapeAnalysis); |
156 }; | 164 }; |
157 | 165 |
158 } // namespace compiler | 166 } // namespace compiler |
159 } // namespace internal | 167 } // namespace internal |
160 } // namespace v8 | 168 } // namespace v8 |
161 | 169 |
162 #endif // V8_COMPILER_ESCAPE_ANALYSIS_H_ | 170 #endif // V8_COMPILER_ESCAPE_ANALYSIS_H_ |
OLD | NEW |