OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_COMMON_OPERATOR_H_ | 5 #ifndef V8_COMPILER_COMMON_OPERATOR_H_ |
6 #define V8_COMPILER_COMMON_OPERATOR_H_ | 6 #define V8_COMPILER_COMMON_OPERATOR_H_ |
7 | 7 |
8 #include "src/compiler/machine-type.h" | 8 #include "src/compiler/machine-type.h" |
9 #include "src/unique.h" | 9 #include "src/unique.h" |
10 | 10 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 bool operator!=(FrameStateCallInfo const&, FrameStateCallInfo const&); | 149 bool operator!=(FrameStateCallInfo const&, FrameStateCallInfo const&); |
150 | 150 |
151 size_t hash_value(FrameStateCallInfo const&); | 151 size_t hash_value(FrameStateCallInfo const&); |
152 | 152 |
153 std::ostream& operator<<(std::ostream&, FrameStateCallInfo const&); | 153 std::ostream& operator<<(std::ostream&, FrameStateCallInfo const&); |
154 | 154 |
155 | 155 |
156 size_t ProjectionIndexOf(const Operator* const); | 156 size_t ProjectionIndexOf(const Operator* const); |
157 | 157 |
158 | 158 |
| 159 // The {IrOpcode::kParameter} opcode represents an incoming parameter to the |
| 160 // function. This class bundles the index and a debug name for such operators. |
| 161 class ParameterInfo final { |
| 162 public: |
| 163 ParameterInfo(int index, const char* debug_name) |
| 164 : index_(index), debug_name_(debug_name) {} |
| 165 |
| 166 int index() const { return index_; } |
| 167 const char* debug_name() const { return debug_name_; } |
| 168 |
| 169 private: |
| 170 int index_; |
| 171 const char* debug_name_; |
| 172 }; |
| 173 |
| 174 std::ostream& operator<<(std::ostream&, ParameterInfo const&); |
| 175 |
| 176 int ParameterIndexOf(const Operator* const); |
| 177 const ParameterInfo& ParameterInfoOf(const Operator* const); |
| 178 |
| 179 |
159 // Interface for building common operators that can be used at any level of IR, | 180 // Interface for building common operators that can be used at any level of IR, |
160 // including JavaScript, mid-level, and low-level. | 181 // including JavaScript, mid-level, and low-level. |
161 class CommonOperatorBuilder final : public ZoneObject { | 182 class CommonOperatorBuilder final : public ZoneObject { |
162 public: | 183 public: |
163 explicit CommonOperatorBuilder(Zone* zone); | 184 explicit CommonOperatorBuilder(Zone* zone); |
164 | 185 |
165 // Special operator used only in Branches to mark them as always taken, but | 186 // Special operator used only in Branches to mark them as always taken, but |
166 // still unfoldable. This is required to properly connect non terminating | 187 // still unfoldable. This is required to properly connect non terminating |
167 // loops to end (in both the sea of nodes and the CFG). | 188 // loops to end (in both the sea of nodes and the CFG). |
168 const Operator* Always(); | 189 const Operator* Always(); |
169 | 190 |
170 const Operator* Dead(); | 191 const Operator* Dead(); |
171 const Operator* End(); | 192 const Operator* End(); |
172 const Operator* Branch(BranchHint = BranchHint::kNone); | 193 const Operator* Branch(BranchHint = BranchHint::kNone); |
173 const Operator* IfTrue(); | 194 const Operator* IfTrue(); |
174 const Operator* IfFalse(); | 195 const Operator* IfFalse(); |
175 const Operator* IfSuccess(); | 196 const Operator* IfSuccess(); |
176 const Operator* IfException(); | 197 const Operator* IfException(); |
177 const Operator* Switch(size_t control_output_count); | 198 const Operator* Switch(size_t control_output_count); |
178 const Operator* IfValue(int32_t value); | 199 const Operator* IfValue(int32_t value); |
179 const Operator* IfDefault(); | 200 const Operator* IfDefault(); |
180 const Operator* Throw(); | 201 const Operator* Throw(); |
181 const Operator* Deoptimize(); | 202 const Operator* Deoptimize(); |
182 const Operator* Return(); | 203 const Operator* Return(); |
183 | 204 |
184 const Operator* Start(int num_formal_parameters); | 205 const Operator* Start(int num_formal_parameters); |
185 const Operator* Loop(int control_input_count); | 206 const Operator* Loop(int control_input_count); |
186 const Operator* Merge(int control_input_count); | 207 const Operator* Merge(int control_input_count); |
187 const Operator* Parameter(int index); | 208 const Operator* Parameter(int index, const char* debug_name = nullptr); |
188 | 209 |
189 const Operator* OsrNormalEntry(); | 210 const Operator* OsrNormalEntry(); |
190 const Operator* OsrLoopEntry(); | 211 const Operator* OsrLoopEntry(); |
191 const Operator* OsrValue(int index); | 212 const Operator* OsrValue(int index); |
192 | 213 |
193 const Operator* Int32Constant(int32_t); | 214 const Operator* Int32Constant(int32_t); |
194 const Operator* Int64Constant(int64_t); | 215 const Operator* Int64Constant(int64_t); |
195 const Operator* Float32Constant(volatile float); | 216 const Operator* Float32Constant(volatile float); |
196 const Operator* Float64Constant(volatile double); | 217 const Operator* Float64Constant(volatile double); |
197 const Operator* ExternalConstant(const ExternalReference&); | 218 const Operator* ExternalConstant(const ExternalReference&); |
(...skipping 26 matching lines...) Expand all Loading... |
224 Zone* const zone_; | 245 Zone* const zone_; |
225 | 246 |
226 DISALLOW_COPY_AND_ASSIGN(CommonOperatorBuilder); | 247 DISALLOW_COPY_AND_ASSIGN(CommonOperatorBuilder); |
227 }; | 248 }; |
228 | 249 |
229 } // namespace compiler | 250 } // namespace compiler |
230 } // namespace internal | 251 } // namespace internal |
231 } // namespace v8 | 252 } // namespace v8 |
232 | 253 |
233 #endif // V8_COMPILER_COMMON_OPERATOR_H_ | 254 #endif // V8_COMPILER_COMMON_OPERATOR_H_ |
OLD | NEW |