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_OPERATOR_H_ | 5 #ifndef V8_COMPILER_OPERATOR_H_ |
6 #define V8_COMPILER_OPERATOR_H_ | 6 #define V8_COMPILER_OPERATOR_H_ |
7 | 7 |
8 #include <ostream> // NOLINT(readability/streams) | 8 #include <ostream> // NOLINT(readability/streams) |
9 | 9 |
10 #include "src/base/flags.h" | 10 #include "src/base/flags.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // TODO(titzer): convert return values here to size_t. | 88 // TODO(titzer): convert return values here to size_t. |
89 int ValueInputCount() const { return value_in_; } | 89 int ValueInputCount() const { return value_in_; } |
90 int EffectInputCount() const { return effect_in_; } | 90 int EffectInputCount() const { return effect_in_; } |
91 int ControlInputCount() const { return control_in_; } | 91 int ControlInputCount() const { return control_in_; } |
92 | 92 |
93 int ValueOutputCount() const { return value_out_; } | 93 int ValueOutputCount() const { return value_out_; } |
94 int EffectOutputCount() const { return effect_out_; } | 94 int EffectOutputCount() const { return effect_out_; } |
95 int ControlOutputCount() const { return control_out_; } | 95 int ControlOutputCount() const { return control_out_; } |
96 | 96 |
| 97 static size_t ZeroIfNoThrow(Properties properties) { |
| 98 return (properties & kNoThrow) == kNoThrow ? 0 : 2; |
| 99 } |
| 100 |
97 static size_t ZeroIfPure(Properties properties) { | 101 static size_t ZeroIfPure(Properties properties) { |
98 return (properties & kPure) == kPure ? 0 : 1; | 102 return (properties & kPure) == kPure ? 0 : 1; |
99 } | 103 } |
100 | 104 |
101 // TODO(titzer): API for input and output types, for typechecking graph. | 105 // TODO(titzer): API for input and output types, for typechecking graph. |
102 protected: | 106 protected: |
103 // Print the full operator into the given stream, including any | 107 // Print the full operator into the given stream, including any |
104 // static parameters. Useful for debugging and visualizing the IR. | 108 // static parameters. Useful for debugging and visualizing the IR. |
105 virtual void PrintTo(std::ostream& os) const; | 109 virtual void PrintTo(std::ostream& os) const; |
106 friend std::ostream& operator<<(std::ostream& os, const Operator& op); | 110 friend std::ostream& operator<<(std::ostream& os, const Operator& op); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return reinterpret_cast<const Operator1<double, base::bit_equal_to<double>, | 191 return reinterpret_cast<const Operator1<double, base::bit_equal_to<double>, |
188 base::bit_hash<double>>*>(op) | 192 base::bit_hash<double>>*>(op) |
189 ->parameter(); | 193 ->parameter(); |
190 } | 194 } |
191 | 195 |
192 } // namespace compiler | 196 } // namespace compiler |
193 } // namespace internal | 197 } // namespace internal |
194 } // namespace v8 | 198 } // namespace v8 |
195 | 199 |
196 #endif // V8_COMPILER_OPERATOR_H_ | 200 #endif // V8_COMPILER_OPERATOR_H_ |
OLD | NEW |