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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 kNoRead = 1 << 3, // Has no scheduling dependency on Effects | 42 kNoRead = 1 << 3, // Has no scheduling dependency on Effects |
43 kNoWrite = 1 << 4, // Does not modify any Effects and thereby | 43 kNoWrite = 1 << 4, // Does not modify any Effects and thereby |
44 // create new scheduling dependencies. | 44 // create new scheduling dependencies. |
45 kNoThrow = 1 << 5, // Can never generate an exception. | 45 kNoThrow = 1 << 5, // Can never generate an exception. |
46 kNoDeopt = 1 << 6, // Can never generate an eager deoptimization exit. | 46 kNoDeopt = 1 << 6, // Can never generate an eager deoptimization exit. |
47 kFoldable = kNoRead | kNoWrite, | 47 kFoldable = kNoRead | kNoWrite, |
48 kKontrol = kNoDeopt | kFoldable | kNoThrow, | 48 kKontrol = kNoDeopt | kFoldable | kNoThrow, |
49 kEliminatable = kNoDeopt | kNoWrite | kNoThrow, | 49 kEliminatable = kNoDeopt | kNoWrite | kNoThrow, |
50 kPure = kNoDeopt | kNoRead | kNoWrite | kNoThrow | kIdempotent | 50 kPure = kNoDeopt | kNoRead | kNoWrite | kNoThrow | kIdempotent |
51 }; | 51 }; |
| 52 |
| 53 // List of all bits, for the visualizer. |
| 54 #define OPERATOR_PROPERTY_LIST(V) \ |
| 55 V(Commutative) \ |
| 56 V(Associative) V(Idempotent) V(NoRead) V(NoWrite) V(NoThrow) V(NoDeopt) |
| 57 |
52 typedef base::Flags<Property, uint8_t> Properties; | 58 typedef base::Flags<Property, uint8_t> Properties; |
53 enum class PrintVerbosity { kVerbose, kSilent }; | 59 enum class PrintVerbosity { kVerbose, kSilent }; |
54 | 60 |
55 // Constructor. | 61 // Constructor. |
56 Operator(Opcode opcode, Properties properties, const char* mnemonic, | 62 Operator(Opcode opcode, Properties properties, const char* mnemonic, |
57 size_t value_in, size_t effect_in, size_t control_in, | 63 size_t value_in, size_t effect_in, size_t control_in, |
58 size_t value_out, size_t effect_out, size_t control_out); | 64 size_t value_out, size_t effect_out, size_t control_out); |
59 | 65 |
60 virtual ~Operator() {} | 66 virtual ~Operator() {} |
61 | 67 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 121 |
116 // Print the full operator into the given stream, including any | 122 // Print the full operator into the given stream, including any |
117 // static parameters. Useful for debugging and visualizing the IR. | 123 // static parameters. Useful for debugging and visualizing the IR. |
118 void PrintTo(std::ostream& os, | 124 void PrintTo(std::ostream& os, |
119 PrintVerbosity verbose = PrintVerbosity::kVerbose) const { | 125 PrintVerbosity verbose = PrintVerbosity::kVerbose) const { |
120 // We cannot make PrintTo virtual, because default arguments to virtual | 126 // We cannot make PrintTo virtual, because default arguments to virtual |
121 // methods are banned in the style guide. | 127 // methods are banned in the style guide. |
122 return PrintToImpl(os, verbose); | 128 return PrintToImpl(os, verbose); |
123 } | 129 } |
124 | 130 |
| 131 void PrintPropsTo(std::ostream& os) const; |
| 132 |
125 protected: | 133 protected: |
126 virtual void PrintToImpl(std::ostream& os, PrintVerbosity verbose) const; | 134 virtual void PrintToImpl(std::ostream& os, PrintVerbosity verbose) const; |
127 | 135 |
128 private: | 136 private: |
129 Opcode opcode_; | 137 Opcode opcode_; |
130 Properties properties_; | 138 Properties properties_; |
131 const char* mnemonic_; | 139 const char* mnemonic_; |
132 uint32_t value_in_; | 140 uint32_t value_in_; |
133 uint16_t effect_in_; | 141 uint16_t effect_in_; |
134 uint16_t control_in_; | 142 uint16_t control_in_; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 template <> | 244 template <> |
237 struct OpEqualTo<Handle<ScopeInfo>> : public Handle<ScopeInfo>::equal_to {}; | 245 struct OpEqualTo<Handle<ScopeInfo>> : public Handle<ScopeInfo>::equal_to {}; |
238 template <> | 246 template <> |
239 struct OpHash<Handle<ScopeInfo>> : public Handle<ScopeInfo>::hash {}; | 247 struct OpHash<Handle<ScopeInfo>> : public Handle<ScopeInfo>::hash {}; |
240 | 248 |
241 } // namespace compiler | 249 } // namespace compiler |
242 } // namespace internal | 250 } // namespace internal |
243 } // namespace v8 | 251 } // namespace v8 |
244 | 252 |
245 #endif // V8_COMPILER_OPERATOR_H_ | 253 #endif // V8_COMPILER_OPERATOR_H_ |
OLD | NEW |