OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/compiler/frame-states.h" | 9 #include "src/compiler/frame-states.h" |
| 10 #include "src/deoptimize-reason.h" |
10 #include "src/machine-type.h" | 11 #include "src/machine-type.h" |
11 #include "src/zone-containers.h" | 12 #include "src/zone-containers.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 namespace compiler { | 16 namespace compiler { |
16 | 17 |
17 // Forward declarations. | 18 // Forward declarations. |
18 class CallDescriptor; | 19 class CallDescriptor; |
19 struct CommonOperatorGlobalCache; | 20 struct CommonOperatorGlobalCache; |
(...skipping 15 matching lines...) Expand all Loading... |
35 UNREACHABLE(); | 36 UNREACHABLE(); |
36 return hint; | 37 return hint; |
37 } | 38 } |
38 | 39 |
39 inline size_t hash_value(BranchHint hint) { return static_cast<size_t>(hint); } | 40 inline size_t hash_value(BranchHint hint) { return static_cast<size_t>(hint); } |
40 | 41 |
41 std::ostream& operator<<(std::ostream&, BranchHint); | 42 std::ostream& operator<<(std::ostream&, BranchHint); |
42 | 43 |
43 BranchHint BranchHintOf(const Operator* const); | 44 BranchHint BranchHintOf(const Operator* const); |
44 | 45 |
| 46 // Deoptimize reason for Deoptimize, DeoptimizeIf and DeoptimizeUnless. |
| 47 DeoptimizeReason DeoptimizeReasonOf(Operator const* const); |
45 | 48 |
46 // Deoptimize bailout kind. | 49 // Deoptimize bailout kind. |
47 enum class DeoptimizeKind : uint8_t { kEager, kSoft }; | 50 enum class DeoptimizeKind : uint8_t { kEager, kSoft }; |
48 | 51 |
49 size_t hash_value(DeoptimizeKind kind); | 52 size_t hash_value(DeoptimizeKind kind); |
50 | 53 |
51 std::ostream& operator<<(std::ostream&, DeoptimizeKind); | 54 std::ostream& operator<<(std::ostream&, DeoptimizeKind); |
52 | 55 |
53 DeoptimizeKind DeoptimizeKindOf(const Operator* const); | 56 // Parameters for the {Deoptimize} operator. |
| 57 class DeoptimizeParameters final { |
| 58 public: |
| 59 DeoptimizeParameters(DeoptimizeKind kind, DeoptimizeReason reason) |
| 60 : kind_(kind), reason_(reason) {} |
54 | 61 |
| 62 DeoptimizeKind kind() const { return kind_; } |
| 63 DeoptimizeReason reason() const { return reason_; } |
| 64 |
| 65 private: |
| 66 DeoptimizeKind const kind_; |
| 67 DeoptimizeReason const reason_; |
| 68 }; |
| 69 |
| 70 bool operator==(DeoptimizeParameters, DeoptimizeParameters); |
| 71 bool operator!=(DeoptimizeParameters, DeoptimizeParameters); |
| 72 |
| 73 size_t hast_value(DeoptimizeParameters p); |
| 74 |
| 75 std::ostream& operator<<(std::ostream&, DeoptimizeParameters p); |
| 76 |
| 77 DeoptimizeParameters const& DeoptimizeParametersOf(Operator const* const); |
55 | 78 |
56 // Prediction whether throw-site is surrounded by any local catch-scope. | 79 // Prediction whether throw-site is surrounded by any local catch-scope. |
57 enum class IfExceptionHint { kLocallyUncaught, kLocallyCaught }; | 80 enum class IfExceptionHint { kLocallyUncaught, kLocallyCaught }; |
58 | 81 |
59 size_t hash_value(IfExceptionHint hint); | 82 size_t hash_value(IfExceptionHint hint); |
60 | 83 |
61 std::ostream& operator<<(std::ostream&, IfExceptionHint); | 84 std::ostream& operator<<(std::ostream&, IfExceptionHint); |
62 | 85 |
63 | 86 |
64 class SelectParameters final { | 87 class SelectParameters final { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 const Operator* End(size_t control_input_count); | 186 const Operator* End(size_t control_input_count); |
164 const Operator* Branch(BranchHint = BranchHint::kNone); | 187 const Operator* Branch(BranchHint = BranchHint::kNone); |
165 const Operator* IfTrue(); | 188 const Operator* IfTrue(); |
166 const Operator* IfFalse(); | 189 const Operator* IfFalse(); |
167 const Operator* IfSuccess(); | 190 const Operator* IfSuccess(); |
168 const Operator* IfException(IfExceptionHint hint); | 191 const Operator* IfException(IfExceptionHint hint); |
169 const Operator* Switch(size_t control_output_count); | 192 const Operator* Switch(size_t control_output_count); |
170 const Operator* IfValue(int32_t value); | 193 const Operator* IfValue(int32_t value); |
171 const Operator* IfDefault(); | 194 const Operator* IfDefault(); |
172 const Operator* Throw(); | 195 const Operator* Throw(); |
173 const Operator* Deoptimize(DeoptimizeKind kind); | 196 const Operator* Deoptimize(DeoptimizeKind kind, DeoptimizeReason reason); |
174 const Operator* DeoptimizeIf(); | 197 const Operator* DeoptimizeIf(DeoptimizeReason reason); |
175 const Operator* DeoptimizeUnless(); | 198 const Operator* DeoptimizeUnless(DeoptimizeReason reason); |
176 const Operator* Return(int value_input_count = 1); | 199 const Operator* Return(int value_input_count = 1); |
177 const Operator* Terminate(); | 200 const Operator* Terminate(); |
178 | 201 |
179 const Operator* Start(int value_output_count); | 202 const Operator* Start(int value_output_count); |
180 const Operator* Loop(int control_input_count); | 203 const Operator* Loop(int control_input_count); |
181 const Operator* Merge(int control_input_count); | 204 const Operator* Merge(int control_input_count); |
182 const Operator* Parameter(int index, const char* debug_name = nullptr); | 205 const Operator* Parameter(int index, const char* debug_name = nullptr); |
183 | 206 |
184 const Operator* OsrNormalEntry(); | 207 const Operator* OsrNormalEntry(); |
185 const Operator* OsrLoopEntry(); | 208 const Operator* OsrLoopEntry(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 Zone* const zone_; | 257 Zone* const zone_; |
235 | 258 |
236 DISALLOW_COPY_AND_ASSIGN(CommonOperatorBuilder); | 259 DISALLOW_COPY_AND_ASSIGN(CommonOperatorBuilder); |
237 }; | 260 }; |
238 | 261 |
239 } // namespace compiler | 262 } // namespace compiler |
240 } // namespace internal | 263 } // namespace internal |
241 } // namespace v8 | 264 } // namespace v8 |
242 | 265 |
243 #endif // V8_COMPILER_COMMON_OPERATOR_H_ | 266 #endif // V8_COMPILER_COMMON_OPERATOR_H_ |
OLD | NEW |