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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 ZoneVector<EscapeStatusFlags> info_; | 69 ZoneVector<EscapeStatusFlags> info_; |
70 ZoneDeque<Node*> queue_; | 70 ZoneDeque<Node*> queue_; |
71 | 71 |
72 DISALLOW_COPY_AND_ASSIGN(EscapeStatusAnalysis); | 72 DISALLOW_COPY_AND_ASSIGN(EscapeStatusAnalysis); |
73 }; | 73 }; |
74 | 74 |
75 | 75 |
76 DEFINE_OPERATORS_FOR_FLAGS(EscapeStatusAnalysis::EscapeStatusFlags) | 76 DEFINE_OPERATORS_FOR_FLAGS(EscapeStatusAnalysis::EscapeStatusFlags) |
77 | 77 |
78 | 78 |
79 class MergeCache { | 79 // Forward Declaration. |
80 public: | 80 class MergeCache; |
81 explicit MergeCache(Zone* zone) | |
82 : states_(zone), objects_(zone), fields_(zone) { | |
83 states_.reserve(4); | |
84 objects_.reserve(4); | |
85 fields_.reserve(4); | |
86 } | |
87 ZoneVector<VirtualState*>& states() { return states_; } | |
88 ZoneVector<VirtualObject*>& objects() { return objects_; } | |
89 ZoneVector<Node*>& fields() { return fields_; } | |
90 void Clear() { | |
91 states_.clear(); | |
92 objects_.clear(); | |
93 fields_.clear(); | |
94 } | |
95 | |
96 private: | |
97 ZoneVector<VirtualState*> states_; | |
98 ZoneVector<VirtualObject*> objects_; | |
99 ZoneVector<Node*> fields_; | |
100 }; | |
101 | 81 |
102 | 82 |
103 // EscapeObjectAnalysis simulates stores to determine values of loads if | 83 // EscapeObjectAnalysis simulates stores to determine values of loads if |
104 // an object is virtual and eliminated. | 84 // an object is virtual and eliminated. |
105 class EscapeAnalysis { | 85 class EscapeAnalysis { |
106 public: | 86 public: |
107 EscapeAnalysis(Graph* graph, CommonOperatorBuilder* common, Zone* zone); | 87 EscapeAnalysis(Graph* graph, CommonOperatorBuilder* common, Zone* zone); |
108 ~EscapeAnalysis(); | 88 ~EscapeAnalysis(); |
109 | 89 |
110 void Run(); | 90 void Run(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 Graph* graph() const { return graph_; } | 134 Graph* graph() const { return graph_; } |
155 CommonOperatorBuilder* common() const { return common_; } | 135 CommonOperatorBuilder* common() const { return common_; } |
156 Zone* zone() const { return zone_; } | 136 Zone* zone() const { return zone_; } |
157 | 137 |
158 Graph* const graph_; | 138 Graph* const graph_; |
159 CommonOperatorBuilder* const common_; | 139 CommonOperatorBuilder* const common_; |
160 Zone* const zone_; | 140 Zone* const zone_; |
161 ZoneVector<VirtualState*> virtual_states_; | 141 ZoneVector<VirtualState*> virtual_states_; |
162 ZoneVector<Node*> replacements_; | 142 ZoneVector<Node*> replacements_; |
163 EscapeStatusAnalysis escape_status_; | 143 EscapeStatusAnalysis escape_status_; |
164 MergeCache cache_; | 144 MergeCache* cache_; |
165 | 145 |
166 DISALLOW_COPY_AND_ASSIGN(EscapeAnalysis); | 146 DISALLOW_COPY_AND_ASSIGN(EscapeAnalysis); |
167 }; | 147 }; |
168 | 148 |
169 } // namespace compiler | 149 } // namespace compiler |
170 } // namespace internal | 150 } // namespace internal |
171 } // namespace v8 | 151 } // namespace v8 |
172 | 152 |
173 #endif // V8_COMPILER_ESCAPE_ANALYSIS_H_ | 153 #endif // V8_COMPILER_ESCAPE_ANALYSIS_H_ |
OLD | NEW |